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 na...@apache.org on 2006/04/20 02:21:35 UTC
svn commit: r395449 - in /webservices/axis/trunk/c/src/engine/client:
Call.cpp ClientAxisEngine.cpp ClientAxisEngine.h Stub.cpp
Author: nadiramra
Date: Wed Apr 19 17:21:32 2006
New Revision: 395449
URL: http://svn.apache.org/viewcvs?rev=395449&view=rev
Log:
beautify files...
Modified:
webservices/axis/trunk/c/src/engine/client/Call.cpp
webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp
webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.h
webservices/axis/trunk/c/src/engine/client/Stub.cpp
Modified: webservices/axis/trunk/c/src/engine/client/Call.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/engine/client/Call.cpp?rev=395449&r1=395448&r2=395449&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/client/Call.cpp (original)
+++ webservices/axis/trunk/c/src/engine/client/Call.cpp Wed Apr 19 17:21:32 2006
@@ -54,35 +54,31 @@
m_nStatus = AXIS_SUCCESS;
m_pchSessionID = NULL;
- m_pContentIdSet = new ContentIdSet();
+ m_pContentIdSet = new ContentIdSet();
// Setup Transport
try
{
// Get a transport object from factory
if( !m_pTransport)
- {
+ {
m_pTransport = SOAPTransportFactory::getTransportObject(m_nTransportType);
- if( !m_pTransport)
- {
- m_nStatus = AXIS_FAIL;
- }
- }
+ if( !m_pTransport)
+ m_nStatus = AXIS_FAIL;
+ }
// Engine initialization
m_pAxisEngine = new ClientAxisEngine ();
if (!m_pAxisEngine)
- {
- m_nStatus = AXIS_FAIL;
- }
- m_nStatus = m_pAxisEngine->initialize ();
-
+ m_nStatus = AXIS_FAIL;
+ else
+ m_nStatus = m_pAxisEngine->initialize ();
}
catch( AxisException& e)
{
cleanup();
- throw AxisGenException( e.getExceptionCode(), e.what());
+ throw AxisGenException( e.getExceptionCode(), e.what());
}
catch(...)
{
@@ -93,19 +89,21 @@
Call::~Call ()
{
- m_pAxisEngine->unInitialize ();
+ if (m_pAxisEngine)
+ m_pAxisEngine->unInitialize ();
cleanup();
uninitialize_module();
- list<ISoapAttachment*>::iterator it = m_attachments.begin();
- while (it != m_attachments.end())
- {
- delete *it;
- it++;
- }
- m_attachments.clear();
+ list<ISoapAttachment*>::iterator it = m_attachments.begin();
+ while (it != m_attachments.end())
+ {
+ delete *it;
+ it++;
+ }
+
+ m_attachments.clear();
}
void Call::cleanup()
@@ -113,15 +111,19 @@
if (m_pContentIdSet)
delete m_pContentIdSet;
m_pContentIdSet = NULL;
+
if (m_pTransport)
SOAPTransportFactory::destroyTransportObject(m_pTransport);
m_pTransport = NULL;
+
if (m_pAxisEngine)
delete m_pAxisEngine;
m_pAxisEngine = NULL;
+
if (m_pcEndPointUri)
delete [] m_pcEndPointUri;
- m_pcEndPointUri = NULL;
+
+ m_pcEndPointUri = NULL;
}
int Call::setEndpointURI( const char * pchEndpointURI)
@@ -131,181 +133,171 @@
return AXIS_SUCCESS;
}
-void Call::setOperation (const char* pchOperation, const char* pchNamespace)
+void Call::setOperation (const char* pchOperation,
+ const char* pchNamespace)
{
m_pIWSSZ->createSoapMethod (pchOperation, pchNamespace);
m_pAxisEngine->getMessageData()->setOperationName(pchOperation);
}
-void Call::addParameter( void * pValue, const char * pchName, XSDTYPE nType)
+void Call::addParameter( void * pValue,
+ const char * pchName,
+ XSDTYPE nType)
{
- m_nStatus = m_pIWSSZ->addOutputParam( pchName, pValue, nType);
+ m_nStatus = m_pIWSSZ->addOutputParam( pchName, pValue, nType);
}
/*
* Method used to add arrays of basic types as parameters
*/
-void Call::addBasicArrayParameter( Axis_Array * pArray,
- XSDTYPE nType,
- const AxisChar * pName)
-{
- m_nStatus = m_pIWSSZ->addOutputBasicArrayParam( pArray, nType, pName);
-}
-
-void Call::addCmplxArrayParameter( Axis_Array * pArray,
- void * pSZFunct,
- void * pDelFunct,
- void * pSizeFunct,
- const AxisChar * pName,
- const AxisChar * pNamespace)
-{
- m_nStatus = m_pIWSSZ->addOutputCmplxArrayParam( pArray,
- pSZFunct,
- pDelFunct,
- pSizeFunct,
- pName,
- pNamespace);
-}
-
-void Call::addCmplxParameter( void * pObject,
- void * pSZFunct,
- void * pDelFunct,
- const AxisChar * pName,
- const AxisChar * pNamespace)
-{
- m_nStatus = m_pIWSSZ->addOutputCmplxParam( pObject,
- pSZFunct,
- pDelFunct,
- pName,
- pNamespace);
+void Call::addBasicArrayParameter( Axis_Array * pArray,
+ XSDTYPE nType,
+ const AxisChar * pName)
+{
+ m_nStatus = m_pIWSSZ->addOutputBasicArrayParam( pArray, nType, pName);
+}
+
+void Call::addCmplxArrayParameter( Axis_Array * pArray,
+ void * pSZFunct,
+ void * pDelFunct,
+ void * pSizeFunct,
+ const AxisChar * pName,
+ const AxisChar * pNamespace)
+{
+ m_nStatus = m_pIWSSZ->addOutputCmplxArrayParam( pArray,
+ pSZFunct, pDelFunct, pSizeFunct,
+ pName, pNamespace);
+}
+
+void Call::addCmplxParameter( void * pObject,
+ void * pSZFunct,
+ void * pDelFunct,
+ const AxisChar * pName,
+ const AxisChar * pNamespace)
+{
+ m_nStatus = m_pIWSSZ->addOutputCmplxParam( pObject,
+ pSZFunct, pDelFunct,
+ pName, pNamespace);
}
int Call::invoke()
{
- m_nStatus = m_pAxisEngine->process( m_pTransport);
+ m_nStatus = m_pAxisEngine->process( m_pTransport);
- return m_nStatus;
+ return m_nStatus;
}
class HandlerProperty
{
public:
- HandlerProperty(AxisChar *n, void *v, int l) {name=n; value=v; len=l;}
+ HandlerProperty(AxisChar *n, void *v, int l) {name=n; value=v; len=l;}
- // The storage pointed at by name and value is not owned by HandlerProperty
- AxisChar *name;
- void *value;
- int len;
+ // The storage pointed at by name and value is not owned by HandlerProperty
+ AxisChar *name;
+ void *value;
+ int len;
};
int Call::initialize( PROVIDERTYPE nStyle)
-/* Does this mean that the stub that uses this Call object as well as all
- * client side handlers have the same PROVIDERTYPE ?
- */
{
m_bCallInitialized = true;
- /* Initialize re-usable objects of this instance (objects may have been
- * populated by the previous call.)
- */
- try
- {
- m_nStatus = AXIS_SUCCESS;
-
-// Move the handler data previously added using the setHandlerProperty method into the message data object (that is visible to the handlers).
- MessageData * msgData = m_pAxisEngine->getMessageData();
-
- if( msgData)
- {
- list<void*>::iterator it = m_handlerProperties.begin();
-
-// Copy the list of handler objects.
- while( it != m_handlerProperties.end())
- {
- HandlerProperty *pHp = (HandlerProperty *) (*it);
-
- msgData->setProperty( pHp->name, pHp->value, pHp->len);
-
- delete pHp;
-
- it++;
- }
-
-// Delete the original list.
- m_handlerProperties.clear();
-
-// Add the SOAP serialiser/deserialiser entry points to the message data object.
- msgData->getSoapSerializer( (IWrapperSoapSerializer **) (&m_pIWSSZ));
- msgData->getSoapDeSerializer( (IWrapperSoapDeSerializer **) (&m_pIWSDZ));
-
- if( m_pIWSSZ && m_pIWSDZ)
- {
- m_pIWSSZ->setCurrentProviderType( nStyle);
- m_pIWSDZ->setCurrentProviderType( nStyle);
-
- m_pIWSSZ->reset();
- m_pIWSDZ->init();
-
- switch (nStyle)
- {
- case C_RPC_PROVIDER:
- case CPP_RPC_PROVIDER:
- m_pIWSSZ->setStyle( RPC_ENCODED);
- m_pIWSDZ->setStyle( RPC_ENCODED);
- break;
-
- case C_DOC_PROVIDER:
- case CPP_DOC_PROVIDER:
- m_pIWSSZ->setStyle( DOC_LITERAL);
- m_pIWSDZ->setStyle( DOC_LITERAL);
- break;
-
- case COM_PROVIDER:
- // TODO: ??
- break;
-
- default:;
- //TODO: ??
- }
-
- if( m_pchSessionID)
- {
- msgData->setProperty( "sessionid", m_pchSessionID);
- }
-
- m_pIWSSZ->setContentIdSet( m_pContentIdSet);
-
- list<ISoapAttachment*>::iterator itAtt = m_attachments.begin();
-
- while( itAtt != m_attachments.end())
- {
- m_pIWSSZ->addAttachment( (*itAtt)->getHeader( AXIS_CONTENT_ID), *itAtt);
-
- itAtt++;
- }
-
- m_attachments.clear();
-
- return AXIS_SUCCESS;
- }
- }
-
- m_nStatus = AXIS_FAIL;
-
- return AXIS_FAIL;
- }
-
- catch( AxisException& e)
- {
- e = e;
- m_nStatus = AXIS_FAIL;
- throw;
- }
- catch( ...)
- {
- m_nStatus = AXIS_FAIL;
- throw;
- }
+ // Initialize re-usable objects of this instance (objects may have been
+ // populated by the previous call.)
+ try
+ {
+ m_nStatus = AXIS_SUCCESS;
+
+ // Move the handler data previously added using the setHandlerProperty
+ // method into the message data object (that is visible to the handlers).
+ MessageData * msgData = m_pAxisEngine->getMessageData();
+
+ if( msgData)
+ {
+ list<void*>::iterator it = m_handlerProperties.begin();
+
+ // Copy the list of handler objects.
+ while( it != m_handlerProperties.end())
+ {
+ HandlerProperty *pHp = (HandlerProperty *) (*it);
+
+ msgData->setProperty( pHp->name, pHp->value, pHp->len);
+
+ delete pHp;
+
+ it++;
+ }
+
+ // Delete the original list.
+ m_handlerProperties.clear();
+
+ // Add the SOAP serialiser/deserialiser entry points to the message data object.
+ msgData->getSoapSerializer( (IWrapperSoapSerializer **) (&m_pIWSSZ));
+ msgData->getSoapDeSerializer( (IWrapperSoapDeSerializer **) (&m_pIWSDZ));
+
+ if( m_pIWSSZ && m_pIWSDZ)
+ {
+ m_pIWSSZ->setCurrentProviderType( nStyle);
+ m_pIWSDZ->setCurrentProviderType( nStyle);
+
+ m_pIWSSZ->reset();
+ m_pIWSDZ->init();
+
+ switch (nStyle)
+ {
+ case C_RPC_PROVIDER:
+ case CPP_RPC_PROVIDER:
+ m_pIWSSZ->setStyle( RPC_ENCODED);
+ m_pIWSDZ->setStyle( RPC_ENCODED);
+ break;
+
+ case C_DOC_PROVIDER:
+ case CPP_DOC_PROVIDER:
+ m_pIWSSZ->setStyle( DOC_LITERAL);
+ m_pIWSDZ->setStyle( DOC_LITERAL);
+ break;
+
+ case COM_PROVIDER:
+ // TODO: ??
+ break;
+
+ default:;
+ //TODO: ??
+ }
+
+ if( m_pchSessionID)
+ msgData->setProperty( "sessionid", m_pchSessionID);
+
+ m_pIWSSZ->setContentIdSet( m_pContentIdSet);
+
+ list<ISoapAttachment*>::iterator itAtt = m_attachments.begin();
+
+ while( itAtt != m_attachments.end())
+ {
+ m_pIWSSZ->addAttachment( (*itAtt)->getHeader( AXIS_CONTENT_ID), *itAtt);
+ itAtt++;
+ }
+
+ m_attachments.clear();
+ return AXIS_SUCCESS;
+ }
+ }
+
+ m_nStatus = AXIS_FAIL;
+ return AXIS_FAIL;
+ }
+
+ catch( AxisException& e)
+ {
+ e = e;
+ m_nStatus = AXIS_FAIL;
+ throw;
+ }
+ catch( ...)
+ {
+ m_nStatus = AXIS_FAIL;
+ throw;
+ }
}
int Call::unInitialize()
@@ -314,131 +306,130 @@
if( m_pAxisEngine)
{
-// Initialization, serialization, invocation or check message success
- if( m_nStatus == AXIS_SUCCESS && m_pIWSDZ != NULL)
- {
-// Test if deserialization failed
- m_nStatus = m_pIWSDZ->getStatus();
- }
-
- MessageData * msgData = m_pAxisEngine->getMessageData();
- AxisChar * pachTemp = (AxisChar *) msgData->getProperty( "sessionid");
- int len = (int) strlen( pachTemp);
+ // Initialization, serialization, invocation or check message success
+ if( m_nStatus == AXIS_SUCCESS && m_pIWSDZ != NULL)
+ {
+ // Test if deserialization failed
+ m_nStatus = m_pIWSDZ->getStatus();
+ }
+
+ MessageData * msgData = m_pAxisEngine->getMessageData();
+ AxisChar * pachTemp = (AxisChar *) msgData->getProperty( "sessionid");
+ int len = (int) strlen( pachTemp);
-// Check if there is a session key
- if( len > 0)
+ // Check if there is a session key
+ if( len > 0)
{
-// De-allocate before re-allocation
- if( m_pchSessionID)
+ // De-allocate before re-allocation
+ if( m_pchSessionID)
{
delete [] m_pchSessionID;
-
m_pchSessionID = NULL;
}
-// Should have space for terminating char
- m_pchSessionID = new char[len + 1];
-
- strcpy( m_pchSessionID, pachTemp);
+ // Should have space for terminating char
+ m_pchSessionID = new char[len + 1];
+ strcpy( m_pchSessionID, pachTemp);
}
else
{
-// There is no session key
- if( m_pchSessionID)
- {
+ // There is no session key
+ if( m_pchSessionID)
delete [] m_pchSessionID;
- }
-
m_pchSessionID = NULL;
}
}
closeConnection();
-
return AXIS_SUCCESS;
}
int Call::setProtocol (AXIS_PROTOCOL_TYPE protocol)
{
- int success = AXIS_FAIL;
+ int success = AXIS_FAIL;
+
if (m_pTransport)
{
- if( m_pTransport->setProtocol(protocol)==AXIS_SUCCESS)
- {
- m_nTransportType=protocol;
- success = AXIS_SUCCESS;
- }
+ if( m_pTransport->setProtocol(protocol)==AXIS_SUCCESS)
+ {
+ m_nTransportType=protocol;
+ success = AXIS_SUCCESS;
+ }
}
else
{
- m_nTransportType=protocol;
- success = AXIS_SUCCESS;
+ m_nTransportType=protocol;
+ success = AXIS_SUCCESS;
}
- return success;
+
+ return success;
}
AXIS_PROTOCOL_TYPE Call::getProtocol ()
{
- if(m_pTransport)
- {
- return m_pTransport->getProtocol();
- }
- else
- {
- return m_nTransportType;
- }
+ if(m_pTransport)
+ return m_pTransport->getProtocol();
+ else
+ return m_nTransportType;
}
int Call::setTransportProperty( AXIS_TRANSPORT_INFORMATION_TYPE type, const char* value)
{
- int iSuccess = AXIS_SUCCESS;
+ int iSuccess = AXIS_SUCCESS;
- // Samisa - if SOAPAction is being set add extra "" to value
+ // if SOAPAction is being set add extra "" to value
if (type == SOAPACTION_HEADER)
{
char* tempvalue = new char[strlen(value) + 3];
- sprintf( tempvalue, "\"%s\"", value);
- m_pTransport->setTransportProperty(type, tempvalue);
- if( tempvalue != NULL)
- {
- delete [] tempvalue;
- tempvalue = NULL;
- }
+
+ if( tempvalue != NULL)
+ {
+ sprintf( tempvalue, "\"%s\"", value);
+ m_pTransport->setTransportProperty(type, tempvalue);
+ delete [] tempvalue;
+ }
+ else
+ {
+ // need to throw some sort of exception relating to memory allocation failure?
+ return AXIS_FAIL;
+ }
}
else
- {
- try
- {
- iSuccess = m_pTransport->setTransportProperty( type, value);
- }
- catch( AxisException& e)
- {
- throw AxisGenException(e.getExceptionCode(), e.what());
- }
- }
-
- if( iSuccess < 0)
- {
- throw AxisGenException( -iSuccess, m_pTransport->getLastChannelError());
- }
+ {
+ try
+ {
+ iSuccess = m_pTransport->setTransportProperty( type, value);
+ }
+ catch( AxisException& e)
+ {
+ throw AxisGenException(e.getExceptionCode(), e.what());
+ }
+ }
+
+ if( iSuccess < 0)
+ {
+ throw AxisGenException( -iSuccess, m_pTransport->getLastChannelError());
+ }
return iSuccess;
}
const char* Call::getTransportProperty(const char *key, bool response)
{
- if (m_pTransport) return m_pTransport->getTransportProperty(key,response);
- else return NULL;
+ if (m_pTransport)
+ return m_pTransport->getTransportProperty(key,response);
+ else
+ return NULL;
}
int Call::setHandlerProperty(AxisChar* name, void* value, int len)
{
- // Unfortunately we have to cache the handler properties here
- // in the Call object since the m_pMsgData is not set up
- // until Call::initialize which doesn't happen until the actual
- // web service is invoked.
- m_handlerProperties.push_back(new HandlerProperty(name,value,len));
- return AXIS_SUCCESS;
+ // Unfortunately we have to cache the handler properties here
+ // in the Call object since the m_pMsgData is not set up
+ // until Call::initialize which doesn't happen until the actual
+ // web service is invoked.
+ m_handlerProperties.push_back(new HandlerProperty(name,value,len));
+ return AXIS_SUCCESS;
}
/*
@@ -446,9 +437,8 @@
*/
void Call::closeConnection()
{
- if (m_pTransport) {
+ if (m_pTransport)
m_pTransport->closeConnection();
- }
}
void Call::setSOAPVersion (SOAP_VERSION version)
@@ -456,277 +446,286 @@
m_pIWSSZ->setSoapVersion (version);
}
-Axis_Array* Call::getBasicArray (XSDTYPE nType, const AxisChar* pName,
- const AxisChar* pNamespace)
+Axis_Array* Call::getBasicArray (XSDTYPE nType,
+ const AxisChar* pName,
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getBasicArray (nType, pName, pNamespace);
}
-Axis_Array* Call::getCmplxArray (Axis_Array * pArray, void* pDZFunct, void* pCreFunct,
- void* pDelFunct, void* pSizeFunct, const AxisChar* pName,
- const AxisChar* pNamespace)
-{
- return m_pIWSDZ->getCmplxArray (pArray, pDZFunct, pCreFunct, pDelFunct, pSizeFunct,
- pName, pNamespace);
+Axis_Array* Call::getCmplxArray (Axis_Array * pArray,
+ void* pDZFunct,
+ void* pCreFunct,
+ void* pDelFunct,
+ void* pSizeFunct,
+ const AxisChar* pName,
+ const AxisChar* pNamespace)
+{
+ return m_pIWSDZ->getCmplxArray (pArray,
+ pDZFunct, pCreFunct, pDelFunct, pSizeFunct,
+ pName, pNamespace);
}
-xsd__int * Call::getElementAsInt (const AxisChar* pName, const AxisChar* pNamespace)
+xsd__int * Call::getElementAsInt (const AxisChar* pName,
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsInt (pName, pNamespace);
}
xsd__boolean * Call::getElementAsBoolean (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsBoolean (pName, pNamespace);
}
xsd__unsignedInt * Call::getElementAsUnsignedInt (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsUnsignedInt (pName, pNamespace);
}
xsd__short * Call::getElementAsShort (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsShort (pName, pNamespace);
}
xsd__unsignedShort * Call::getElementAsUnsignedShort (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsUnsignedShort (pName, pNamespace);
}
-xsd__byte * Call::getElementAsByte (const AxisChar* pName, const AxisChar* pNamespace)
+xsd__byte * Call::getElementAsByte (const AxisChar* pName,
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsByte (pName, pNamespace);
}
xsd__unsignedByte * Call::getElementAsUnsignedByte (const AxisChar* pName,
- const AxisChar * pNamespace)
+ const AxisChar * pNamespace)
{
return m_pIWSDZ->getElementAsUnsignedByte (pName, pNamespace);
}
-xsd__long * Call::getElementAsLong (const AxisChar* pName, const AxisChar* pNamespace)
+xsd__long * Call::getElementAsLong (const AxisChar* pName,
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsLong (pName, pNamespace);
}
xsd__integer * Call::getElementAsInteger (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsInteger (pName, pNamespace);
}
xsd__unsignedLong * Call::getElementAsUnsignedLong (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsUnsignedLong (pName, pNamespace);
}
xsd__float * Call::getElementAsFloat (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsFloat (pName, pNamespace);
}
xsd__double * Call::getElementAsDouble (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsDouble (pName, pNamespace);
}
xsd__decimal * Call::getElementAsDecimal (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsDecimal (pName, pNamespace);
}
xsd__string Call::getElementAsString (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsString (pName, pNamespace);
}
xsd__anyURI Call::getElementAsAnyURI (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsAnyURI (pName, pNamespace);
}
xsd__QName Call::getElementAsQName (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsQName (pName, pNamespace);
}
xsd__hexBinary * Call::getElementAsHexBinary (const AxisChar* pName,
- const AxisChar * pNamespace)
+ const AxisChar * pNamespace)
{
return m_pIWSDZ->getElementAsHexBinary (pName, pNamespace);
}
xsd__base64Binary * Call::getElementAsBase64Binary (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsBase64Binary (pName, pNamespace);
}
xsd__dateTime * Call::getElementAsDateTime (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsDateTime (pName, pNamespace);
}
xsd__date * Call::getElementAsDate (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsDate (pName, pNamespace);
}
xsd__time * Call::getElementAsTime (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsTime (pName, pNamespace);
}
xsd__duration * Call::getElementAsDuration (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsDuration (pName, pNamespace);
}
xsd__gYearMonth * Call::getElementAsGYearMonth (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsGYearMonth (pName, pNamespace);
}
xsd__gYear * Call::getElementAsGYear (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsGYear (pName, pNamespace);
}
xsd__gMonthDay * Call::getElementAsGMonthDay (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsGMonthDay (pName, pNamespace);
}
xsd__gDay * Call::getElementAsGDay (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsGDay (pName, pNamespace);
}
xsd__gMonth * Call::getElementAsGMonth (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsGMonth (pName, pNamespace);
}
xsd__nonPositiveInteger * Call::getElementAsNonPositiveInteger (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsNonPositiveInteger (pName, pNamespace);
}
xsd__negativeInteger * Call::getElementAsNegativeInteger (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsNegativeInteger (pName, pNamespace);
}
xsd__nonNegativeInteger * Call::getElementAsNonNegativeInteger (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsNonNegativeInteger (pName, pNamespace);
}
xsd__positiveInteger * Call::getElementAsPositiveInteger (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsPositiveInteger (pName, pNamespace);
}
xsd__normalizedString Call::getElementAsNormalizedString (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsNormalizedString (pName, pNamespace);
}
xsd__token Call::getElementAsToken (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsToken (pName, pNamespace);
}
xsd__language Call::getElementAsLanguage (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsLanguage (pName, pNamespace);
}
xsd__Name Call::getElementAsName (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsName (pName, pNamespace);
}
xsd__NCName Call::getElementAsNCName (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsNCName (pName, pNamespace);
}
xsd__ID Call::getElementAsID (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsID (pName, pNamespace);
}
xsd__IDREF Call::getElementAsIDREF (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsIDREF (pName, pNamespace);
}
xsd__IDREFS Call::getElementAsIDREFS (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsIDREFS (pName, pNamespace);
}
xsd__ENTITY Call::getElementAsENTITY (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsENTITY (pName, pNamespace);
}
xsd__ENTITIES Call::getElementAsENTITIES (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsENTITIES (pName, pNamespace);
}
xsd__NMTOKEN Call::getElementAsNMTOKEN (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsNMTOKEN (pName, pNamespace);
}
xsd__NMTOKENS Call::getElementAsNMTOKENS (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsNMTOKENS (pName, pNamespace);
}
xsd__NOTATION Call::getElementAsNOTATION (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getElementAsNOTATION (pName, pNamespace);
}
@@ -737,169 +736,169 @@
}
xsd__boolean * Call::getAttributeAsBoolean (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsBoolean (pName, pNamespace);
}
xsd__unsignedInt * Call::getAttributeAsUnsignedInt (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsUnsignedInt (pName, pNamespace);
}
xsd__short * Call::getAttributeAsShort (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsShort (pName, pNamespace);
}
xsd__unsignedShort * Call::getAttributeAsUnsignedShort (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsUnsignedShort (pName, pNamespace);
}
xsd__byte * Call::getAttributeAsByte (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsByte (pName, pNamespace);
}
xsd__unsignedByte * Call::getAttributeAsUnsignedByte (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsUnsignedByte (pName, pNamespace);
}
xsd__long * Call::getAttributeAsLong (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsLong (pName, pNamespace);
}
xsd__integer * Call::getAttributeAsInteger (const AxisChar* pName,
- const AxisChar * pNamespace)
+ const AxisChar * pNamespace)
{
return m_pIWSDZ->getAttributeAsInteger (pName, pNamespace);
}
xsd__unsignedLong * Call::getAttributeAsUnsignedLong (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsUnsignedLong (pName, pNamespace);
}
xsd__float * Call::getAttributeAsFloat (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsFloat (pName, pNamespace);
}
xsd__double * Call::getAttributeAsDouble (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsDouble (pName, pNamespace);
}
xsd__decimal * Call::getAttributeAsDecimal (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsDecimal (pName, pNamespace);
}
xsd__string Call::getAttributeAsString (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsString (pName, pNamespace);
}
xsd__anyURI Call::getAttributeAsAnyURI (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsAnyURI (pName, pNamespace);
}
xsd__QName Call::getAttributeAsQName (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsQName (pName, pNamespace);
}
xsd__hexBinary * Call::getAttributeAsHexBinary (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsHexBinary (pName, pNamespace);
}
xsd__base64Binary * Call::getAttributeAsBase64Binary (const AxisChar* pName,
- const AxisChar * pNamespace)
+ const AxisChar * pNamespace)
{
return m_pIWSDZ->getAttributeAsBase64Binary (pName, pNamespace);
}
xsd__dateTime * Call::getAttributeAsDateTime (const AxisChar* pName,
- const AxisChar * pNamespace)
+ const AxisChar * pNamespace)
{
return m_pIWSDZ->getAttributeAsDateTime (pName, pNamespace);
}
xsd__date * Call::getAttributeAsDate (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsDate (pName, pNamespace);
}
xsd__time * Call::getAttributeAsTime (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsTime (pName, pNamespace);
}
xsd__duration * Call::getAttributeAsDuration (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsDuration (pName, pNamespace);
}
xsd__gYearMonth * Call::getAttributeAsGYearMonth (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsGYearMonth (pName, pNamespace);
}
xsd__gYear * Call::getAttributeAsGYear (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsGYear (pName, pNamespace);
}
xsd__gMonthDay * Call::getAttributeAsGMonthDay (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsGMonthDay (pName, pNamespace);
}
xsd__gDay * Call::getAttributeAsGDay (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsGDay (pName, pNamespace);
}
xsd__gMonth * Call::getAttributeAsGMonth (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsGMonth (pName, pNamespace);
}
xsd__NOTATION Call::getAttributeAsNOTATION (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsNOTATION (pName, pNamespace);
}
xsd__normalizedString Call::getAttributeAsNormalizedString (const AxisChar* pName,
- const AxisChar* pNamespace)
+ const AxisChar* pNamespace)
{
return m_pIWSDZ->getAttributeAsNormalizedString (pName, pNamespace);
}
@@ -996,14 +995,14 @@
int Call::checkMessage( const AxisChar * pName, const AxisChar * pNamespace)
{
- m_nStatus = m_pIWSDZ->checkMessageBody( pName, pNamespace);
+ m_nStatus = m_pIWSDZ->checkMessageBody( pName, pNamespace);
- return m_nStatus;
+ return m_nStatus;
}
void* Call::checkFault (const AxisChar* pName, const AxisChar* pNamespace)
{
- return m_pIWSDZ->checkForFault (pName, pNamespace);
+ return m_pIWSDZ->checkForFault (pName, pNamespace);
}
void* Call::getCmplxObject (void* pDZFunct, void* pCreFunct, void* pDelFunct,
@@ -1021,19 +1020,19 @@
IHeaderBlock * Call::createHeaderBlock( AxisChar * pachLocalName,
AxisChar * pachUri)
{
- return new HeaderBlock( pachLocalName, pachUri);
+ return new HeaderBlock( pachLocalName, pachUri);
}
IHeaderBlock * Call::createHeaderBlock( AxisChar * pachLocalName,
- AxisChar * pachUri,
- AxisChar * pachPrefix)
+ AxisChar * pachUri,
+ AxisChar * pachPrefix)
{
- return new HeaderBlock( pachLocalName, pachUri, pachPrefix);
+ return new HeaderBlock( pachLocalName, pachUri, pachPrefix);
}
int Call::getStatus()
{
- return m_nStatus;
+ return m_nStatus;
}
void Call::setProxy(const char* pcProxyHost, unsigned int uiProxyPort)
@@ -1045,12 +1044,12 @@
AnyType * Call::getAnyObject()
{
- return m_pIWSDZ->getAnyObject();
+ return m_pIWSDZ->getAnyObject();
}
int Call::addAnyObject( AnyType * pAnyObject)
{
- return m_pIWSSZ->addOutputAnyObject( pAnyObject);
+ return m_pIWSSZ->addOutputAnyObject( pAnyObject);
}
const AxisChar* Call::getNamespacePrefix(const AxisChar* pNamespace)
@@ -1059,59 +1058,53 @@
}
void Call::setSOAPMethodAttribute( const AxisChar * pLocalname,
- const AxisChar * pPrefix,
- const AxisChar * pValue)
+ const AxisChar * pPrefix,
+ const AxisChar * pValue)
{
setSOAPMethodAttribute( pLocalname, pPrefix, NULL, pValue);
}
void Call::setSOAPMethodAttribute( const AxisChar * pLocalname,
- const AxisChar * pPrefix,
+ const AxisChar * pPrefix,
const AxisChar * pUri,
- const AxisChar * pValue)
+ const AxisChar * pValue)
{
- IAttribute * pAttribute;
+ IAttribute * pAttribute;
- if( pValue == NULL)
- {
- pValue = "";
- }
+ if( pValue == NULL)
+ pValue = "";
- std::list<Attribute*> attributeList;
+ std::list<Attribute*> attributeList;
if( NULL != pUri)
- {
pAttribute = new Attribute( attributeList, pLocalname, pPrefix, pUri, pValue);
- }
else
- {
pAttribute = new Attribute( attributeList, pLocalname, pPrefix, pValue);
- }
m_pIWSSZ->setSOAPMethodAttribute( ((Attribute *) pAttribute)->clone());
}
const xsd__string Call::getFaultAsXMLString()
{
- return m_pIWSDZ->getFaultAsXMLString();
+ return m_pIWSDZ->getFaultAsXMLString();
}
void Call::addAttachment(ISoapAttachment* att)
{
- if (NULL==m_pIWSSZ)
- m_attachments.push_back(att);
- else
- m_pIWSSZ->addAttachment(att->getHeader(AXIS_CONTENT_ID),att);
+ if (NULL==m_pIWSSZ)
+ m_attachments.push_back(att);
+ else
+ m_pIWSSZ->addAttachment(att->getHeader(AXIS_CONTENT_ID),att);
}
ISoapAttachment* Call::createSoapAttachment()
{
- return new SoapAttachment(m_pContentIdSet);
+ return new SoapAttachment(m_pContentIdSet);
}
void Call::addAttachmentParameter(ISoapAttachment* att, const char* pName, IAttribute **attributes, int nAttributes)
{
- m_pIWSSZ->addAttachmentParameter(att,pName,attributes,nAttributes);
+ m_pIWSSZ->addAttachmentParameter(att,pName,attributes,nAttributes);
}
IAttribute* Call::createAttribute(const AxisChar *pLocalname, const AxisChar *pPrefix, const AxisChar *pValue)
Modified: webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp?rev=395449&r1=395448&r2=395449&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp (original)
+++ webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.cpp Wed Apr 19 17:21:32 2006
@@ -57,97 +57,89 @@
try
{
- if (!pSoap)
- {
- return AXIS_FAIL;
- }
- m_pSoap = pSoap;
- string sSessionId = m_pSoap->getSessionId();
-
- do
- {
-// Get the service name that was specified in the second parameter of the call
-// to setTransportProperty( SOAPACTION_HEADER , "") matches a service name in
-// the 'service' part of the WSDD file then call that service now.
- const char* pchService = pSoap->getServiceName();
-
-// Check that there is a valid service name.
- if( pchService != NULL)
- {
-// The convention for the service name appears to be service#port
- if( strchr( pchService, '#') == NULL)
- {
-// If there is no # seperator, then strip off the outer quotes.
- int iStringLength = strlen( pchService);
- char * pszService = new char[iStringLength];
-
- memset( pszService, 0, iStringLength);
- memcpy( pszService, pchService + 1, iStringLength - 2);
-
- pService = g_pWSDDDeployment->getService( pszService);
-
- delete [] pszService;
- }
- else
- {
- char * pchTempService = new char [strlen(pchService)+1];
-// Skip the starting double quote
- strcpy(pchTempService, pchService+1);
-
-// The String returned as the service name has the format "Calculator#add".
-// So null terminate string at #.
- *(strchr(pchTempService, '#')) = '\0';
-
-// get service description object from the WSDD Deployment object
- pService = g_pWSDDDeployment->getService (pchTempService);
- delete [] pchTempService; // Samisa: should delete the whole array
- }
- }
- //Get Global and Transport Handlers
-
- Status = initializeHandlers (sSessionId, pSoap->getProtocol());
- if (AXIS_SUCCESS != Status)
- {
- throw AxisEngineException(SERVER_ENGINE_HANDLER_INIT_FAILED);
- break; //do .. while(0)
- }
- //Get Service specific Handlers from the pool if configured any
- if (pService != NULL)
- {
- Status = g_pHandlerPool-> getRequestFlowHandlerChain (&m_pSReqFChain,
- sSessionId, pService);
- if (AXIS_SUCCESS != Status)
- {
- break; //do .. while(0)
- }
- Status = g_pHandlerPool->
- getResponseFlowHandlerChain (&m_pSResFChain, sSessionId,
- pService);
- if (AXIS_SUCCESS != Status)
- {
- break; //do .. while(0)
- }
- }
-
- // Invoke all handlers and then the remote webservice
- Status = invoke (m_pMsgData); /* we generate response in the same way
- * even if this has failed
- */
- }
- while (0);
-
- //release the handlers
- releaseHandlers(sSessionId);
+ if (!pSoap)
+ return AXIS_FAIL;
+
+ m_pSoap = pSoap;
+ string sSessionId = m_pSoap->getSessionId();
+
+ do
+ {
+ // Get the service name that was specified in the second parameter of the call
+ // to setTransportProperty( SOAPACTION_HEADER , "") matches a service name in
+ // the 'service' part of the WSDD file then call that service now.
+ const char* pchService = pSoap->getServiceName();
+
+ // Check that there is a valid service name.
+ if( pchService != NULL)
+ {
+ // The convention for the service name appears to be service#port
+ if( strchr( pchService, '#') == NULL)
+ {
+ // If there is no # seperator, then strip off the outer quotes.
+ int iStringLength = strlen( pchService);
+ char * pszService = new char[iStringLength];
+
+ memset( pszService, 0, iStringLength);
+ memcpy( pszService, pchService + 1, iStringLength - 2);
+
+ pService = g_pWSDDDeployment->getService( pszService);
+
+ delete [] pszService;
+ }
+ else
+ {
+ char * pchTempService = new char [strlen(pchService)+1];
+
+ // Skip the starting double quote
+ strcpy(pchTempService, pchService+1);
+
+ // The String returned as the service name has the format "Calculator#add".
+ // So null terminate string at #.
+ *(strchr(pchTempService, '#')) = '\0';
+
+ // get service description object from the WSDD Deployment object
+ pService = g_pWSDDDeployment->getService (pchTempService);
+
+ delete [] pchTempService;
+ }
+ }
+
+ //Get Global and Transport Handlers
+ Status = initializeHandlers (sSessionId, pSoap->getProtocol());
+ if (AXIS_SUCCESS != Status)
+ throw AxisEngineException(SERVER_ENGINE_HANDLER_INIT_FAILED);
+
+ //Get Service specific Handlers from the pool if configured any
+ if (pService != NULL)
+ {
+ Status = g_pHandlerPool->getRequestFlowHandlerChain(&m_pSReqFChain, sSessionId, pService);
+ if (AXIS_SUCCESS != Status)
+ break;
+
+ Status = g_pHandlerPool->getResponseFlowHandlerChain(&m_pSResFChain, sSessionId, pService);
+ if (AXIS_SUCCESS != Status)
+ break;
+ }
+
+ // Invoke all handlers and then the remote webservice
+ // we generate response in the same way even if this has failed
+ Status = invoke (m_pMsgData);
+ }
+ while (0);
+
+ //release the handlers
+ releaseHandlers(sSessionId);
}
catch(AxisException& e)
{
- /* Throw a AxisGenException here instead of rethrowing the original exception because
- * the original exception may be an transport exception which will go out of scope when
- * the transport library is unloaded. The original exception will delete its own message
- * storage, so the false as the last parameter tells AxisGenException not to try to
- * delete it.
- */
- throw AxisGenException(e.getExceptionCode(), const_cast<char*>(e.what()));
+ /* Throw a AxisGenException here instead of rethrowing the original exception because
+ * the original exception may be an transport exception which will go out of scope when
+ * the transport library is unloaded. The original exception will delete its own message
+ * storage, so the false as the last parameter tells AxisGenException not to try to
+ * delete it.
+ */
+ throw AxisGenException(e.getExceptionCode(), const_cast<char*>(e.what()));
}
return Status;
}
@@ -156,18 +148,14 @@
{
// 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);
-
- // Pool back the Global and Transport handlers
- //UnInitializeHandlers(sSessionId, soap->trtype);
+ g_pHandlerPool->poolHandlerChain(m_pSResFChain, sSessionId);
}
int ClientAxisEngine::invoke (MessageData* pMsg)
{
- enum AE_LEVEL
- { AE_START = 1, AE_SERH, AE_GLH, AE_TRH, AE_SERV };
+ enum AE_LEVEL { AE_START = 1, AE_SERH, AE_GLH, AE_TRH, AE_SERV };
int Status = AXIS_FAIL;
int level = AE_START;
@@ -175,37 +163,25 @@
{
// Invoke client side service specific request handlers
if (m_pSReqFChain)
- {
if (AXIS_SUCCESS != (Status = m_pSReqFChain->invoke (pMsg)))
- {
- // m_pSZ->setSoapFault(SoapFault::getSoapFault(CLIENT_ENGINE_CLIENTHANDLERFAILED));
- break; //do .. while (0)
- }
- }
+ break;
+
// AXISTRACE1("AFTER invoke service specific request handlers");
level++; //AE_SERH
// Invoke global request handlers
if (m_pGReqFChain)
- {
if (AXIS_SUCCESS != (Status = m_pGReqFChain->invoke (pMsg)))
- {
- // m_pSZ->setSoapFault(SoapFault::getSoapFault(CLIENT_ENGINE_CLIENTHANDLERFAILED));
- break; //do .. while (0)
- }
- }
+ break;
+
// AXISTRACE1("AFTER invoke global request handlers");
level++; //AE_GLH
// Invoke transport request handlers
if (m_pTReqFChain)
- {
if (AXIS_SUCCESS != (Status = m_pTReqFChain->invoke (pMsg)))
- {
- // m_pSZ->setSoapFault(SoapFault::getSoapFault(CLIENT_ENGINE_CLIENTHANDLERFAILED));
- break; //do .. while (0)
- }
- }
+ break;
+
// AXISTRACE1("AFTER invoke transport request handlers");
level++; // AE_TRH
@@ -223,12 +199,10 @@
if (AXIS_SUCCESS != (Status = m_pDZ->setInputStream (m_pSoap)))
break;
+ // version not supported set status to fail
int nSoapVersion = m_pDZ->getVersion ();
- if (nSoapVersion == VERSION_LAST) /* version not supported */
- {
+ if (nSoapVersion == VERSION_LAST)
Status = AXIS_FAIL;
- // return AXIS_FAIL;
- }
m_pDZ->getHeader ();
m_pDZ->getBody ();
@@ -245,32 +219,27 @@
*/
switch (level)
{
- case AE_SERV: // everything success
+ case AE_SERV:
+ // everything success
Status = AXIS_SUCCESS;
- // no break;
- case AE_TRH: /* after invoking the transport handlers
- * (at actual service invokation) it has failed
- */
+
+ case AE_TRH:
+ // After invoking the transport handlers (at actual service invokation) it has failed
if (m_pTResFChain)
- {
m_pTResFChain->invoke (pMsg);
- }
- // no break;
- case AE_GLH: // transport handlers have failed
- // invoke global response handlers
+
+ case AE_GLH:
+ // transport handlers have failed invoke global response handlers
if (m_pGResFChain)
- {
m_pGResFChain->invoke (pMsg);
- }
- //no break;
+
case AE_SERH: // global handlers have failed
// invoke web service specific response handlers
if (m_pSResFChain)
- {
m_pSResFChain->invoke (pMsg);
- }
- // no break;
- case AE_START:; // service specific handlers have failed
+
+ case AE_START:;
+ // service specific handlers have failed
};
return Status;
Modified: webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.h
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.h?rev=395449&r1=395448&r2=395449&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.h (original)
+++ webservices/axis/trunk/c/src/engine/client/ClientAxisEngine.h Wed Apr 19 17:21:32 2006
@@ -40,11 +40,13 @@
ClientAxisEngine ();
virtual ~ ClientAxisEngine ();
virtual int process (SOAPTransport* pSoap);
+
protected:
virtual int invoke (MessageData* pMsg);
virtual void onFault (MessageData* pMsg);
+
private:
- void releaseHandlers(string sSessionId);
+ void releaseHandlers(string sSessionId);
SOAPTransport* m_pSoap;
};
AXIS_CPP_NAMESPACE_END
Modified: webservices/axis/trunk/c/src/engine/client/Stub.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/engine/client/Stub.cpp?rev=395449&r1=395448&r2=395449&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/client/Stub.cpp (original)
+++ webservices/axis/trunk/c/src/engine/client/Stub.cpp Wed Apr 19 17:21:32 2006
@@ -54,15 +54,10 @@
while( pszArgPtr != NULL && iArgIndex < 8)
{
m_sArguments[iArgIndex] = pszArgPtr;
-
iArgIndex++;
-
pszArgPtr = strtok( NULL, ",");
-
while( pszArgPtr != NULL && *pszArgPtr == ' ' && *pszArgPtr != '\0')
- {
pszArgPtr++;
- }
}
}
}
@@ -75,23 +70,21 @@
unsigned int j = 0;
for (j = 0; j < m_vSOAPHeaderBlocks.size (); j++)
{
- delete m_vSOAPHeaderBlocks[j];
- m_vSOAPHeaderBlocks[j] = NULL;
+ delete m_vSOAPHeaderBlocks[j];
+ m_vSOAPHeaderBlocks[j] = NULL;
}
if (m_pcUsername)
- delete[]m_pcUsername;
+ delete[]m_pcUsername;
if (m_pcPassword)
- delete[]m_pcPassword;
+ delete[]m_pcPassword;
}
void
Stub::setEndPoint (const char *pcEndPoint)
{
if (m_pTransport)
- {
m_pTransport->setEndpointUri( pcEndPoint);
- }
}
void
@@ -99,47 +92,42 @@
{
if (m_pTransport)
{
- if(!pcKey)
- {
- m_pTransport=NULL; //this should be set to null. otherwise the previous setting can be still there.
- return;// if the pcKey is set to null, the method returns
- }
-
- else if (strcmp (pcKey, "SOAPAction") == 0) //Samisa: Setting SOAPAction,
- //may need to add '"' to value - AXISCPP-531
- {
- // both "" missing
- if (pcValue
- && (pcValue[0] != '"'
- && pcValue[strlen (pcValue) - 1] != '"'))
- {
- char *tempvalue = new char[strlen (pcValue) + 3];
- sprintf (tempvalue, "\"%s\"", pcValue);
- m_pTransport->setTransportProperty (pcKey, tempvalue);
- delete[]tempvalue;
- }
- else if (pcValue && (pcValue[0] != '"')) //starting '"' missing
- {
- char *tempvalue = new char[strlen (pcValue) + 2];
- sprintf (tempvalue, "\"%s", pcValue);
- m_pTransport->setTransportProperty (pcKey, tempvalue);
- delete[]tempvalue;
- }
- else if (pcValue && (pcValue[strlen (pcValue) - 1] != '"')) // ending '"' missing
- {
- char *tempvalue = new char[strlen (pcValue) + 3];
- sprintf (tempvalue, "\"%s\"", pcValue);
- m_pTransport->setTransportProperty (pcKey, tempvalue);
- delete[]tempvalue;
- }
- else // both "" present
- m_pTransport->setTransportProperty (pcKey, pcValue);
- }
-
- else
- {
- m_pTransport->setTransportProperty (pcKey, pcValue);
- }
+ if(!pcKey)
+ {
+ m_pTransport=NULL; //this should be set to null. otherwise the previous setting can be still there.
+ return;
+ }
+ else if (strcmp (pcKey, "SOAPAction") == 0)
+ {
+ // both "" missing
+ if (pcValue
+ && (pcValue[0] != '"'
+ && pcValue[strlen (pcValue) - 1] != '"'))
+ {
+ char *tempvalue = new char[strlen (pcValue) + 3];
+ sprintf (tempvalue, "\"%s\"", pcValue);
+ m_pTransport->setTransportProperty (pcKey, tempvalue);
+ delete[]tempvalue;
+ }
+ else if (pcValue && (pcValue[0] != '"')) //starting '"' missing
+ {
+ char *tempvalue = new char[strlen (pcValue) + 2];
+ sprintf (tempvalue, "\"%s", pcValue);
+ m_pTransport->setTransportProperty (pcKey, tempvalue);
+ delete[]tempvalue;
+ }
+ else if (pcValue && (pcValue[strlen (pcValue) - 1] != '"')) // ending '"' missing
+ {
+ char *tempvalue = new char[strlen (pcValue) + 3];
+ sprintf (tempvalue, "\"%s\"", pcValue);
+ m_pTransport->setTransportProperty (pcKey, tempvalue);
+ delete[]tempvalue;
+ }
+ else // both "" present
+ m_pTransport->setTransportProperty (pcKey, pcValue);
+ }
+ else
+ m_pTransport->setTransportProperty (pcKey, pcValue);
}
}
@@ -153,50 +141,50 @@
Stub::getFirstTransportPropertyKey (bool response)
{
if (m_pTransport)
- return m_pTransport->getFirstTransportPropertyKey (response);
- else
- return NULL;
+ return m_pTransport->getFirstTransportPropertyKey (response);
+
+ return NULL;
}
const char *
Stub::getNextTransportPropertyKey (bool response)
{
if (m_pTransport)
- return m_pTransport->getNextTransportPropertyKey (response);
- else
- return NULL;
+ return m_pTransport->getNextTransportPropertyKey (response);
+
+ return NULL;
}
const char *
Stub::getCurrentTransportPropertyKey (bool response)
{
if (m_pTransport)
- return m_pTransport->getCurrentTransportPropertyKey (response);
- else
- return NULL;
+ return m_pTransport->getCurrentTransportPropertyKey (response);
+
+ return NULL;
}
const char *
Stub::getCurrentTransportPropertyValue (bool response)
{
if (m_pTransport)
- return m_pTransport->getCurrentTransportPropertyValue (response);
- else
- return NULL;
+ return m_pTransport->getCurrentTransportPropertyValue (response);
+
+ return NULL;
}
void
Stub::deleteCurrentTransportProperty (bool response)
{
if (m_pTransport)
- m_pTransport->deleteCurrentTransportProperty (response);
+ m_pTransport->deleteCurrentTransportProperty (response);
}
void
Stub::deleteTransportProperty (char *pcKey, unsigned int uiOccurance)
{
if (m_pTransport)
- m_pTransport->deleteTransportProperty (pcKey, uiOccurance);
+ m_pTransport->deleteTransportProperty (pcKey, uiOccurance);
}
void
@@ -210,23 +198,18 @@
{
if (pachLocalName && pachUri)
{
- if ((AxisUtils::isStringOnlyWithSpaces (pachLocalName)) ||
- (AxisUtils::isStringOnlyWithSpaces (pachUri)))
- {
- return NULL;
- }
- else
- {
- IHeaderBlock *pNewSoapheader =
- m_pCall->createHeaderBlock (pachLocalName, pachUri);
- m_vSOAPHeaderBlocks.push_back (pNewSoapheader);
- return pNewSoapheader;
- }
- }
- else
- {
- return NULL;
+ if ((AxisUtils::isStringOnlyWithSpaces (pachLocalName))
+ || (AxisUtils::isStringOnlyWithSpaces (pachUri)))
+ return NULL;
+ else
+ {
+ IHeaderBlock *pNewSoapheader = m_pCall->createHeaderBlock (pachLocalName, pachUri);
+ m_vSOAPHeaderBlocks.push_back (pNewSoapheader);
+ return pNewSoapheader;
+ }
}
+
+ return NULL;
}
IHeaderBlock *
@@ -234,9 +217,9 @@
{
m_viCurrentSOAPHeaderBlock = m_vSOAPHeaderBlocks.begin ();
if (m_viCurrentSOAPHeaderBlock == m_vSOAPHeaderBlocks.end ())
- return NULL;
+ return NULL;
else
- return (*m_viCurrentSOAPHeaderBlock);
+ return (*m_viCurrentSOAPHeaderBlock);
}
@@ -245,23 +228,21 @@
{
//already at the end?
if (m_viCurrentSOAPHeaderBlock == m_vSOAPHeaderBlocks.end ())
- return NULL;
+ return NULL;
m_viCurrentSOAPHeaderBlock++;
if (m_viCurrentSOAPHeaderBlock == m_vSOAPHeaderBlocks.end ())
- return NULL;
+ return NULL;
else
- return (*m_viCurrentSOAPHeaderBlock);
-
+ return (*m_viCurrentSOAPHeaderBlock);
}
IHeaderBlock *
Stub::getCurrentSOAPHeaderBlock ()
{
if (m_viCurrentSOAPHeaderBlock != m_vSOAPHeaderBlocks.end ())
- {
- return (*m_viCurrentSOAPHeaderBlock);
- }
+ return (*m_viCurrentSOAPHeaderBlock);
+
return NULL;
}
@@ -270,8 +251,8 @@
{
if (m_viCurrentSOAPHeaderBlock != m_vSOAPHeaderBlocks.end ())
{
- delete (*m_viCurrentSOAPHeaderBlock);
- m_vSOAPHeaderBlocks.erase (m_viCurrentSOAPHeaderBlock);
+ delete (*m_viCurrentSOAPHeaderBlock);
+ m_vSOAPHeaderBlocks.erase (m_viCurrentSOAPHeaderBlock);
}
}
@@ -279,17 +260,17 @@
Stub::deleteSOAPHeaderBlock (IHeaderBlock * pHeaderBlock)
{
vector < IHeaderBlock * >::iterator currentSOAPHeaderBlock =
- m_vSOAPHeaderBlocks.begin ();
+ m_vSOAPHeaderBlocks.begin ();
bool bDone = false;
while (!bDone && currentSOAPHeaderBlock != m_vSOAPHeaderBlocks.end ())
{
- if (pHeaderBlock == *currentSOAPHeaderBlock)
- {
- delete (*currentSOAPHeaderBlock);
- m_vSOAPHeaderBlocks.erase (currentSOAPHeaderBlock);
- bDone = true;
- }
- currentSOAPHeaderBlock++;
+ if (pHeaderBlock == *currentSOAPHeaderBlock)
+ {
+ delete (*currentSOAPHeaderBlock);
+ m_vSOAPHeaderBlocks.erase (currentSOAPHeaderBlock);
+ bDone = true;
+ }
+ currentSOAPHeaderBlock++;
}
}
@@ -298,14 +279,11 @@
{
SoapSerializer *pSerializer = NULL;
if (m_pCall)
- pSerializer = m_pCall->getSOAPSerializer ();
+ pSerializer = m_pCall->getSOAPSerializer ();
+
if (pSerializer)
- {
- for (unsigned int i = 0; i < m_vSOAPHeaderBlocks.size (); i++)
- {
- pSerializer->addHeaderBlock (m_vSOAPHeaderBlocks[i]);
- }
- }
+ for (unsigned int i = 0; i < m_vSOAPHeaderBlocks.size (); i++)
+ pSerializer->addHeaderBlock (m_vSOAPHeaderBlocks[i]);
}
void
@@ -318,36 +296,30 @@
Stub::setProxy (const char *pcProxyHost, unsigned int uiProxyPort)
{
if (m_pTransport)
- {
m_pTransport->setProxy (pcProxyHost, uiProxyPort);
- }
}
void
Stub::setTransportTimeout (long lSeconds)
{
if (m_pTransport)
- {
m_pTransport->setTimeout (lSeconds);
- }
}
int
Stub::getStatus ()
{
if (m_pCall == NULL)
- return AXIS_SUCCESS;
+ return AXIS_SUCCESS;
else
- return m_pCall->getStatus ();
+ return m_pCall->getStatus ();
}
void
Stub::setMaintainSession (bool bSession)
{
if (m_pTransport)
- {
- m_pTransport->setMaintainSession (bSession);
- }
+ m_pTransport->setMaintainSession (bSession);
}
@@ -355,42 +327,37 @@
Stub::setTransportProtocol (AXIS_PROTOCOL_TYPE eProtocol)
{
if (m_pCall)
- m_pCall->setProtocol (eProtocol);
+ m_pCall->setProtocol (eProtocol);
}
AXIS_PROTOCOL_TYPE
Stub::getTransportProtocol ()
{
if (m_pCall)
- return m_pCall->getProtocol ();
- else
- return APT_UNKNOWN;
+ return m_pCall->getProtocol ();
+
+ return APT_UNKNOWN;
}
IHeaderBlock *
Stub::createSOAPHeaderBlock (AxisChar * pachLocalName, AxisChar * pachUri,
- AxisChar * pachPrefix)
+ AxisChar * pachPrefix)
{
if (pachLocalName && pachUri && pachPrefix)
{
- if (AxisUtils::isStringOnlyWithSpaces (pachLocalName) ||
- AxisUtils::isStringOnlyWithSpaces (pachUri))
- {
- return NULL;
- }
- else
- {
- IHeaderBlock *pNewSoapheader =
- m_pCall->createHeaderBlock (pachLocalName, pachUri,
- pachPrefix);
- m_vSOAPHeaderBlocks.push_back (pNewSoapheader);
- return pNewSoapheader;
- }
- }
- else
- {
- return NULL;
+ if (AxisUtils::isStringOnlyWithSpaces (pachLocalName)
+ || AxisUtils::isStringOnlyWithSpaces (pachUri))
+ return NULL;
+ else
+ {
+ IHeaderBlock *pNewSoapheader =
+ m_pCall->createHeaderBlock (pachLocalName, pachUri, pachPrefix);
+ m_vSOAPHeaderBlocks.push_back (pNewSoapheader);
+ return pNewSoapheader;
+ }
}
+
+ return NULL;
}
void
@@ -398,20 +365,18 @@
{
if (m_pcUsername)
{
- delete[]m_pcUsername;
- m_pcUsername = NULL;
+ delete[]m_pcUsername;
+ m_pcUsername = NULL;
}
if (!pcUsername)
- return;
+ return;
m_pcUsername = new char[strlen (pcUsername) + 1];
strcpy (m_pcUsername, pcUsername);
if (m_pcPassword)
- {
- setAuthorizationHeader ();
- }
+ setAuthorizationHeader ();
}
void
@@ -419,20 +384,18 @@
{
if (m_proxyUsername)
{
- delete[]m_proxyUsername;
- m_proxyUsername = NULL;
+ delete[]m_proxyUsername;
+ m_proxyUsername = NULL;
}
if (!pcProxyUsername)
- return;
+ return;
m_proxyUsername = new char[strlen (pcProxyUsername) + 1];
strcpy (m_proxyUsername, pcProxyUsername);
if (m_proxyPassword)
- {
- setProxyAuthorizationHeader ();
- }
+ setProxyAuthorizationHeader ();
}
void
@@ -440,20 +403,18 @@
{
if (m_pcPassword)
{
- delete[]m_pcPassword;
- m_pcPassword = NULL;
+ delete[]m_pcPassword;
+ m_pcPassword = NULL;
}
if (!pcPassword)
- return;
+ return;
m_pcPassword = new char[strlen (pcPassword) + 1];
strcpy (m_pcPassword, pcPassword);
if (m_pcUsername)
- {
- setAuthorizationHeader ();
- }
+ setAuthorizationHeader ();
}
void
@@ -461,20 +422,18 @@
{
if (m_proxyPassword)
{
- delete[]m_proxyPassword;
- m_proxyPassword = NULL;
+ delete[]m_proxyPassword;
+ m_proxyPassword = NULL;
}
if (!pcProxyPassword)
- return;
+ return;
m_proxyPassword = new char[strlen (pcProxyPassword) + 1];
strcpy (m_proxyPassword, pcProxyPassword);
if (m_proxyUsername)
- {
- setProxyAuthorizationHeader ();
- }
+ setProxyAuthorizationHeader ();
}
const char *
@@ -504,25 +463,22 @@
void
Stub::setAuthorizationHeader ()
{
- char *cpUsernamePassword =
- new char[strlen (m_pcUsername) + strlen (m_pcPassword) + 2];
+ char *cpUsernamePassword = new char[strlen (m_pcUsername) + strlen (m_pcPassword) + 2];
strcpy (cpUsernamePassword, m_pcUsername);
strcat (cpUsernamePassword, ":");
strcat (cpUsernamePassword, m_pcPassword);
int len = apr_base64_encode_len (strlen (cpUsernamePassword));
AxisChar *base64Value = new AxisChar[len + 1];
- len =
- apr_base64_encode_binary (base64Value,
- (const unsigned char *) cpUsernamePassword,
- strlen (cpUsernamePassword));
+ len = apr_base64_encode_binary (base64Value,
+ (const unsigned char *) cpUsernamePassword,
+ strlen (cpUsernamePassword));
std::string strValue = "Basic ";
strValue += base64Value;
if (m_pTransport)
- m_pTransport->setTransportProperty ("Authorization",
- strValue.c_str ());
+ m_pTransport->setTransportProperty ("Authorization", strValue.c_str ());
delete[]cpUsernamePassword;
delete[]base64Value;
@@ -537,22 +493,22 @@
strcat( cpUsernamePassword, m_proxyPassword );
int len = apr_base64_encode_len (strlen(cpUsernamePassword));
- AxisChar* base64Value = new AxisChar[len + 1];
- len = apr_base64_encode_binary ( base64Value, (const unsigned char*)cpUsernamePassword, strlen
- (cpUsernamePassword));
+ AxisChar* base64Value = new AxisChar[len + 1];
+ len = apr_base64_encode_binary (base64Value,
+ (const unsigned char*)cpUsernamePassword,
+ strlen(cpUsernamePassword));
- std::string strValue = "Basic ";
+ std::string strValue = "Basic ";
strValue += base64Value;
- this->setTransportProperty( "Proxy-Authorization", strValue.c_str());
+ this->setTransportProperty( "Proxy-Authorization", strValue.c_str());
delete [] cpUsernamePassword;
delete [] base64Value;
-
}
ISoapAttachment* Stub::createSoapAttachment()
{
- return m_pCall->createSoapAttachment();
+ return m_pCall->createSoapAttachment();
}
/*Methods for supporting SecureChannel*/
@@ -569,21 +525,16 @@
do
{
if( pszArg == (char *) 1)
- {
m_sArguments[iArgIndex] = "true";
- }
else
- {
m_sArguments[iArgIndex] = pszArg;
- }
iArgIndex++;
- } while( (pszArg = va_arg( args, char *)) != NULL && iArgIndex < 8);
+ }
+ while( (pszArg = va_arg( args, char *)) != NULL && iArgIndex < 8);
if( iArgIndex == 6)
- {
m_sArguments[iArgIndex] = "false";
- }
}
va_end( args);