You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/08/17 07:10:11 UTC

cvs commit: ws-axis/c/src/engine/server ServerAxisEngine.cpp ServerAxisEngine.h

samisa      2005/08/16 22:10:11

  Modified:    c/src/engine/server ServerAxisEngine.cpp ServerAxisEngine.h
  Log:
  Fixed indentation
  
  Revision  Changes    Path
  1.35      +449 -444  ws-axis/c/src/engine/server/ServerAxisEngine.cpp
  
  Index: ServerAxisEngine.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/server/ServerAxisEngine.cpp,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- ServerAxisEngine.cpp	12 Aug 2005 08:09:46 -0000	1.34
  +++ ServerAxisEngine.cpp	17 Aug 2005 05:10:11 -0000	1.35
  @@ -25,12 +25,10 @@
   #include "../../common/AxisMessage.h"
   #include "../../common/AxisTrace.h"
   
  -extern AXIS_CPP_NAMESPACE_PREFIX HandlerPool* g_pHandlerPool;
  -extern AXIS_CPP_NAMESPACE_PREFIX WSDDDeployment* g_pWSDDDeployment;
  +extern AXIS_CPP_NAMESPACE_PREFIX HandlerPool *g_pHandlerPool;
  +extern AXIS_CPP_NAMESPACE_PREFIX WSDDDeployment *g_pWSDDDeployment;
   
  -AXIS_CPP_NAMESPACE_START
  -
  -ServerAxisEngine::ServerAxisEngine ()
  +AXIS_CPP_NAMESPACE_START ServerAxisEngine::ServerAxisEngine ()
   {
       m_pWebService = NULL;
   }
  @@ -40,352 +38,354 @@
   
   }
   
  -int ServerAxisEngine::process(SOAPTransport* pStream)
  +int
  +ServerAxisEngine::process (SOAPTransport * pStream)
   {
       int Status = 0;
       //const WSDDService* pService = NULL;
       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);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPCONTENTERROR));
  -            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);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPCONTENTERROR));
  -            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);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPACTIONEMTPY));
  -            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);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_WSDD_SERVICENOTFOUND));
  -            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. 
  +	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).
   	 */
  -        nSoapVersion = m_pDZ->getVersion ();
  -        if (m_pDZ->getStatus () != AXIS_SUCCESS)
  -        {
  -            AXISTRACE1("CLIENT_SOAP_MESSAGE_INCOMPLETE", CRITICAL);
  -            throw AxisSoapException(CLIENT_SOAP_MESSAGE_INCOMPLETE);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault(CLIENT_SOAP_MESSAGEINCOMPLETE));
  -            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);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (SOAP_VERSIONMISMATCH));
  -            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);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPCONTENTERROR));
  -            break; // do .. while(0)
  -        }
  +	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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPCONTENTERROR));
  +		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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPCONTENTERROR));
  +		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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPACTIONEMTPY));
  +		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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_WSDD_SERVICENOTFOUND));
  +		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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault(CLIENT_SOAP_MESSAGEINCOMPLETE));
  +		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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (SOAP_VERSIONMISMATCH));
  +		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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPCONTENTERROR));
  +		break;		// do .. while(0)
  +	    }
   
  -        /* Get the operation name from transport information Ex: from 
  -	 * SOAPAction header 
  +	    /* 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 = pStream->getTransportProperty(OPERATION_NAME);
  +	    AxisString sOperation = m_pDZ->getMethodNameToInvoke ();
  +
  +	    if (sOperation.empty ())
  +	    {
  +		AXISTRACE1 ("CLIENT_SOAP_NO_SOAP_METHOD", CRITICAL);
  +		throw AxisSoapException (CLIENT_SOAP_NO_SOAP_METHOD);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_NOSOAPMETHOD));
  +		break;		// do .. while(0)
  +	    }
  +	    /* remove any quotes in the operation name */
  +	    if (sOperation.rfind ('\"') != string::npos)
  +	    {
  +		sOperation = sOperation.substr (0, sOperation.length () - 1);
  +	    }
  +
  +	    const char *cpOperationName =
  +		m_pService->getOperationForRequest (sOperation.c_str ());
  +	    if (!cpOperationName)
  +	    {
  +		AXISTRACE1
  +		    ("CLIENT_WSDD_PARA_TYPE_MISMATCH - Missing or incorrect operationRequestMap entry in the wsdd file",
  +		     CRITICAL);
  +		throw AxisWsddException (CLIENT_WSDD_PARA_TYPE_MISMATCH);
  +		break;
  +	    }
  +
  +	    AxisString operationToInvoke = cpOperationName;
  +
  +	    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);
  +		    //m_pSZ->
  +		    //    setSoapFault(SoapFault::getSoapFault(SERVER_ENGINE_COULDNOTLOADSRV));
  +		    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);
  +		    //m_pSZ->
  +		    //    setSoapFault(SoapFault::getSoapFault(CLIENT_SOAP_SOAPCONTENTERROR));
  +		    break;	// do .. while(0)
  +		}
  +	    }
  +	    else
  +	    {
  +		AXISTRACE1 ("CLIENT_WSDD_METHOD_NOT_ALLOWED", CRITICAL);
  +		throw AxisWsddException (CLIENT_WSDD_METHOD_NOT_ALLOWED);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_WSDD_METHODNOTALLOWED));
  +		// 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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (SERVER_ENGINE_COULDNOTLOADHDL));
  +		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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (SERVER_ENGINE_COULDNOTLOADHDL));
  +		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);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault (SERVER_ENGINE_COULDNOTLOADHDL));
  +		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
   	 */
  -        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 = pStream->getTransportProperty(OPERATION_NAME);
  -        AxisString sOperation = m_pDZ->getMethodNameToInvoke();
  -
  -        if (sOperation.empty ())
  -        {
  -            AXISTRACE1("CLIENT_SOAP_NO_SOAP_METHOD", CRITICAL);
  -            throw AxisSoapException(CLIENT_SOAP_NO_SOAP_METHOD);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_NOSOAPMETHOD));
  -            break; // do .. while(0)
  -        }
  -        /* remove any quotes in the operation name */
  -        if (sOperation.rfind ('\"') != string::npos)
  -        {
  -            sOperation = sOperation.substr (0, sOperation.length () - 1);
  -        }
  -
  -        const char* cpOperationName = m_pService->getOperationForRequest(sOperation.c_str());
  -        if (!cpOperationName)
  -        {
  -            AXISTRACE1("CLIENT_WSDD_PARA_TYPE_MISMATCH - Missing or incorrect operationRequestMap entry in the wsdd file", CRITICAL);
  -            throw AxisWsddException(CLIENT_WSDD_PARA_TYPE_MISMATCH);
  -            break;
  -        }
  -
  -        AxisString operationToInvoke = cpOperationName;
  -
  -        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);
  -                //m_pSZ->
  -                //    setSoapFault(SoapFault::getSoapFault(SERVER_ENGINE_COULDNOTLOADSRV));
  -                break; // do .. while(0)
  -            }
  -
  -            /* Check whether the provider type in the wsdd matchs the service's 
  -	     * binding style 
  +	HeaderBlock *pHderBlk = NULL;
  +	while (true)
  +	{
  +	    /* Following function gets a header block from Deserializer irrespective
  +	     * of any thing 
   	     */
  -            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);
  -                //m_pSZ->
  -                //    setSoapFault(SoapFault::getSoapFault(CLIENT_SOAP_SOAPCONTENTERROR));
  -                break; // do .. while(0)
  -            }
  -        }
  -        else
  -        {
  -            AXISTRACE1("CLIENT_WSDD_METHOD_NOT_ALLOWED", CRITICAL);
  -            throw AxisWsddException(CLIENT_WSDD_METHOD_NOT_ALLOWED);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_WSDD_METHODNOTALLOWED));
  -            // 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);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (SERVER_ENGINE_COULDNOTLOADHDL));
  -            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);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (SERVER_ENGINE_COULDNOTLOADHDL));
  -            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);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (SERVER_ENGINE_COULDNOTLOADHDL));
  -            break; // do .. while(0)
  -        }
  -        /*
  -         * Let Deserializer parse the header section so that handlers can use 
  -	 * them. Each handler should remove the header block targetted to it
  -	 * and handlers may add header blocks to the DeSerializer and Serializer
  -	 * irrespective of whether it is request message path or response path.
  -	 * header may be added to the Deserializer ONLY IF there is a CAN BE
  -	 * a handler in this soap processor to handle it.
  +	    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 (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)                         
  -        }
  -*/
  -        /*
  -         * 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)
  +    catch (AxisException & e)
       {
  -        /* Following function gets a header block from Deserializer irrespective
  -         * of any thing 
  +	/*
  +	 * An exception which is not handled will be handled here.
   	 */
  -        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.
  -     */
  -     //m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPCONTENTERROR));
  -        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 occured inside Axis C++ engine.(not in a
  -             * webservice or handler). Later we handle this according to the
  -             * exception code returned.
  -             */
  -            return e.getExceptionCode();
  +	//m_pSZ->setSoapFault (SoapFault::getSoapFault (CLIENT_SOAP_SOAPCONTENTERROR));
  +	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 occured inside Axis C++ engine.(not in a
  +				 * webservice or handler). Later we handle this according to the
  +				 * exception code returned.
  +				 */
  +	    return e.getExceptionCode ();
       }
  -    catch(exception& e)
  +    catch (exception & e)
       {
  -    	e=e;
  -    /* Handle standerd exceptions here
  -     */
  +	e = e;
  +	/* Handle standerd exceptions here
  +	 */
       }
  -    catch(...)
  +    catch (...)
       {
  -        return SERVER_UNKNOWN_ERROR;
  +	return SERVER_UNKNOWN_ERROR;
       }
       return AXIS_SUCCESS;
   }
   
  -int ServerAxisEngine::invoke (MessageData* pMsg)
  +int
  +ServerAxisEngine::invoke (MessageData * pMsg)
   {
       enum AE_LEVEL
       { AE_START = 1, AE_TRH, AE_GLH, AE_SERH, AE_SERV };
  @@ -393,86 +393,87 @@
       int level = AE_START;
       do
       {
  -        // Invoke transport request handlers
  -        if (m_pTReqFChain)
  -        {
  -            if (AXIS_SUCCESS != (Status = m_pTReqFChain->invoke (pMsg)))
  -            {
  -                AXISTRACE1("SERVER_ENGINE_HANDLER_FAILED", CRITICAL);
  -                throw AxisEngineException(SERVER_ENGINE_HANDLER_FAILED);
  -                //m_pSZ->setSoapFault (SoapFault::getSoapFault(SERVER_ENGINE_HANDLERFAILED));
  -                break; // do .. while (0)
  -            }
  -
  -        }
  -        level++; // AE_TRH
  -        // Invoke global request handlers
  -        if (m_pGReqFChain)
  -        {
  -            if (AXIS_SUCCESS != (Status = m_pGReqFChain->invoke (pMsg)))
  -            {
  -                AXISTRACE1("SERVER_ENGINE_HANDLER_FAILED", CRITICAL);
  -                throw AxisEngineException(SERVER_ENGINE_HANDLER_FAILED);
  -                //m_pSZ->setSoapFault (SoapFault::getSoapFault(SERVER_ENGINE_HANDLERFAILED));
  -                break; // do .. while (0)
  -            }
  -        }
  -        level++; // AE_GLH
  -        // Invoke service specific request handlers
  -        if (m_pSReqFChain)
  -        {
  -            if (AXIS_SUCCESS != (Status = m_pSReqFChain->invoke (pMsg)))
  -            {
  -                AXISTRACE1("SERVER_ENGINE_HANDLER_FAILED", CRITICAL);
  -                throw AxisEngineException(SERVER_ENGINE_HANDLER_FAILED);
  -                //m_pSZ->setSoapFault (SoapFault::getSoapFault(SERVER_ENGINE_HANDLERFAILED));
  -                break; // do .. while (0)
  -            }
  -        }
  -        level++; // AE_SERH
  -        /*
  -         * Before processing the soap body check whether there is any header 
  +	// Invoke transport request handlers
  +	if (m_pTReqFChain)
  +	{
  +	    if (AXIS_SUCCESS != (Status = m_pTReqFChain->invoke (pMsg)))
  +	    {
  +		AXISTRACE1 ("SERVER_ENGINE_HANDLER_FAILED", CRITICAL);
  +		throw AxisEngineException (SERVER_ENGINE_HANDLER_FAILED);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault(SERVER_ENGINE_HANDLERFAILED));
  +		break;		// do .. while (0)
  +	    }
  +
  +	}
  +	level++;		// AE_TRH
  +	// Invoke global request handlers
  +	if (m_pGReqFChain)
  +	{
  +	    if (AXIS_SUCCESS != (Status = m_pGReqFChain->invoke (pMsg)))
  +	    {
  +		AXISTRACE1 ("SERVER_ENGINE_HANDLER_FAILED", CRITICAL);
  +		throw AxisEngineException (SERVER_ENGINE_HANDLER_FAILED);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault(SERVER_ENGINE_HANDLERFAILED));
  +		break;		// do .. while (0)
  +	    }
  +	}
  +	level++;		// AE_GLH
  +	// Invoke service specific request handlers
  +	if (m_pSReqFChain)
  +	{
  +	    if (AXIS_SUCCESS != (Status = m_pSReqFChain->invoke (pMsg)))
  +	    {
  +		AXISTRACE1 ("SERVER_ENGINE_HANDLER_FAILED", CRITICAL);
  +		throw AxisEngineException (SERVER_ENGINE_HANDLER_FAILED);
  +		//m_pSZ->setSoapFault (SoapFault::getSoapFault(SERVER_ENGINE_HANDLERFAILED));
  +		break;		// do .. while (0)
  +	    }
  +	}
  +	level++;		// AE_SERH
  +	/*
  +	 * Before processing the soap body check whether there is any header 
   	 * blocks with mustUnderstand attribute left unprocessed in the 
   	 * Deserializer. If so return a soap fault.
   	 */
  -        if (m_pDZ->isAnyMustUnderstandHeadersLeft ())
  -        {
  -            AXISTRACE1("SOAP_MUSTUNDERSTAND", CRITICAL);
  -            throw AxisSoapException(SOAP_MUST_UNDERSTAND);
  -            //m_pSZ->setSoapFault (SoapFault::getSoapFault (SOAP_MUSTUNDERSTAND));
  -            break; // do .. while (0)
  -        }
  -        // Call actual web service handler
  -        if (m_pWebService)
  -        {
  -            if (0 != m_pWebService->_functions)
  -            /* C web service */
  -            {
  -                // Disable C support
  -                //IMessageData_C cMC = { 0, 0 };
  -                //cMC._object = pMsg;
  -                //cMC._functions = &IMessageData::ms_VFtable;
  -                //Status = m_pWebService->_functions->invoke (m_pWebService->
  -                //    _object, &cMC);
  -            }
  -            else if (0 != m_pWebService->_object)
  -            {
  -                Status = ((WrapperClassHandler *) m_pWebService->_object)->
  -                    invoke (pMsg);
  -            }
  -            else
  -                Status = AXIS_FAIL;
  -            if (AXIS_SUCCESS != Status)
  -            {
  -                AXISTRACE1("SERVER_ENGINE_WEBSERVICEFAILED", CRITICAL);
  -                throw AxisEngineException(SERVER_ENGINE_WEBSERVICE_FAILED);
  -                //m_pSZ->
  -                //    setSoapFault(SoapFault::getSoapFault(SERVER_ENGINE_WEBSERVICEFAILED));
  -                break;
  -            }
  -        }
  -        level++; // AE_SERV
  -    } while (0);
  +	if (m_pDZ->isAnyMustUnderstandHeadersLeft ())
  +	{
  +	    AXISTRACE1 ("SOAP_MUSTUNDERSTAND", CRITICAL);
  +	    throw AxisSoapException (SOAP_MUST_UNDERSTAND);
  +	    //m_pSZ->setSoapFault (SoapFault::getSoapFault (SOAP_MUSTUNDERSTAND));
  +	    break;		// do .. while (0)
  +	}
  +	// Call actual web service handler
  +	if (m_pWebService)
  +	{
  +	    if (0 != m_pWebService->_functions)
  +		/* C web service */
  +	    {
  +		// Disable C support
  +		//IMessageData_C cMC = { 0, 0 };
  +		//cMC._object = pMsg;
  +		//cMC._functions = &IMessageData::ms_VFtable;
  +		//Status = m_pWebService->_functions->invoke (m_pWebService->
  +		//    _object, &cMC);
  +	    }
  +	    else if (0 != m_pWebService->_object)
  +	    {
  +		Status = ((WrapperClassHandler *) m_pWebService->_object)->
  +		    invoke (pMsg);
  +	    }
  +	    else
  +		Status = AXIS_FAIL;
  +	    if (AXIS_SUCCESS != Status)
  +	    {
  +		AXISTRACE1 ("SERVER_ENGINE_WEBSERVICEFAILED", CRITICAL);
  +		throw AxisEngineException (SERVER_ENGINE_WEBSERVICE_FAILED);
  +		//m_pSZ->
  +		//    setSoapFault(SoapFault::getSoapFault(SERVER_ENGINE_WEBSERVICEFAILED));
  +		break;
  +	    }
  +	}
  +	level++;		// AE_SERV
  +    }
  +    while (0);
   
       pMsg->setPastPivotState (true);
   
  @@ -485,67 +486,71 @@
        */
       switch (level)
       {
  -        case AE_SERV: // Everything Success.        
  -            Status = AXIS_SUCCESS;
  -            // no break;
  -        case AE_SERH: // Actual web service handler has failed
  -            // Invoke web service specific response handlers
  -            if (m_pSResFChain)
  -            {
  -                m_pSResFChain->invoke (pMsg);
  -            }
  -            // no break;
  -        case AE_GLH: // web service specific handlers have failed
  -            // invoke global response handlers
  -            if (m_pGResFChain)
  -            {
  -                m_pGResFChain->invoke (pMsg);
  -            }
  -            // no break;
  -        case AE_TRH: // Global handlers have failed
  -            if (m_pTResFChain)
  -            {
  -                m_pTResFChain->invoke (pMsg);
  -            }
  -          // no break;
  -        case AE_START:; // Transport handlers have failed
  +    case AE_SERV:		// Everything Success.        
  +	Status = AXIS_SUCCESS;
  +	// no break;
  +    case AE_SERH:		// Actual web service handler has failed
  +	// Invoke web service specific response handlers
  +	if (m_pSResFChain)
  +	{
  +	    m_pSResFChain->invoke (pMsg);
  +	}
  +	// no break;
  +    case AE_GLH:		// web service specific handlers have failed
  +	// invoke global response handlers
  +	if (m_pGResFChain)
  +	{
  +	    m_pGResFChain->invoke (pMsg);
  +	}
  +	// no break;
  +    case AE_TRH:		// Global handlers have failed
  +	if (m_pTResFChain)
  +	{
  +	    m_pTResFChain->invoke (pMsg);
  +	}
  +	// no break;
  +    case AE_START:;		// Transport handlers have failed
       };
       return Status;
   }
   
  -void ServerAxisEngine::onFault (MessageData* pMsg)
  +void
  +ServerAxisEngine::onFault (MessageData * pMsg)
   {
   }
   
  -int ServerAxisEngine::setFaultOutputStream(int iFaultCode, SOAPTransport* pStream)
  +int
  +ServerAxisEngine::setFaultOutputStream (int iFaultCode,
  +					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);
  +    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::releaseHandlers(SOAPTransport* pStream)
  +int
  +ServerAxisEngine::releaseHandlers (SOAPTransport * pStream)
   {
  -    string sSessionId = pStream->getSessionId();
  +    string sSessionId = pStream->getSessionId ();
       // Pool back the Service specific handlers
       if (m_pSReqFChain)
  -        g_pHandlerPool->poolHandlerChain (m_pSReqFChain, sSessionId);
  +	g_pHandlerPool->poolHandlerChain (m_pSReqFChain, sSessionId);
       if (m_pSResFChain)
  -        g_pHandlerPool->poolHandlerChain (m_pSResFChain, sSessionId);
  +	g_pHandlerPool->poolHandlerChain (m_pSResFChain, sSessionId);
       /* Pool back the Global and Transport handlers
        * UnInitializeHandlers(sSessionId, stream->trtype);
        * Pool back the webservice
        */
       if (m_pWebService)
  -        g_pHandlerPool->poolWebService (sSessionId, m_pWebService, m_pService);
  +	g_pHandlerPool->poolWebService (sSessionId, m_pWebService,
  +					m_pService);
   
       return AXIS_SUCCESS;
   }
   
   AXIS_CPP_NAMESPACE_END
  -
  
  
  
  1.11      +18 -21    ws-axis/c/src/engine/server/ServerAxisEngine.h
  
  Index: ServerAxisEngine.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/server/ServerAxisEngine.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ServerAxisEngine.h	6 Aug 2004 14:44:34 -0000	1.10
  +++ ServerAxisEngine.h	17 Aug 2005 05:10:11 -0000	1.11
  @@ -31,35 +31,32 @@
    *  @author Susantha Kumara (skumara@virtusa.com)
    */
   
  -AXIS_CPP_NAMESPACE_START
  -
  -class ServerAxisEngine:public AxisEngine
  +AXIS_CPP_NAMESPACE_START class ServerAxisEngine:public AxisEngine
   {
  -    private:
  -        BasicHandler* m_pWebService;
  -        const WSDDService* m_pService;
  -    public:
  -        ServerAxisEngine();
  -        virtual ~ ServerAxisEngine();
  -    public:
  -        int process(SOAPTransport* pSoap);
  -     
  -        /** When fault occures it need to be written to the stream. If fail is 
  +  private:
  +    BasicHandler * m_pWebService;
  +    const WSDDService *m_pService;
  +  public:
  +    ServerAxisEngine ();
  +    virtual ~ ServerAxisEngine ();
  +  public:
  +    int process (SOAPTransport * pSoap);
  +
  +	/** When fault occures it need to be written to the stream. If fail is 
            *  returned from the process method of ServerAxisEngine this method is
            *  called within the process_request method of Axis.cpp
            */
  -        int setFaultOutputStream(int iFaultCode, SOAPTransport* pSoap);
  +    int setFaultOutputStream (int iFaultCode, SOAPTransport * pSoap);
   
  -        /** When finished with handlers and webservices release them
  +	/** When finished with handlers and webservices release them
            *  back to the pool
            */
  -        int releaseHandlers(SOAPTransport* pSoap);
  +    int releaseHandlers (SOAPTransport * pSoap);
   
  -    protected:
  -        virtual int invoke(MessageData* pMsg);
  -        virtual void onFault(MessageData* pMsg);
  +  protected:
  +    virtual int invoke (MessageData * pMsg);
  +    virtual void onFault (MessageData * pMsg);
   };
   
   AXIS_CPP_NAMESPACE_END
  -
  -#endif 
  +#endif