You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ha...@apache.org on 2006/03/17 19:05:00 UTC
svn commit: r386679 - in /webservices/axis/trunk/c/src: engine/Axis.cpp
engine/server/ServerAxisEngine.cpp engine/server/ServerAxisEngine.h
server/simple_axis_server/SimpleAxisServer.cpp wsdd/AxisWsddException.h
wsdd/WSDDDocument.cpp
Author: hawkeye
Date: Fri Mar 17 10:04:58 2006
New Revision: 386679
URL: http://svn.apache.org/viewcvs?rev=386679&view=rev
Log:
Improved Engine trace and the engine now returns the service that couldn't be found in the fault message.
Modified:
webservices/axis/trunk/c/src/engine/Axis.cpp
webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.cpp
webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.h
webservices/axis/trunk/c/src/server/simple_axis_server/SimpleAxisServer.cpp
webservices/axis/trunk/c/src/wsdd/AxisWsddException.h
webservices/axis/trunk/c/src/wsdd/WSDDDocument.cpp
Modified: webservices/axis/trunk/c/src/engine/Axis.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/engine/Axis.cpp?rev=386679&r1=386678&r2=386679&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/Axis.cpp (original)
+++ webservices/axis/trunk/c/src/engine/Axis.cpp Fri Mar 17 10:04:58 2006
@@ -165,8 +165,10 @@
{
if (AXIS_SUCCESS == engine->initialize ())
{
+ try
+ {
Status = engine->process(pStream);
- if (AXIS_SUCCESS == Status)
+ if (AXIS_SUCCESS == Status)
{
pStream->flushOutput();
}
@@ -178,6 +180,15 @@
pObjTempServer = NULL;
Status = AXIS_SUCCESS;
}
+ }
+ catch(AxisException& e)
+ {
+ ServerAxisEngine* pObjTempServer = (ServerAxisEngine*) engine;
+ pObjTempServer->setFaultOutputStream(e, pStream);
+ pStream->flushOutput();
+ pObjTempServer = NULL;
+ Status = AXIS_SUCCESS;
+ }
}
delete engine;
}
Modified: webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.cpp?rev=386679&r1=386678&r2=386679&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.cpp (original)
+++ webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.cpp Fri Mar 17 10:04:58 2006
@@ -46,312 +46,316 @@
int nSoapVersion;
try
{
- if (!pStream)
- {
- AXISTRACE1 ("transport is not set properly", CRITICAL);
- throw AxisConfigException (SERVER_CONFIG_TRANSPORT_CONF_FAILED);
- }
- string sSessionId = pStream->getSessionId ();
-
- /*
- * After this point we should return AXIS_SUCCESS. Otherwise the transport
- * layer may not send the response back (either soap fault or result).
- */
- do
- {
- /* populate MessageData with transport information */
- m_pMsgData->m_Protocol = pStream->getProtocol ();
-
- if (AXIS_SUCCESS != m_pDZ->setInputStream (pStream))
- {
- nSoapVersion = m_pDZ->getVersion ();
- nSoapVersion =
- (nSoapVersion ==
- VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
- m_pSZ->setSoapVersion ((SOAP_VERSION) nSoapVersion);
- AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
- throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
- break; // do .. while(0)
- }
-
- const char *cService =
- pStream->getTransportProperty (SERVICE_URI);
- if (!cService)
- {
- AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
- throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
- break; // do .. while(0)
- }
- AxisString service = (cService == NULL) ? "" : cService;
-
- if (service.empty ())
- {
- nSoapVersion = m_pMsgData->m_pDZ->getVersion ();
- nSoapVersion =
- (nSoapVersion ==
- VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
- m_pSZ->setSoapVersion ((SOAP_VERSION) nSoapVersion);
- AXISTRACE1 ("CLIENT_SOAP_SOAP_ACTION_EMTPY", CRITICAL);
- throw AxisSoapException (CLIENT_SOAP_SOAP_ACTION_EMTPY);
- break; // do .. while(0)
- }
- // if there are quotes remove them.
- if (service.find ('\"') != string::npos)
- {
- service = service.substr (1, service.length () - 2);
- }
-
- // get service description object from the WSDD Deployment object
- m_pService = g_pWSDDDeployment->getService (service.c_str ());
- if (!m_pService)
- {
- nSoapVersion = m_pMsgData->m_pDZ->getVersion ();
- nSoapVersion =
- (nSoapVersion ==
- VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
- m_pSZ->setSoapVersion ((SOAP_VERSION) nSoapVersion);
- AXISTRACE1 ("CLIENT_WSDD_SERVICE_NOT_FOUND", CRITICAL);
- throw AxisWsddException (CLIENT_WSDD_SERVICE_NOT_FOUND);
- break; // do .. while(0)
- }
-
- m_CurrentProviderType = m_pService->getProvider ();
- m_pSZ->setCurrentProviderType (m_CurrentProviderType);
- m_pDZ->setCurrentProviderType (m_CurrentProviderType);
- switch (m_CurrentProviderType)
- {
- case C_RPC_PROVIDER:
- case CPP_RPC_PROVIDER:
- m_pSZ->setStyle (RPC_ENCODED);
- m_pDZ->setStyle (RPC_ENCODED);
- break;
- case C_DOC_PROVIDER:
- case CPP_DOC_PROVIDER:
- m_pSZ->setStyle (DOC_LITERAL);
- m_pDZ->setStyle (DOC_LITERAL);
- break;
- case COM_PROVIDER:
- // TODO: ??
- break;
- default:;
- // TODO: ??
- }
-
- /* Check for stream version in the request and decide whether we support
- * it or not. If we do not support send a soapfault with version
- * mismatch.
- */
- nSoapVersion = m_pDZ->getVersion ();
- if (m_pDZ->getStatus () != AXIS_SUCCESS)
- {
- AXISTRACE1 ("CLIENT_SOAP_MESSAGE_INCOMPLETE", CRITICAL);
- throw AxisSoapException (CLIENT_SOAP_MESSAGE_INCOMPLETE);
- break; // do .. while(0)
- }
-
- if (nSoapVersion == VERSION_LAST) // version not supported
- {
- m_pSZ->setSoapVersion (SOAP_VER_1_2);
- AXISTRACE1 ("SOAP_VERSION_MISMATCH", CRITICAL);
- throw AxisSoapException (SOAP_VERSION_MISMATCH);
- break; // do .. while(0)
- }
-
- /* Set Soap version in the Serializer and the envelope */
- if (AXIS_SUCCESS !=
- m_pSZ->setSoapVersion ((SOAP_VERSION) nSoapVersion))
- {
- AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
- throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
- break; // do .. while(0)
- }
-
- /* Get the operation name from transport information Ex: from
- * SOAPAction header
- */
- if (AXIS_SUCCESS != m_pDZ->getHeader ())
- {
- AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
- throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
- break; // do .. while(0)
- }
- if (AXIS_SUCCESS != m_pDZ->getBody ())
- {
- AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
- throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
- break; // do .. while(0)
- }
-
- AxisString sOperation = m_pDZ->getMethodNameToInvoke ();
-
- if (sOperation.empty ())
- {
- AXISTRACE1 ("CLIENT_SOAP_NO_SOAP_METHOD", CRITICAL);
- throw AxisSoapException (CLIENT_SOAP_NO_SOAP_METHOD);
- break; // do .. while(0)
- }
- /* remove any quotes in the operation name */
- if (sOperation.rfind ('\"') != string::npos)
- {
- sOperation = sOperation.substr (0, sOperation.length () - 1);
- }
-
- AxisString operationToInvoke = sOperation;
-
- m_pMsgData->setOperationName (operationToInvoke.c_str ());
-
- if (m_pService->isAllowedMethod (operationToInvoke.c_str ()))
- {
- /* load actual web service handler */
- if (AXIS_SUCCESS !=
- g_pHandlerPool->getWebService (&m_pWebService, sSessionId,
- m_pService))
- {
- /* error : couldnot load web service */
- AXISTRACE1 ("SERVER_ENGINE_COULD_NOT_LOAD_SRV", CRITICAL);
- throw
- AxisEngineException
- (SERVER_ENGINE_COULD_NOT_LOAD_SRV);
- break; // do .. while(0)
- }
-
- /* Check whether the provider type in the wsdd matchs the service's
- * binding style
- */
- AXIS_BINDING_STYLE nBindingStyle = RPC_ENCODED;
- if (0 != m_pWebService->_functions)
- /* C service */
- {
- nBindingStyle = m_pWebService->_functions->
- getBindingStyle (m_pWebService->_object);
- }
- else if (0 != m_pWebService->_object)
- {
- nBindingStyle = ((WrapperClassHandler *)
- m_pWebService->_object)->
- getBindingStyle ();
- }
-
- if (m_pSZ->getStyle () != nBindingStyle)
- {
- AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
- throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
- break; // do .. while(0)
- }
- }
- else
- {
- AXISTRACE1 ("CLIENT_WSDD_METHOD_NOT_ALLOWED", CRITICAL);
- throw AxisWsddException (CLIENT_WSDD_METHOD_NOT_ALLOWED);
- // Method is not an exposed allowed method
- break; // do .. while(0)
- }
-
- // Get Global and Transport Handlers
- if (AXIS_SUCCESS != (Status = initializeHandlers (sSessionId,
- pStream->
- getProtocol
- ())))
- {
- AXISTRACE1 ("SERVER_ENGINE_COULD_NOT_LOAD_HDL", CRITICAL);
- throw AxisEngineException (SERVER_ENGINE_COULD_NOT_LOAD_HDL);
- break; // do .. while(0)
- }
- // Get Service specific Handlers from the pool if configured any
- if (AXIS_SUCCESS !=
- (Status =
- g_pHandlerPool->getRequestFlowHandlerChain (&m_pSReqFChain,
- sSessionId,
- m_pService)))
- {
- AXISTRACE1 ("SERVER_ENGINE_COULD_NOT_LOAD_HDL", CRITICAL);
- throw AxisEngineException (SERVER_ENGINE_COULD_NOT_LOAD_HDL);
- break; // do .. while(0)
- }
-
- if (AXIS_SUCCESS != (Status =
- g_pHandlerPool->
- getResponseFlowHandlerChain (&m_pSResFChain,
- sSessionId,
- m_pService)))
- {
- AXISTRACE1 ("SERVER_ENGINE_COULD_NOT_LOAD_HDL", CRITICAL);
- throw AxisEngineException (SERVER_ENGINE_COULD_NOT_LOAD_HDL);
- break; // do .. while(0)
- }
-
- /*
- * Invoke all handlers including the webservice
- * in case of failure coresponding stream fault message will be set
- */
- Status = invoke (m_pMsgData);
- }
- while (0);
-
- if (AXIS_SUCCESS != m_pDZ->flushInputStream ())
- {
- AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
- }
- /*
- * Get any header blocks unprocessed (left) in the Deserializer and add them
- * to the Serializer
- * They may be headers targetted to next soap processors
- */
- HeaderBlock *pHderBlk = NULL;
- while (true)
- {
- /* Following function gets a header block from Deserializer irrespective
- * of any thing
- */
- pHderBlk = m_pDZ->getHeaderBlock ();
- /* Add it to the Serializer */
- if (pHderBlk)
- m_pSZ->addHeaderBlock (pHderBlk);
- else
- break;
- }
- m_pSZ->setOutputStream (pStream);
-
- // Pool back the handlers and services
- releaseHandlers (pStream);
- //todo
- /* An exception derived from exception which is not handled will be
- * handled here. You can call a method in AxisModule which may unload
- * the ServerAxisEngine from the webserver and report the error. You can
- * also write this in a logfile specific to axis.
- */
+ if (!pStream)
+ {
+ AXISTRACE1 ("transport is not set properly", CRITICAL);
+ throw AxisConfigException (SERVER_CONFIG_TRANSPORT_CONF_FAILED);
+ }
+ string sSessionId = pStream->getSessionId ();
+
+ /*
+ * After this point we should return AXIS_SUCCESS. Otherwise the transport
+ * layer may not send the response back (either soap fault or result).
+ */
+ do
+ {
+ /* populate MessageData with transport information */
+ m_pMsgData->m_Protocol = pStream->getProtocol ();
+
+ if (AXIS_SUCCESS != m_pDZ->setInputStream (pStream))
+ {
+ nSoapVersion = m_pDZ->getVersion ();
+ nSoapVersion =
+ (nSoapVersion ==
+ VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
+ m_pSZ->setSoapVersion ((SOAP_VERSION) nSoapVersion);
+ AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
+ throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ break; // do .. while(0)
+ }
+
+ const char *cService =
+ pStream->getTransportProperty (SERVICE_URI);
+ if (!cService)
+ {
+ AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
+ throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ break; // do .. while(0)
+ }
+ AxisString service = (cService == NULL) ? "" : cService;
+
+ if (service.empty ())
+ {
+ nSoapVersion = m_pMsgData->m_pDZ->getVersion ();
+ nSoapVersion =
+ (nSoapVersion ==
+ VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
+ m_pSZ->setSoapVersion ((SOAP_VERSION) nSoapVersion);
+ AXISTRACE1 ("CLIENT_SOAP_SOAP_ACTION_EMTPY", CRITICAL);
+ throw AxisSoapException (CLIENT_SOAP_SOAP_ACTION_EMTPY);
+ break; // do .. while(0)
+ }
+ // if there are quotes remove them.
+ if (service.find ('\"') != string::npos)
+ {
+ service = service.substr (1, service.length () - 2);
+ }
+
+ // get service description object from the WSDD Deployment object
+ m_pService = g_pWSDDDeployment->getService (service.c_str ());
+ if (!m_pService)
+ {
+ nSoapVersion = m_pMsgData->m_pDZ->getVersion ();
+ nSoapVersion =
+ (nSoapVersion ==
+ VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
+ m_pSZ->setSoapVersion ((SOAP_VERSION) nSoapVersion);
+ AXISTRACE1 ("CLIENT_WSDD_SERVICE_NOT_FOUND", CRITICAL);
+ throw AxisWsddException (CLIENT_WSDD_SERVICE_NOT_FOUND, service.c_str());
+ break; // do .. while(0)
+ }
+
+ m_CurrentProviderType = m_pService->getProvider ();
+ m_pSZ->setCurrentProviderType (m_CurrentProviderType);
+ m_pDZ->setCurrentProviderType (m_CurrentProviderType);
+ switch (m_CurrentProviderType)
+ {
+ case C_RPC_PROVIDER:
+ case CPP_RPC_PROVIDER:
+ m_pSZ->setStyle (RPC_ENCODED);
+ m_pDZ->setStyle (RPC_ENCODED);
+ break;
+ case C_DOC_PROVIDER:
+ case CPP_DOC_PROVIDER:
+ m_pSZ->setStyle (DOC_LITERAL);
+ m_pDZ->setStyle (DOC_LITERAL);
+ break;
+ case COM_PROVIDER:
+ // TODO: ??
+ break;
+ default:;
+ // TODO: ??
+ }
+
+ /* Check for stream version in the request and decide whether we support
+ * it or not. If we do not support send a soapfault with version
+ * mismatch.
+ */
+ nSoapVersion = m_pDZ->getVersion ();
+ if (m_pDZ->getStatus () != AXIS_SUCCESS)
+ {
+ AXISTRACE1 ("CLIENT_SOAP_MESSAGE_INCOMPLETE", CRITICAL);
+ throw AxisSoapException (CLIENT_SOAP_MESSAGE_INCOMPLETE);
+ break; // do .. while(0)
+ }
+
+ if (nSoapVersion == VERSION_LAST) // version not supported
+ {
+ m_pSZ->setSoapVersion (SOAP_VER_1_2);
+ AXISTRACE1 ("SOAP_VERSION_MISMATCH", CRITICAL);
+ throw AxisSoapException (SOAP_VERSION_MISMATCH);
+ break; // do .. while(0)
+ }
+
+ /* Set Soap version in the Serializer and the envelope */
+ if (AXIS_SUCCESS !=
+ m_pSZ->setSoapVersion ((SOAP_VERSION) nSoapVersion))
+ {
+ AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
+ throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ break; // do .. while(0)
+ }
+
+ /* Get the operation name from transport information Ex: from
+ * SOAPAction header
+ */
+ if (AXIS_SUCCESS != m_pDZ->getHeader ())
+ {
+ AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
+ throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ break; // do .. while(0)
+ }
+ if (AXIS_SUCCESS != m_pDZ->getBody ())
+ {
+ AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
+ throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ break; // do .. while(0)
+ }
+
+ AxisString sOperation = m_pDZ->getMethodNameToInvoke ();
+
+ if (sOperation.empty ())
+ {
+ AXISTRACE1 ("CLIENT_SOAP_NO_SOAP_METHOD", CRITICAL);
+ throw AxisSoapException (CLIENT_SOAP_NO_SOAP_METHOD);
+ break; // do .. while(0)
+ }
+ /* remove any quotes in the operation name */
+ if (sOperation.rfind ('\"') != string::npos)
+ {
+ sOperation = sOperation.substr (0, sOperation.length () - 1);
+ }
+
+ AxisString operationToInvoke = sOperation;
+
+ m_pMsgData->setOperationName (operationToInvoke.c_str ());
+
+ if (m_pService->isAllowedMethod (operationToInvoke.c_str ()))
+ {
+ /* load actual web service handler */
+ if (AXIS_SUCCESS !=
+ g_pHandlerPool->getWebService (&m_pWebService, sSessionId,
+ m_pService))
+ {
+ /* error : couldnot load web service */
+ AXISTRACE1 ("SERVER_ENGINE_COULD_NOT_LOAD_SRV", CRITICAL);
+ throw
+ AxisEngineException
+ (SERVER_ENGINE_COULD_NOT_LOAD_SRV);
+ break; // do .. while(0)
+ }
+
+ /* Check whether the provider type in the wsdd matchs the service's
+ * binding style
+ */
+ AXIS_BINDING_STYLE nBindingStyle = RPC_ENCODED;
+ if (0 != m_pWebService->_functions)
+ /* C service */
+ {
+ nBindingStyle = m_pWebService->_functions->
+ getBindingStyle (m_pWebService->_object);
+ }
+ else if (0 != m_pWebService->_object)
+ {
+ nBindingStyle = ((WrapperClassHandler *)
+ m_pWebService->_object)->
+ getBindingStyle ();
+ }
+
+ if (m_pSZ->getStyle () != nBindingStyle)
+ {
+ AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
+ throw AxisSoapException (CLIENT_SOAP_SOAP_CONTENT_ERROR);
+ break; // do .. while(0)
+ }
+ }
+ else
+ {
+ AXISTRACE1 ("CLIENT_WSDD_METHOD_NOT_ALLOWED", CRITICAL);
+ throw AxisWsddException (CLIENT_WSDD_METHOD_NOT_ALLOWED);
+ // Method is not an exposed allowed method
+ break; // do .. while(0)
+ }
+
+ // Get Global and Transport Handlers
+ if (AXIS_SUCCESS != (Status = initializeHandlers (sSessionId,
+ pStream->
+ getProtocol
+ ())))
+ {
+ AXISTRACE1 ("SERVER_ENGINE_COULD_NOT_LOAD_HDL", CRITICAL);
+ throw AxisEngineException (SERVER_ENGINE_COULD_NOT_LOAD_HDL);
+ break; // do .. while(0)
+ }
+ // Get Service specific Handlers from the pool if configured any
+ if (AXIS_SUCCESS !=
+ (Status =
+ g_pHandlerPool->getRequestFlowHandlerChain (&m_pSReqFChain,
+ sSessionId,
+ m_pService)))
+ {
+ AXISTRACE1 ("SERVER_ENGINE_COULD_NOT_LOAD_HDL", CRITICAL);
+ throw AxisEngineException (SERVER_ENGINE_COULD_NOT_LOAD_HDL);
+ break; // do .. while(0)
+ }
+
+ if (AXIS_SUCCESS != (Status =
+ g_pHandlerPool->
+ getResponseFlowHandlerChain (&m_pSResFChain,
+ sSessionId,
+ m_pService)))
+ {
+ AXISTRACE1 ("SERVER_ENGINE_COULD_NOT_LOAD_HDL", CRITICAL);
+ throw AxisEngineException (SERVER_ENGINE_COULD_NOT_LOAD_HDL);
+ break; // do .. while(0)
+ }
+
+ /*
+ * Invoke all handlers including the webservice
+ * in case of failure coresponding stream fault message will be set
+ */
+ Status = invoke (m_pMsgData);
+ }
+ while (0);
+
+ if (AXIS_SUCCESS != m_pDZ->flushInputStream ())
+ {
+ AXISTRACE1 ("CLIENT_SOAP_SOAP_CONTENT_ERROR", CRITICAL);
+ }
+ /*
+ * Get any header blocks unprocessed (left) in the Deserializer and add them
+ * to the Serializer
+ * They may be headers targetted to next soap processors
+ */
+ HeaderBlock *pHderBlk = NULL;
+ while (true)
+ {
+ /* Following function gets a header block from Deserializer irrespective
+ * of any thing
+ */
+ pHderBlk = m_pDZ->getHeaderBlock ();
+ /* Add it to the Serializer */
+ if (pHderBlk)
+ m_pSZ->addHeaderBlock (pHderBlk);
+ else
+ break;
+ }
+ m_pSZ->setOutputStream (pStream);
+
+ // Pool back the handlers and services
+ releaseHandlers (pStream);
+ //todo
+ /* An exception derived from exception which is not handled will be
+ * handled here. You can call a method in AxisModule which may unload
+ * the ServerAxisEngine from the webserver and report the error. You can
+ * also write this in a logfile specific to axis.
+ */
}
catch (AxisException & e)
{
- /*
- * An exception which is not handled will be handled here.
- */
- int iExceptionCode = e.getExceptionCode ();
- //char* pcTempStr = (char*) e.what();
- //AXISTRACE2("Exception:", pcTempStr, CRITICAL);
- if (AXISC_SERVICE_THROWN_EXCEPTION == iExceptionCode)
- {
- /*Writes the SoapMessage in which soap body contains only Fault */
- m_pSZ->setOutputStream (pStream);
- releaseHandlers (pStream);
- return AXIS_SUCCESS; //Service created fault is written to the stream.
- //so return success.
- }
- else /* An exception has occurred inside Axis C++ engine.(not in a
- * webservice or handler). Later we handle this according to the
- * exception code returned.
- */
- return e.getExceptionCode ();
+ /*
+ * An exception which is not handled will be handled here.
+ */
+ int iExceptionCode = e.getExceptionCode ();
+ //char* pcTempStr = (char*) e.what();
+ //AXISTRACE2("Exception:", pcTempStr, CRITICAL);
+ if (AXISC_SERVICE_THROWN_EXCEPTION == iExceptionCode)
+ {
+ /*Writes the SoapMessage in which soap body contains only Fault */
+ m_pSZ->setOutputStream (pStream);
+ releaseHandlers (pStream);
+ return AXIS_SUCCESS; //Service created fault is written to the stream.
+ //so return success.
+ }
+ else
+ {
+ /* An exception has occurred inside Axis C++ engine.(not in a
+ * webservice or handler). Later we handle this by coming back in here
+ * and serialising the fault out
+ */
+ throw e;
+ }
}
- catch (exception & e)
+ catch (exception& e)
{
- e = e;
- /* Handle standerd exceptions here
- */
+ e = e;
+ /* Handle standerd exceptions here */
+ AxisTrace::trace(e.what());
+ return SERVER_UNKNOWN_ERROR;
}
catch (...)
{
- return SERVER_UNKNOWN_ERROR;
+ return SERVER_UNKNOWN_ERROR;
}
return AXIS_SUCCESS;
}
@@ -487,12 +491,24 @@
int
ServerAxisEngine::setFaultOutputStream (int iFaultCode,
- SOAPTransport * pStream)
+ SOAPTransport * pStream)
{
AxisMessage objMessage;
string sMessage = objMessage.getMessage (iFaultCode);
SoapFault *pObjSoapFault = SoapFault::getSoapFault (iFaultCode);
pObjSoapFault->setFaultDetail (sMessage.c_str ());
+ m_pSZ->setSoapFault (pObjSoapFault);
+ m_pSZ->setOutputStream (pStream);
+ releaseHandlers (pStream);
+ return AXIS_SUCCESS;
+}
+
+int
+ServerAxisEngine::setFaultOutputStream (AxisException iFault,
+ SOAPTransport * pStream)
+{
+ SoapFault *pObjSoapFault = SoapFault::getSoapFault (iFault.getExceptionCode());
+ pObjSoapFault->setFaultDetail (iFault.what());
m_pSZ->setSoapFault (pObjSoapFault);
m_pSZ->setOutputStream (pStream);
releaseHandlers (pStream);
Modified: webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.h
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.h?rev=386679&r1=386678&r2=386679&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.h (original)
+++ webservices/axis/trunk/c/src/engine/server/ServerAxisEngine.h Fri Mar 17 10:04:58 2006
@@ -47,7 +47,8 @@
* called within the process_request method of Axis.cpp
*/
int setFaultOutputStream (int iFaultCode, SOAPTransport * pSoap);
-
+ int setFaultOutputStream (AxisException iFault, SOAPTransport * pSoap);
+
/** When finished with handlers and webservices release them
* back to the pool
*/
Modified: webservices/axis/trunk/c/src/server/simple_axis_server/SimpleAxisServer.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/server/simple_axis_server/SimpleAxisServer.cpp?rev=386679&r1=386678&r2=386679&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/server/simple_axis_server/SimpleAxisServer.cpp (original)
+++ webservices/axis/trunk/c/src/server/simple_axis_server/SimpleAxisServer.cpp Fri Mar 17 10:04:58 2006
@@ -33,6 +33,7 @@
#endif
#include "SimpleAxisTransport.h"
+#include <iostream>
#include <axis/AxisCPPConfigDefaults.hpp>
@@ -124,7 +125,7 @@
if (0 != process_request (pTransport))
{
- printf ("process_request FAILED\n");
+ cout << "process_request FAILED";
}
delete pTransport;
Modified: webservices/axis/trunk/c/src/wsdd/AxisWsddException.h
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdd/AxisWsddException.h?rev=386679&r1=386678&r2=386679&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdd/AxisWsddException.h (original)
+++ webservices/axis/trunk/c/src/wsdd/AxisWsddException.h Fri Mar 17 10:04:58 2006
@@ -38,6 +38,7 @@
private:
string getMessageForExceptionCode(const int iExceptionCode);
+ const char* what() const throw(){ return m_sMessage; };
string m_sMessageForExceptionCode;
};
Modified: webservices/axis/trunk/c/src/wsdd/WSDDDocument.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdd/WSDDDocument.cpp?rev=386679&r1=386678&r2=386679&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdd/WSDDDocument.cpp (original)
+++ webservices/axis/trunk/c/src/wsdd/WSDDDocument.cpp Fri Mar 17 10:04:58 2006
@@ -120,7 +120,11 @@
if (!pcWSDDFileName) return AXIS_FAIL;
WSDDFileInputStream stream(pcWSDDFileName);
XMLParser* pParser = XMLParserFactory::getParserObject();
- if (!pParser) return AXIS_FAIL;
+ if (!pParser)
+ {
+ AxisTrace::trace("Failed to getXMLParser to load WSDDDocument with");
+ return AXIS_FAIL;
+ }
pParser->setInputStream(&stream);
const AnyElement* pNode;