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 su...@apache.org on 2003/09/11 12:42:48 UTC
cvs commit: xml-axis/c/src/wcg Method.cpp
susantha 2003/09/11 03:42:48
Modified: c/src/common ArrayBean.h IWrapperSoapSerializer.h
MessageData.cpp
c/src/engine Axis.cpp AxisEngine.cpp AxisEngine.h
c/src/server/samples/cppservicewrapper CPPServiceWrapper.cpp
c/src/server/samples/cservicewrapper CServiceWrapper.cpp
c/src/server/samples/webservicewrapper WebServiceWrapper.cpp
c/src/soap SoapFaults.h SoapMethod.cpp SoapMethod.h
SoapSerializer.cpp SoapSerializer.h
c/src/wcg Method.cpp
Added: c/src/client Call.cpp Call.h
c/src/client/samples/Calculator CalcClient.cpp
Calculator.cpp Calculator.h
c/src/engine ClientAxisEngine.cpp ClientAxisEngine.h
ServerAxisEngine.cpp ServerAxisEngine.h
Removed: c/src/engine HandlerLoaderTest.cpp
Log:
Changed the code base more suitable for client side
1. Two new classes ServerAxisEngine and ClientAxisEngine are added.
2. Code in Axis.cpp changed to use ServerAxisEngine instead of AxisEngine.
3. SoapSerializer method setResponseParam changed to AddOutputParam
so that multiple parameters can be added to the SoapMethod.
4. SoapMethod class's serialize method changed so that it can serialize multiple parameters.
5. WCG code changed to reflect the change in 2 & 3.
6. Removed HandlerLoaderTest.cpp which is no longer needed.
Revision Changes Path
1.1 xml-axis/c/src/client/Call.cpp
Index: Call.cpp
===================================================================
// Call.cpp: implementation of the Call class.
//
//////////////////////////////////////////////////////////////////////
#include "Call.h"
//#include "../../../common/IMessageData.h"
//#include "../../../common/ISoapMethod.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Call::Call()
{
m_pAxisEngine = NULL;
}
Call::~Call()
{
}
int Call::SetEndpointURI(const char *pchEndpointURI)
{
return SUCCESS;
}
void Call::SetOperation(const char *pchOperation, const char* pchNamespace)
{
ISoapMethod* pMethod= m_pIWSSZ->createSoapMethod();
pMethod->setLocalName(pchOperation);
pMethod->setPrefix(m_pIWSSZ->getNewNamespacePrefix());
pMethod->setUri(pchNamespace);
}
void Call::AddParameter(XSDTYPE nType, uParamValue Value, const char* pchName)
{
IParam* pRetParam = m_pIWSSZ->AddOutputParam(nType, Value);
pRetParam->SetName(pchName);
}
void Call::AddParameter(IArrayBean *pArrayBean, const char* pchName)
{
IParam* pRetParam = m_pIWSSZ->AddOutputParam(pArrayBean);
pRetParam->SetName(pchName);
}
void Call::AddParameter(void *pObject, void *pSZFunct, void *pDelFunct, const char* pchName)
{
IParam* pRetParam = m_pIWSSZ->AddOutputParam(pObject, pSZFunct, pDelFunct);
pRetParam->SetName(pchName);
}
void Call::SetReturnType(XSDTYPE nType)
{
m_nReturnType = nType;
}
void Call::SetReturnType(void *pObject, void *pDZFunct, void *pDelFunct)
{
m_nReturnType = USER_TYPE;
m_ReturnCplxObj.pObject = pObject;
m_ReturnCplxObj.pDZFunct = (AXIS_DESERIALIZE_FUNCT)pDZFunct;
m_ReturnCplxObj.pDelFunct = (AXIS_OBJECT_DELETE_FUNCT)pDelFunct;
}
int Call::Invoke()
{
int nStatus;
if (SUCCESS == (nStatus = m_pAxisEngine->Process(&m_Soap)))
{
if (m_nReturnType == USER_TYPE)
{
m_ReturnCplxObj.pDZFunct(m_ReturnCplxObj.pObject, m_pMsgData);
}
else if (m_nReturnType == XSD_ARRAY)
{
}
else //basic type
{
m_Param.
m_pIWSDZ->DeSerialize(m_nReturnType, &m_uReturnValue);
}
}
return nStatus;
}
const uParamValue& Call::GetResult()
{
return m_uReturnValue;
}
int Call::Initialize()
{
if (m_pAxisEngine) delete m_pAxisEngine;
m_pAxisEngine = new ClientAxisEngine();
if (!m_pAxisEngine) return FAIL;
if (SUCCESS == m_pAxisEngine->Initialize())
{
m_pMsgData = m_pAxisEngine->GetMessageData();
if (m_pMsgData)
{
m_pMsgData->getSoapSerializer(&m_pIWSSZ);
m_pMsgData->getSoapDeSerializer(&m_pIWSDZ);
if (m_pIWSSZ && m_pIWSDZ)
{
return SUCCESS;
}
}
return SUCCESS;
}
return FAIL;
}
int Call::UnInitialize()
{
if (m_pAxisEngine)
{
m_pAxisEngine->UnInitialize();
delete m_pAxisEngine;
m_pAxisEngine = NULL;
}
return SUCCESS;
}
1.1 xml-axis/c/src/client/Call.h
Index: Call.h
===================================================================
// Call.h: interface for the Call class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CALL_H__D13E5626_0A9B_43EA_B606_364B98CEDAA8__INCLUDED_)
#define AFX_CALL_H__D13E5626_0A9B_43EA_B606_364B98CEDAA8__INCLUDED_
#include "../common/IParam.h"
#include "../engine/ClientAxisEngine.h"
class Call
{
public:
int UnInitialize();
int Initialize();
const uParamValue& GetResult();
int Invoke();
void SetReturnType(void* pObject, void* pDZFunct, void* pDelFunct);
void SetReturnType(XSDTYPE nType);
void AddParameter(void* pObject, void* pSZFunct, void* pDelFunct, const char* pchName);
void AddParameter(IArrayBean* pArrayBean, const char* pchName);
void AddParameter(XSDTYPE nType, uParamValue Value, const char* pchName);
void SetOperation(const char* pchOperation, const char* pchNamespace);
int SetEndpointURI(const char* pchEndpointURI);
Call();
virtual ~Call();
private:
ClientAxisEngine* m_pAxisEngine;
uParamValue m_uReturnValue;
MessageData* m_pMsgData;
IWrapperSoapSerializer* m_pIWSSZ;
IWrapperSoapDeSerializer* m_pIWSDZ;
XSDTYPE m_nReturnType;
ComplexObjectHandler m_ReturnCplxObj;
Ax_soapstream m_Soap;
Param m_Param;
};
#endif // !defined(AFX_CALL_H__D13E5626_0A9B_43EA_B606_364B98CEDAA8__INCLUDED_)
1.1 xml-axis/c/src/client/samples/Calculator/CalcClient.cpp
Index: CalcClient.cpp
===================================================================
// CalcClient.cpp : Defines the entry point for the console application.
//
#include "Calculator.h"
int main(int argc, char* argv[])
{
Calculator cal;
int result = cal.Add(4, 5);
return 0;
}
1.1 xml-axis/c/src/client/samples/Calculator/Calculator.cpp
Index: Calculator.cpp
===================================================================
// Calculator.cpp: implementation of the Calculator class.
//
//////////////////////////////////////////////////////////////////////
#include "Calculator.h"
#include "../../../common/GDefine.h"
#include "../../../common/IWrapperSoapDeSerializer.h"
#include "../../../common/IWrapperSoapSerializer.h"
#include "../../../common/IParam.h"
//Parameters and wrapper methods to manipulate Point
static const AxisChar* Axis_URI_Point = "http://www.opensource.lk/Point";
static const AxisChar* Axis_TypeName_Point = "Point";
int Axis_DeSerialize_Point(Point* p, IWrapperSoapDeSerializer *pDZ)
{
p->x = pDZ->GetParam()->GetInt();
p->y = pDZ->GetParam()->GetInt();
return SUCCESS;
}
void Axis_Delete_Point(Point* p, bool bArray = false, int nSize=0)
{
if (bArray)
delete [] p;
else
delete p;
}
int Axis_Serialize_Point(Point* p, IWrapperSoapSerializer& pSZ, bool bArray = false)
{
if (bArray)
{
pSZ << "<" << Axis_TypeName_Point << ">";
}
else
{
const AxisChar* sPrefix = pSZ.getNewNamespacePrefix();
pSZ << "<" << Axis_TypeName_Point << " xsi:type=\"" << sPrefix <<":"
<< Axis_TypeName_Point << " xmlns:" << sPrefix << "=\""
<< Axis_URI_Point << "\">";
}
pSZ << pSZ.SerializeBasicType("x", p->x);
pSZ << pSZ.SerializeBasicType("y", p->y);
pSZ << "</" << Axis_TypeName_Point << ">";
return SUCCESS;
}
int Axis_GetSize_Point(Point* p)
{
return sizeof(Point);
}
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Calculator::Calculator()
{
m_pCall = new Call();
}
Calculator::~Calculator()
{
}
int Calculator::Add(int a, int b)
{
int nStatus;
if (SUCCESS != m_pCall->Initialize()) return 0;
m_pCall->SetOperation("Add", "http://www.opensource.lk/");//this should be done before adding parameters or return type
uParamValue Value;
Value.nValue = a;
m_pCall->AddParameter(XSD_INT, Value, "a");
Value.nValue = b;
m_pCall->AddParameter(XSD_INT, Value, "b");
m_pCall->SetReturnType(XSD_INT);
int ret = 0;
nStatus = m_pCall->Invoke();
if (SUCCESS == nStatus)
{
ret = m_pCall->GetResult().nValue;
}
m_pCall->UnInitialize();
return ret;
}
Point* Calculator::AddPoint(Point* p1, Point* p2)
{
int nStatus;
if (SUCCESS != m_pCall->Initialize()) return NULL;
m_pCall->SetOperation("AddPoint", "http://www.opensource.lk/");//this should be done before adding parameters or return type
m_pCall->AddParameter(p1, Axis_Serialize_Point, Axis_Delete_Point, "p1");
m_pCall->AddParameter(p2, Axis_Serialize_Point, Axis_Delete_Point, "p2");
Point* pReturn = new Point();
m_pCall->SetReturnType(pReturn, Axis_DeSerialize_Point, Axis_Delete_Point);
nStatus = m_pCall->Invoke();
if (SUCCESS != nStatus)
{
delete pReturn;
pReturn = NULL;
}
m_pCall->UnInitialize();
return pReturn;
}
1.1 xml-axis/c/src/client/samples/Calculator/Calculator.h
Index: Calculator.h
===================================================================
// Calculator.h: interface for the Calculator class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CALCULATOR_H__B5394466_ACFF_4962_B259_B0891BBB4775__INCLUDED_)
#define AFX_CALCULATOR_H__B5394466_ACFF_4962_B259_B0891BBB4775__INCLUDED_
#include "../../Call.h"
class Point
{
public:
int x;
int y;
};
class Calculator
{
private:
Call* m_pCall;
public:
Calculator();
virtual ~Calculator();
int Add(int a, int b);
Point* AddPoint(Point* p1, Point* p2);
};
#endif // !defined(AFX_CALCULATOR_H__B5394466_ACFF_4962_B259_B0891BBB4775__INCLUDED_)
1.7 +0 -3 xml-axis/c/src/common/ArrayBean.h
Index: ArrayBean.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/ArrayBean.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ArrayBean.h 1 Sep 2003 07:28:28 -0000 1.6
+++ ArrayBean.h 11 Sep 2003 10:42:47 -0000 1.7
@@ -84,9 +84,6 @@
int GetArraySize();
private:
int GetArrayBlockSize(list<int>::iterator it);
-// void DeleteArray(list<int>::iterator it, int nItemOffset, int nItemSize, int nDim);
-// int SerializeArray(list<int>::iterator it, int nItemOffset, int nItemSize, int nDim, string& sSerialized);
-// int DeSerializeArray(list<int>::iterator it, int nItemOffset, int nItemSize, int nDim, SoapDeSerializer *pDZ);
public:
XSDTYPE m_type; //array element type
1.8 +3 -3 xml-axis/c/src/common/IWrapperSoapSerializer.h
Index: IWrapperSoapSerializer.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/IWrapperSoapSerializer.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- IWrapperSoapSerializer.h 5 Sep 2003 10:48:50 -0000 1.7
+++ IWrapperSoapSerializer.h 11 Sep 2003 10:42:47 -0000 1.8
@@ -78,9 +78,9 @@
class IWrapperSoapSerializer : public virtual ISoapSerializer
{
public:
- virtual IParam* setResponseParam(XSDTYPE nType, uParamValue Value)=0;
- virtual IParam* setResponseParam(IArrayBean* pArrayBean)=0;
- virtual IParam* setResponseParam(void* pObject, void* pDZFunct, void* pDelFunct)=0;
+ virtual IParam* AddOutputParam(XSDTYPE nType, uParamValue Value)=0;
+ virtual IParam* AddOutputParam(IArrayBean* pArrayBean)=0;
+ virtual IParam* AddOutputParam(void* pObject, void* pDZFunct, void* pDelFunct)=0;
virtual ISoapMethod* createSoapMethod()=0;
// virtual IWrapperSoapSerializer& operator<<(const char *cSerialized)=0;
virtual IWrapperSoapSerializer& operator<<(const AxisChar* cSerialized)=0;
1.10 +1 -0 xml-axis/c/src/common/MessageData.cpp
Index: MessageData.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/common/MessageData.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- MessageData.cpp 13 Aug 2003 14:07:19 -0000 1.9
+++ MessageData.cpp 11 Sep 2003 10:42:47 -0000 1.10
@@ -81,6 +81,7 @@
MessageData::~MessageData()
{
+ //nothing to do
}
void MessageData::SetSerializer(SoapSerializer *pSZ)
1.17 +8 -6 xml-axis/c/src/engine/Axis.cpp
Index: Axis.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/engine/Axis.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Axis.cpp 9 Sep 2003 12:53:01 -0000 1.16
+++ Axis.cpp 11 Sep 2003 10:42:48 -0000 1.17
@@ -67,7 +67,7 @@
#include <unistd.h>
#endif
-#include "AxisEngine.h"
+#include "ServerAxisEngine.h"
//#include "../common/AxisTrace.h"
#include <stdio.h>
#include <stdlib.h>
@@ -144,13 +144,15 @@
if (str->so.http.ip_method == AXIS_HTTP_POST)
{
// AXISTRACE1("method is POST");
- AxisEngine* engine = new AxisEngine();
+ AxisEngine* engine = new ServerAxisEngine();
if (engine)
{
- Status = engine->Process(str);
-// AXISTRACE1("Status = engine->Process(str);");
-// AXISTRACE1("are we successful?");
- Status = SUCCESS;
+ if (SUCCESS == engine->Initialize())
+ {
+ Status = engine->Process(str);
+ // AXISTRACE1("Status = engine->Process(str);");
+ // AXISTRACE1("are we successful?");
+ }
delete engine;
}
}
1.22 +18 -279 xml-axis/c/src/engine/AxisEngine.cpp
Index: AxisEngine.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/engine/AxisEngine.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- AxisEngine.cpp 9 Sep 2003 12:53:01 -0000 1.21
+++ AxisEngine.cpp 11 Sep 2003 10:42:48 -0000 1.22
@@ -61,13 +61,14 @@
*
*/
-#include <stdio.h>
#include "AxisEngine.h"
-#include "../common/AxisException.h"
+#include <stdio.h>
+//#include "../common/AxisException.h"
//#include "../common/AxisTrace.h"
-#include "../common/Packet.h"
-#include "../common/AxisUtils.h"
-#include "../wsdd/WSDDDeployment.h"
+//#include "../common/Packet.h"
+//#include "../common/AxisUtils.h"
+//#include "../wsdd/WSDDDeployment.h"
+
#include "HandlerPool.h"
#include "DeserializerPool.h"
#include "SerializerPool.h"
@@ -75,7 +76,7 @@
extern DeserializerPool* g_pDeserializerPool;
extern SerializerPool* g_pSerializerPool;
extern HandlerPool* g_pHandlerPool;
-extern WSDDDeployment* g_pWSDDDeployment;
+//extern WSDDDeployment* g_pWSDDDeployment;
AxisEngine::AxisEngine()
{
@@ -87,298 +88,36 @@
m_pTResFChain = NULL;
m_pSReqFChain = NULL;
m_pSResFChain = NULL;
- m_pWebService = NULL;
+ m_pMsgData = NULL;
}
AxisEngine::~AxisEngine()
{
if (m_pDZ) g_pDeserializerPool->PutInstance(m_pDZ);
if (m_pSZ) g_pSerializerPool->PutInstance(m_pSZ);
-}
-
-int AxisEngine::Process(Ax_soapstream* soap)
-{
- int Status;
- AXIS_TRY
-// AXISTRACE1("AxisEngine::Process");
- MessageData* pMsg = NULL;
- const WSDDService* pService = NULL;
- string sSessionId = soap->sessionid;
- int nSoapVersion;
-
- do {
- //create and populate MessageData
- if (SUCCESS != Initialize())
- {
- nSoapVersion = m_pDZ->GetVersion();
- nSoapVersion = (nSoapVersion == VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
- m_pSZ->setSoapVersion((SOAP_VERSION)nSoapVersion);
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADSRV));
- break; //do .. while(0)
- }
- pMsg = new MessageData();
- pMsg->m_Protocol = soap->trtype;
- pMsg->SetSerializer(m_pSZ);
- pMsg->SetDeSerializer(m_pDZ);
-
- if (SUCCESS != m_pDZ->SetInputStream(soap->str.ip_stream))
- {
- nSoapVersion = m_pDZ->GetVersion();
- nSoapVersion = (nSoapVersion == VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
- m_pSZ->setSoapVersion((SOAP_VERSION)nSoapVersion);
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SOAPCONTENTERROR));
- break; //do .. while(0)
- }
-
- const char* cService = get_header(soap, SOAPACTIONHEADER);
- if (!cService) //get from URL if http
- {
- cService = get_service_from_uri(soap);
- }
- AxisString service = (cService == NULL)? "" : cService;
- //AxisUtils::convert(service, (cService == NULL)? "" : cService);
-
-// AXISTRACE2("string service = ",service.c_str());
-
- if (service.empty())
- {
- nSoapVersion = pMsg->m_pDZ->GetVersion();
- nSoapVersion = (nSoapVersion == VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
- m_pSZ->setSoapVersion((SOAP_VERSION)nSoapVersion);
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SOAPACTIONEMPTY));
- break; //do .. while(0)
- }
- if (service.find('\"') != string::npos) //if there are quotes remove them.
- {
- service = service.substr(1, service.length() - 2);
- }
-
- //get service description object from the WSDD
- pService = g_pWSDDDeployment->GetService(service.c_str());
- if (!pService)
- {
- nSoapVersion = pMsg->m_pDZ->GetVersion();
- nSoapVersion = (nSoapVersion == VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
- m_pSZ->setSoapVersion((SOAP_VERSION)nSoapVersion);
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SERVICENOTFOUND));
- break; //do .. while(0)
- }
-
- pMsg->SetService(pService);
-
- //check for soap version in the request and decide whether we support it or not
- //if we do not support send a soapfault with version mismatch.
- nSoapVersion = pMsg->m_pDZ->GetVersion();
- if (nSoapVersion == VERSION_LAST) //version not supported
- {
- m_pSZ->setSoapVersion(SOAP_VER_1_2);
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_VERSION_MISMATCH));
- break; //do .. while(0)
- }
-
-
- //Set Soap version in the Serializer and the envelope
- if (SUCCESS != m_pSZ->setSoapVersion((SOAP_VERSION)nSoapVersion))
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SOAPCONTENTERROR));
- break; //do .. while(0)
- }
-
- SoapMethod* pSm = m_pDZ->GetMethod();
- if (pSm)
- {
- const AxisChar* pMethod = pSm->getMethodName();
-// AXISTRACE2("pSm->getMethodName(); :", pMethod);
- if (pMethod)
- {
- if (pService->IsAllowedMethod(pMethod))
- {
- //load actual web service handler
- if (SUCCESS != g_pHandlerPool->GetWebService(&m_pWebService, sSessionId, pService))
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADSRV));
- //Error couldnot load web service
- break; //do .. while(0)
- }
- }
- else
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_METHODNOTALLOWED));
- //method is not an exposed allowed method
- break; //do .. while(0)
- }
- }
- else
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_NOSOAPMETHOD));
- //no method to be invoked
- break; //do .. while(0)
- }
- }
- //Get Global and Transport Handlers
- if(SUCCESS != (Status = InitializeHandlers(sSessionId, soap->trtype)))
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADHDL));
- break; //do .. while(0)
- }
- //Get Service specific Handlers from the pool if configured any
- if(SUCCESS != (Status = g_pHandlerPool->GetRequestFlowHandlerChain(&m_pSReqFChain, sSessionId, pService)))
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADHDL));
- break; //do .. while(0)
- }
- if(SUCCESS != (Status = g_pHandlerPool->GetResponseFlowHandlerChain(&m_pSResFChain, sSessionId, pService)))
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADHDL));
- break; //do .. while(0)
- }
-
- //and handlers may add headers to the Serializer.
- //Invoke all handlers including the webservice
- //in case of failure coresponding soap fault message will be set
- Status = Invoke(pMsg); //we generate response in the same way even if this has failed
- }
- while(0);
- if (pMsg) delete pMsg; //MessageData is no longer needed
- //send any transoport information like http headers first
- send_transport_information(soap);
- //Serialize
- m_pSZ->SetOutputStream(soap->str.op_stream);
-
- //Pool back the Service specific handlers
- if (m_pSReqFChain) g_pHandlerPool->PoolHandlerChain(m_pSReqFChain, sSessionId);
- if (m_pSResFChain) g_pHandlerPool->PoolHandlerChain(m_pSResFChain, sSessionId);
- //Pool back the webservice
- if (m_pWebService) g_pHandlerPool->PoolWebService(sSessionId, m_pWebService, pService);
- return Status;
- AXIS_CATCH(exception* e)
- //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 AxisEngine
- from the webserver and report the error. You can also write this
- in a logfile specific to axis.
- */
- #ifdef _AXISTRACE
-// AXISTRACE1(e->what());
- delete(e);
- #endif
- AXIS_CATCH(...)
- //todo
- /*
- An unknown exception which is not handled will be handled here.
- You can call a method in AxisModule which may unload the AxisEngine
- from the webserver and report the error. You can also write this
- in a logfile specific to axis.
- */
-// AXISTRACE1("UNKNOWN EXCEPTION");
- AXIS_ENDCATCH
- return Status;
-}
-
-int AxisEngine::Invoke(MessageData* pMsg)
-{
- enum AE_LEVEL {AE_START=1, AE_TRH, AE_GLH, AE_SERH, AE_SERV};
- int Status = FAIL;
- int level = AE_START;
- do
- {
- //invoke transport request handlers
- if (m_pTReqFChain) {
- if(SUCCESS != (Status = m_pTReqFChain->Invoke(pMsg)))
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_HANDLERFAILED));
- break; //do .. while (0)
- }
-
- }
-// AXISTRACE1("AFTER invoke transport request handlers");
- level++; // AE_TRH
- //invoke global request handlers
- if (m_pGReqFChain)
- {
- if(SUCCESS != (Status = m_pGReqFChain->Invoke(pMsg)))
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_HANDLERFAILED));
- break; //do .. while (0)
- }
- }
-// AXISTRACE1("AFTER invoke global request handlers");
- level++; //AE_GLH
- //invoke service specific request handlers
- if (m_pSReqFChain)
- {
- if(SUCCESS != (Status = m_pSReqFChain->Invoke(pMsg)))
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_HANDLERFAILED));
- break; //do .. while (0)
- }
- }
-// AXISTRACE1("AFTER invoke service specific request handlers");
- level++; //AE_SERH
- //call actual web service handler
- if (m_pWebService)
- {
- if (SUCCESS != (Status = m_pWebService->Invoke(pMsg)))
- {
- m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_WEBSERVICEFAILED));
- break;
- }
- }
-// AXISTRACE1("AFTER call actual web service handler");
- level++; //AE_SERV
- }
- while(0);
-
- pMsg->setPastPivotState(true);
-
- switch (level)
- {
- case AE_SERV: //everything success
- Status = 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
- };
-// AXISTRACE1("end axisengine process()");
- return Status;
-}
-
-void AxisEngine::OnFault(MessageData* pMsg)
-{
-
+ if (m_pMsgData) delete m_pMsgData;
}
int AxisEngine::Initialize()
{
int Status;
+ m_pMsgData = new MessageData();
+ if (!m_pMsgData) return FAIL;
//Create and initialize Serializer and Deserializer objects
if (SUCCESS != (Status = g_pSerializerPool->GetInstance(&m_pSZ))) return Status;
if (SUCCESS != (Status = g_pDeserializerPool->GetInstance(&m_pDZ))) return Status;
+ m_pMsgData->SetSerializer(m_pSZ);
+ m_pMsgData->SetDeSerializer(m_pDZ);
return SUCCESS;
}
void AxisEngine::UnInitialize()
{
+ if (m_pMsgData)
+ {
+ delete m_pMsgData;
+ m_pMsgData = NULL;
+ }
//nothing to do with m_pWSDD because its destructor deletes its objects
//nothing to do with m_pHandlerPool because its destructor deletes its objects
}
1.6 +10 -10 xml-axis/c/src/engine/AxisEngine.h
Index: AxisEngine.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/engine/AxisEngine.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AxisEngine.h 13 Aug 2003 14:07:47 -0000 1.5
+++ AxisEngine.h 11 Sep 2003 10:42:48 -0000 1.6
@@ -76,7 +76,7 @@
class AxisEngine
{
-private:
+protected:
SoapSerializer* m_pSZ;
SoapDeSerializer* m_pDZ;
HandlerChain* m_pGReqFChain;
@@ -85,17 +85,17 @@
HandlerChain* m_pTResFChain;
HandlerChain* m_pSReqFChain;
HandlerChain* m_pSResFChain;
- BasicHandler* m_pWebService;
+ MessageData* m_pMsgData;
public:
AxisEngine();
- ~AxisEngine();
- int Process(Ax_soapstream* soap);
-private:
- int Invoke(MessageData* pMsg);
- void OnFault(MessageData* pMsg);
- int Initialize();
- int InitializeHandlers(string& sSessionId, AXIS_PROTOCOL_TYPE protocol);
- void UnInitialize();
+ virtual ~AxisEngine();
+ virtual int Initialize();
+ virtual void UnInitialize();
+ virtual int Process(Ax_soapstream* soap)=0;
+protected:
+ virtual int Invoke(MessageData* pMsg)=0;
+ virtual void OnFault(MessageData* pMsg)=0;
+ virtual int InitializeHandlers(string& sSessionId, AXIS_PROTOCOL_TYPE protocol);
};
#endif
1.1 xml-axis/c/src/engine/ClientAxisEngine.cpp
Index: ClientAxisEngine.cpp
===================================================================
// ClientAxisEngine.cpp: implementation of the ClientAxisEngine class.
//
//////////////////////////////////////////////////////////////////////
#include "ClientAxisEngine.h"
#include "../wsdd/WSDDDeployment.h"
#include "HandlerPool.h"
extern WSDDDeployment* g_pWSDDDeployment;
extern HandlerPool* g_pHandlerPool;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ClientAxisEngine::ClientAxisEngine()
{
}
ClientAxisEngine::~ClientAxisEngine()
{
}
MessageData* ClientAxisEngine::GetMessageData()
{
return m_pMsgData;
}
int ClientAxisEngine::Process(Ax_soapstream* soap)
{
int Status;
const WSDDService* pService = NULL;
string sSessionId = soap->sessionid;
int nSoapVersion;
do {
//populate MessageData with transport information
m_pMsgData->m_Protocol = soap->trtype;
const char* cService = get_header(soap, SOAPACTIONHEADER);
if (!cService) //get from URL if http
{
cService = get_service_from_uri(soap);
}
AxisString service = (cService == NULL)? "" : cService;
//AxisUtils::convert(service, (cService == NULL)? "" : cService);
// AXISTRACE2("string service = ",service.c_str());
if (service.empty())
{
break; //do .. while(0)
}
if (service.find('\"') != string::npos) //if there are quotes remove them.
{
service = service.substr(1, service.length() - 2);
}
//get service description object from the WSDD
pService = g_pWSDDDeployment->GetService(service.c_str());
if (!pService)
{
break; //do .. while(0)
}
m_pMsgData->SetService(pService);
//Get Global and Transport Handlers
if(SUCCESS != (Status = InitializeHandlers(sSessionId, soap->trtype)))
{
break; //do .. while(0)
}
//Get Service specific Handlers from the pool if configured any
if(SUCCESS != (Status = g_pHandlerPool->GetRequestFlowHandlerChain(&m_pSReqFChain, sSessionId, pService)))
{
break; //do .. while(0)
}
if(SUCCESS != (Status = g_pHandlerPool->GetResponseFlowHandlerChain(&m_pSResFChain, sSessionId, pService)))
{
break; //do .. while(0)
}
//and handlers may add headers to the Serializer.
//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);
//Pool back the Service specific handlers
if (m_pSReqFChain) 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);
return Status;
}
int ClientAxisEngine::Invoke(MessageData* pMsg)
{
enum AE_LEVEL {AE_START=1, AE_TRH, AE_GLH, AE_SERH, AE_SERV};
int Status = FAIL;
int level = AE_START;
do
{
//invoke client side service specific request handlers
if (m_pSReqFChain)
{
if(SUCCESS != (Status = m_pSReqFChain->Invoke(pMsg)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_CLIENTHANDLERFAILED));
break; //do .. while (0)
}
}
// AXISTRACE1("AFTER invoke service specific request handlers");
level++; //AE_SERH //invoke transport request handlers
//invoke global request handlers
if (m_pGReqFChain)
{
if(SUCCESS != (Status = m_pGReqFChain->Invoke(pMsg)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_CLIENTHANDLERFAILED));
break; //do .. while (0)
}
}
// AXISTRACE1("AFTER invoke global request handlers");
level++; //AE_GLH
if (m_pTReqFChain) {
if(SUCCESS != (Status = m_pTReqFChain->Invoke(pMsg)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_CLIENTHANDLERFAILED));
break; //do .. while (0)
}
}
// AXISTRACE1("AFTER invoke transport request handlers");
level++; // AE_TRH
}
while(0);
/*
send_transport_information(soap);
//Serialize and send to server
m_pSZ->SetOutputStream(soap->str.op_stream);
pMsg->setPastPivotState(true);
receive_transport_information(&soap);
//receive response from the server and Deserialize
m_pDZ->SetInputStream(soap->str.ip_stream);
*/
switch (level)
{
case AE_SERV: //everything success
Status = 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
};
// AXISTRACE1("end axisengine process()");
return Status;
}
void ClientAxisEngine::OnFault(MessageData* pMsg)
{
}
1.1 xml-axis/c/src/engine/ClientAxisEngine.h
Index: ClientAxisEngine.h
===================================================================
// ClientAxisEngine.h: interface for the ClientAxisEngine class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CLIENTAXISENGINE_H__4DA1EBC5_C7D8_4747_8069_C3E8B6A2E929__INCLUDED_)
#define AFX_CLIENTAXISENGINE_H__4DA1EBC5_C7D8_4747_8069_C3E8B6A2E929__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "AxisEngine.h"
class ClientAxisEngine : public AxisEngine
{
public:
MessageData* GetMessageData();
ClientAxisEngine();
virtual ~ClientAxisEngine();
virtual int Process(Ax_soapstream* soap);
protected:
virtual int Invoke(MessageData* pMsg);
virtual void OnFault(MessageData* pMsg);
};
#endif // !defined(AFX_CLIENTAXISENGINE_H__4DA1EBC5_C7D8_4747_8069_C3E8B6A2E929__INCLUDED_)
1.1 xml-axis/c/src/engine/ServerAxisEngine.cpp
Index: ServerAxisEngine.cpp
===================================================================
// ServerAxisEngine.cpp: implementation of the ServerAxisEngine class.
//
//////////////////////////////////////////////////////////////////////
#include "ServerAxisEngine.h"
#include <stdio.h>
#include "../common/AxisException.h"
//#include "../common/AxisTrace.h"
#include "../common/AxisUtils.h"
#include "../wsdd/WSDDDeployment.h"
#include "HandlerPool.h"
extern HandlerPool* g_pHandlerPool;
extern WSDDDeployment* g_pWSDDDeployment;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ServerAxisEngine::ServerAxisEngine()
{
m_pWebService = NULL;
}
ServerAxisEngine::~ServerAxisEngine()
{
}
int ServerAxisEngine::Process(Ax_soapstream* soap)
{
int Status;
AXIS_TRY
// AXISTRACE1("ServerAxisEngine::Process");
const WSDDService* pService = NULL;
string sSessionId = soap->sessionid;
int nSoapVersion;
do {
//populate MessageData with transport information
m_pMsgData->m_Protocol = soap->trtype;
if (SUCCESS != m_pDZ->SetInputStream(soap->str.ip_stream))
{
nSoapVersion = m_pDZ->GetVersion();
nSoapVersion = (nSoapVersion == VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
m_pSZ->setSoapVersion((SOAP_VERSION)nSoapVersion);
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SOAPCONTENTERROR));
break; //do .. while(0)
}
const char* cService = get_header(soap, SOAPACTIONHEADER);
if (!cService) //get from URL if http
{
cService = get_service_from_uri(soap);
}
AxisString service = (cService == NULL)? "" : cService;
//AxisUtils::convert(service, (cService == NULL)? "" : cService);
// AXISTRACE2("string service = ",service.c_str());
if (service.empty())
{
nSoapVersion = m_pMsgData->m_pDZ->GetVersion();
nSoapVersion = (nSoapVersion == VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
m_pSZ->setSoapVersion((SOAP_VERSION)nSoapVersion);
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SOAPACTIONEMPTY));
break; //do .. while(0)
}
if (service.find('\"') != string::npos) //if there are quotes remove them.
{
service = service.substr(1, service.length() - 2);
}
//get service description object from the WSDD
pService = g_pWSDDDeployment->GetService(service.c_str());
if (!pService)
{
nSoapVersion = m_pMsgData->m_pDZ->GetVersion();
nSoapVersion = (nSoapVersion == VERSION_LAST) ? SOAP_VER_1_2 : nSoapVersion;
m_pSZ->setSoapVersion((SOAP_VERSION)nSoapVersion);
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SERVICENOTFOUND));
break; //do .. while(0)
}
m_pMsgData->SetService(pService);
//check for soap 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_pMsgData->m_pDZ->GetVersion();
if (nSoapVersion == VERSION_LAST) //version not supported
{
m_pSZ->setSoapVersion(SOAP_VER_1_2);
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_VERSION_MISMATCH));
break; //do .. while(0)
}
//Set Soap version in the Serializer and the envelope
if (SUCCESS != m_pSZ->setSoapVersion((SOAP_VERSION)nSoapVersion))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_SOAPCONTENTERROR));
break; //do .. while(0)
}
SoapMethod* pSm = m_pDZ->GetMethod();
if (pSm)
{
const AxisChar* pMethod = pSm->getMethodName();
// AXISTRACE2("pSm->getMethodName(); :", pMethod);
if (pMethod)
{
if (pService->IsAllowedMethod(pMethod))
{
//load actual web service handler
if (SUCCESS != g_pHandlerPool->GetWebService(&m_pWebService, sSessionId, pService))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADSRV));
//Error couldnot load web service
break; //do .. while(0)
}
}
else
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_METHODNOTALLOWED));
//method is not an exposed allowed method
break; //do .. while(0)
}
}
else
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_NOSOAPMETHOD));
//no method to be invoked
break; //do .. while(0)
}
}
//Get Global and Transport Handlers
if(SUCCESS != (Status = InitializeHandlers(sSessionId, soap->trtype)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADHDL));
break; //do .. while(0)
}
//Get Service specific Handlers from the pool if configured any
if(SUCCESS != (Status = g_pHandlerPool->GetRequestFlowHandlerChain(&m_pSReqFChain, sSessionId, pService)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADHDL));
break; //do .. while(0)
}
if(SUCCESS != (Status = g_pHandlerPool->GetResponseFlowHandlerChain(&m_pSResFChain, sSessionId, pService)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_COULDNOTLOADHDL));
break; //do .. while(0)
}
//and handlers may add headers to the Serializer.
//Invoke all handlers including the webservice
//in case of failure coresponding soap fault message will be set
Status = Invoke(m_pMsgData); //we generate response in the same way even if this has failed
}
while(0);
//send any transoport information like http headers first
send_transport_information(soap);
//Serialize
m_pSZ->SetOutputStream(soap->str.op_stream);
//Pool back the Service specific handlers
if (m_pSReqFChain) 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);
//Pool back the webservice
if (m_pWebService) g_pHandlerPool->PoolWebService(sSessionId, m_pWebService, pService);
return Status;
AXIS_CATCH(exception* e)
//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.
*/
#ifdef _AXISTRACE
// AXISTRACE1(e->what());
delete(e);
#endif
AXIS_CATCH(...)
//todo
/*
An unknown 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.
*/
// AXISTRACE1("UNKNOWN EXCEPTION");
AXIS_ENDCATCH
return Status;
}
int ServerAxisEngine::Invoke(MessageData* pMsg)
{
enum AE_LEVEL {AE_START=1, AE_TRH, AE_GLH, AE_SERH, AE_SERV};
int Status = FAIL;
int level = AE_START;
do
{
//invoke transport request handlers
if (m_pTReqFChain) {
if(SUCCESS != (Status = m_pTReqFChain->Invoke(pMsg)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_HANDLERFAILED));
break; //do .. while (0)
}
}
// AXISTRACE1("AFTER invoke transport request handlers");
level++; // AE_TRH
//invoke global request handlers
if (m_pGReqFChain)
{
if(SUCCESS != (Status = m_pGReqFChain->Invoke(pMsg)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_HANDLERFAILED));
break; //do .. while (0)
}
}
// AXISTRACE1("AFTER invoke global request handlers");
level++; //AE_GLH
//invoke service specific request handlers
if (m_pSReqFChain)
{
if(SUCCESS != (Status = m_pSReqFChain->Invoke(pMsg)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_HANDLERFAILED));
break; //do .. while (0)
}
}
// AXISTRACE1("AFTER invoke service specific request handlers");
level++; //AE_SERH
//call actual web service handler
if (m_pWebService)
{
if (SUCCESS != (Status = m_pWebService->Invoke(pMsg)))
{
m_pSZ->setSoapFault(SoapFault::getSoapFault(SF_WEBSERVICEFAILED));
break;
}
}
// AXISTRACE1("AFTER call actual web service handler");
level++; //AE_SERV
}
while(0);
pMsg->setPastPivotState(true);
switch (level)
{
case AE_SERV: //everything success
Status = 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
};
// AXISTRACE1("end axisengine process()");
return Status;
}
void ServerAxisEngine::OnFault(MessageData* pMsg)
{
}
1.1 xml-axis/c/src/engine/ServerAxisEngine.h
Index: ServerAxisEngine.h
===================================================================
// ServerAxisEngine.h: interface for the ServerAxisEngine class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SERVERAXISENGINE_H__8E421346_17A9_47EF_9003_6DC9C6F7787A__INCLUDED_)
#define AFX_SERVERAXISENGINE_H__8E421346_17A9_47EF_9003_6DC9C6F7787A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "AxisEngine.h"
class ServerAxisEngine : public AxisEngine
{
private:
BasicHandler* m_pWebService;
public:
ServerAxisEngine();
virtual ~ServerAxisEngine();
public:
int Process(Ax_soapstream* soap);
protected:
virtual int Invoke(MessageData* pMsg);
virtual void OnFault(MessageData* pMsg);
};
#endif // !defined(AFX_SERVERAXISENGINE_H__8E421346_17A9_47EF_9003_6DC9C6F7787A__INCLUDED_)
1.4 +5 -5 xml-axis/c/src/server/samples/cppservicewrapper/CPPServiceWrapper.cpp
Index: CPPServiceWrapper.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/server/samples/cppservicewrapper/CPPServiceWrapper.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CPPServiceWrapper.cpp 5 Sep 2003 10:48:50 -0000 1.3
+++ CPPServiceWrapper.cpp 11 Sep 2003 10:42:48 -0000 1.4
@@ -2,7 +2,7 @@
//Web service wrapper class's implementation generated by Axis WCG
#include "CPPServiceWrapper.hpp"
-//Parameters and wrapper methos to manipulate Point
+//Parameters and wrapper methods to manipulate Point
static const AxisChar* Axis_URI_Point = "http://www.opensource.lk/Point";
static const AxisChar* Axis_TypeName_Point = "Point";
@@ -195,7 +195,7 @@
uParamValue value;
value.dValue = ret;
- IParam* pRetParam = pIWSSZ->setResponseParam(XSD_DOUBLE, value);
+ IParam* pRetParam = pIWSSZ->AddOutputParam(XSD_DOUBLE, value);
pRetParam->SetName("DistanceReturn");
return SUCCESS;
}
@@ -225,7 +225,7 @@
//Call actual web service method with appropriate parameters
Point* ret = pWs->AddPoint(v0, v1);
- IParam* pRetParam = pIWSSZ->setResponseParam(ret, (AXIS_SERIALIZE_FUNCT)Axis_Serialize_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point);
+ IParam* pRetParam = pIWSSZ->AddOutputParam(ret, (AXIS_SERIALIZE_FUNCT)Axis_Serialize_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point);
pRetParam->SetName("AddPointReturn");
return SUCCESS;
}
@@ -251,7 +251,7 @@
uParamValue value;
value.nValue = ret;
- IParam* pRetParam = pIWSSZ->setResponseParam(XSD_INT, value);
+ IParam* pRetParam = pIWSSZ->AddOutputParam(XSD_INT, value);
pRetParam->SetName("AddReturn");
return SUCCESS;
}
@@ -277,7 +277,7 @@
uParamValue value;
value.dValue = ret;
- IParam* pRetParam = pIWSSZ->setResponseParam(XSD_DOUBLE, value);
+ IParam* pRetParam = pIWSSZ->AddOutputParam(XSD_DOUBLE, value);
pRetParam->SetName("PerimeterReturn");
return SUCCESS;
}
1.4 +4 -4 xml-axis/c/src/server/samples/cservicewrapper/CServiceWrapper.cpp
Index: CServiceWrapper.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/server/samples/cservicewrapper/CServiceWrapper.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CServiceWrapper.cpp 5 Sep 2003 10:48:50 -0000 1.3
+++ CServiceWrapper.cpp 11 Sep 2003 10:42:48 -0000 1.4
@@ -201,7 +201,7 @@
uParamValue value;
value.dValue = ret;
- IParam* pRetParam = pIWSSZ->setResponseParam(XSD_DOUBLE, value);
+ IParam* pRetParam = pIWSSZ->AddOutputParam(XSD_DOUBLE, value);
pRetParam->SetName("DistanceReturn");
return SUCCESS;
}
@@ -231,7 +231,7 @@
//Call actual web service method with appropriate parameters
Point* ret = AddPoint(v0, v1);
- IParam* pRetParam = pIWSSZ->setResponseParam(ret, (AXIS_SERIALIZE_FUNCT)Axis_Serialize_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point);
+ IParam* pRetParam = pIWSSZ->AddOutputParam(ret, (AXIS_SERIALIZE_FUNCT)Axis_Serialize_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point);
pRetParam->SetName("AddPointReturn");
return SUCCESS;
}
@@ -257,7 +257,7 @@
uParamValue value;
value.nValue = ret;
- IParam* pRetParam = pIWSSZ->setResponseParam(XSD_INT, value);
+ IParam* pRetParam = pIWSSZ->AddOutputParam(XSD_INT, value);
pRetParam->SetName("AddReturn");
return SUCCESS;
}
@@ -283,7 +283,7 @@
uParamValue value;
value.dValue = ret;
- IParam* pRetParam = pIWSSZ->setResponseParam(XSD_DOUBLE, value);
+ IParam* pRetParam = pIWSSZ->AddOutputParam(XSD_DOUBLE, value);
pRetParam->SetName("PerimeterReturn");
return SUCCESS;
}
1.14 +5 -7 xml-axis/c/src/server/samples/webservicewrapper/WebServiceWrapper.cpp
Index: WebServiceWrapper.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/server/samples/webservicewrapper/WebServiceWrapper.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- WebServiceWrapper.cpp 5 Sep 2003 10:48:50 -0000 1.13
+++ WebServiceWrapper.cpp 11 Sep 2003 10:42:48 -0000 1.14
@@ -183,7 +183,7 @@
value.pStrValue = strRet.c_str();
IWrapperSoapSerializer* pIWSz;
mc->getSoapSerializer(&pIWSz);
- IParam* pRetParam = pIWSz->setResponseParam(XSD_STRING, value);
+ IParam* pRetParam = pIWSz->AddOutputParam(XSD_STRING, value);
pRetParam->SetName("EchoReturn");
return SUCCESS;
}
@@ -204,7 +204,7 @@
value.nValue = ret;
IWrapperSoapSerializer* pIWSz;
mc->getSoapSerializer(&pIWSz);
- IParam* pRetParam = pIWSz->setResponseParam(XSD_INT, value);
+ IParam* pRetParam = pIWSz->AddOutputParam(XSD_INT, value);
pRetParam->SetName("AddReturn");
return SUCCESS;
}
@@ -233,7 +233,7 @@
pAb->SetItemName("item");
uParamValue value;
value.pIArray = pAb;
- IParam* pRetParam = pIWSz->setResponseParam(XSD_ARRAY, value);
+ IParam* pRetParam = pIWSz->AddOutputParam(XSD_ARRAY, value);
pRetParam->SetName("EchoIntArrayReturn");
return SUCCESS;
}
@@ -263,7 +263,7 @@
//Call actual web service method with appropriate parameters
Point* ret = pWs->AddPoint(v0, v1);
- IParam* pRetParam = pIWSSZ->setResponseParam(ret, (AXIS_SERIALIZE_FUNCT)Axis_Serialize_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point);
+ IParam* pRetParam = pIWSSZ->AddOutputParam(ret, (AXIS_SERIALIZE_FUNCT)Axis_Serialize_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point);
pRetParam->SetName("AddPointReturn");
return SUCCESS;
}
@@ -286,9 +286,7 @@
pAb->SetItemName("item");
pAb->SetTypeName("Point");
pAb->SetUri("http://www.opensource.lk/Point");
- uParamValue value;
- value.pIArray = pAb;
- IParam* pRetParam = pIWSz->setResponseParam(pAb);
+ IParam* pRetParam = pIWSz->AddOutputParam(pAb);
pRetParam->SetName("EchoPointArrayReturn");
return SUCCESS;
}
1.5 +2 -1 xml-axis/c/src/soap/SoapFaults.h
Index: SoapFaults.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapFaults.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SoapFaults.h 13 Aug 2003 14:11:10 -0000 1.4
+++ SoapFaults.h 11 Sep 2003 10:42:48 -0000 1.5
@@ -98,6 +98,7 @@
SF_NOSOAPMETHOD,
SF_METHODNOTALLOWED,
SF_PARATYPEMISMATCH,
+ SF_CLIENTHANDLERFAILED,
//Server faults
SF_COULDNOTLOADSRV,
@@ -131,7 +132,7 @@
/*SF_NOSOAPMETHOD*/ {"Client", "No method to invoke", "none", ""},
/*SF_METHODNOTALLOWED*/ {"Client", "Soap method is not allowed to invoke", "none", ""},
/*SF_PARATYPEMISMATCH*/ {"Client", "Parameter type mismatch", "none", ""},
-
+ /*SF_CLIENTHANDLERFAILED*/{"Client", "A client handler failed", "none", ""},
//Server faults
/*SF_COULDNOTLOADSRV*/ {"Server", "Cannot load web service", "none", ""},
1.11 +22 -11 xml-axis/c/src/soap/SoapMethod.cpp
Index: SoapMethod.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapMethod.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- SoapMethod.cpp 2 Sep 2003 12:03:49 -0000 1.10
+++ SoapMethod.cpp 11 Sep 2003 10:42:48 -0000 1.11
@@ -75,23 +75,26 @@
SoapMethod::SoapMethod()
{
- m_pOutputParam = NULL;
}
SoapMethod::~SoapMethod()
{
- list<Param*>::iterator itCurrInputParam= m_inputParams.begin();
+ list<Param*>::iterator itParam= m_InputParams.begin();
- while(itCurrInputParam != m_inputParams.end()) {
- delete *itCurrInputParam;
- itCurrInputParam++;
+ while(itParam != m_InputParams.end()) {
+ delete *itParam;
+ itParam++;
}
- m_inputParams.clear();
+ m_InputParams.clear();
for (list<Attribute*>::iterator it = m_attributes.begin(); it != m_attributes.end(); it++)
{
delete (*it);
}
- if (m_pOutputParam) delete m_pOutputParam;
+ for (itParam = m_OutputParams.begin(); itParam != m_OutputParams.end(); itParam++)
+ {
+ delete (*itParam);
+ }
+ m_OutputParams.clear();
}
void SoapMethod::setPrefix(const AxisChar* prefix)
@@ -111,14 +114,14 @@
void SoapMethod::addInputParam(Param *param)
{
- m_inputParams.push_back(param);
+ m_InputParams.push_back(param);
}
-void SoapMethod::setOutputParam(Param *param)
+void SoapMethod::AddOutputParam(Param *param)
{
if (param)
{
- m_pOutputParam = param;
+ m_OutputParams.push_back(param);
}
}
@@ -221,7 +224,15 @@
int SoapMethod::serializeOutputParam(SoapSerializer& pSZ)
{
- return m_pOutputParam->serialize(pSZ);
+ int nStatus;
+ for (list<Param*>::iterator it = m_OutputParams.begin(); it != m_OutputParams.end(); it++)
+ {
+ if (SUCCESS != (nStatus = (*it)->serialize(pSZ)))
+ {
+ return nStatus;
+ }
+ }
+ return SUCCESS;
}
/*
1.10 +3 -3 xml-axis/c/src/soap/SoapMethod.h
Index: SoapMethod.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapMethod.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SoapMethod.h 2 Sep 2003 12:03:49 -0000 1.9
+++ SoapMethod.h 11 Sep 2003 10:42:48 -0000 1.10
@@ -110,8 +110,8 @@
AxisString m_strPrefix;
AxisString m_strLocalname;
AxisString m_strUri;
- list<Param*> m_inputParams;
- Param* m_pOutputParam;
+ list<Param*> m_InputParams;
+ list<Param*> m_OutputParams;
//string m_strMethodSerialized;
//test line
@@ -120,7 +120,7 @@
const AxisChar* getMethodName();
int serialize(SoapSerializer& pSZ);
//int serialize(string&);
- void setOutputParam(Param *param);
+ void AddOutputParam(Param *param);
void addInputParam(Param* param);
void setUri(const AxisChar* uri);
void setLocalName(const AxisChar* localname);
1.20 +6 -6 xml-axis/c/src/soap/SoapSerializer.cpp
Index: SoapSerializer.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapSerializer.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- SoapSerializer.cpp 9 Sep 2003 12:53:01 -0000 1.19
+++ SoapSerializer.cpp 11 Sep 2003 10:42:48 -0000 1.20
@@ -144,30 +144,30 @@
return intStatus;
}
-IParam* SoapSerializer::setResponseParam(XSDTYPE nType, uParamValue Value)
+IParam* SoapSerializer::AddOutputParam(XSDTYPE nType, uParamValue Value)
{
Param* pParam = new Param();
pParam->SetValue(nType, Value);
if(m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody) && (m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod))
{
- m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->setOutputParam(pParam);
+ m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->AddOutputParam(pParam);
}
return pParam;
}
-IParam* SoapSerializer::setResponseParam(IArrayBean* pArrayBean)
+IParam* SoapSerializer::AddOutputParam(IArrayBean* pArrayBean)
{
Param* pParam = new Param();
pParam->m_Value.pIArray = pArrayBean;
pParam->m_Type = XSD_ARRAY;
if(m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody) && (m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod))
{
- m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->setOutputParam(pParam);
+ m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->AddOutputParam(pParam);
}
return pParam;
}
-IParam* SoapSerializer::setResponseParam(void* pObject, void* pSZFunct, void* pDelFunct)
+IParam* SoapSerializer::AddOutputParam(void* pObject, void* pSZFunct, void* pDelFunct)
{
Param* pParam = new Param();
pParam->m_Value.pCplxObj = new ComplexObjectHandler;
@@ -176,7 +176,7 @@
pParam->m_Value.pCplxObj->pDelFunct = (AXIS_OBJECT_DELETE_FUNCT)pDelFunct;
if(m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody) && (m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod))
{
- m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->setOutputParam(pParam);
+ m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->AddOutputParam(pParam);
}
return pParam;
}
1.17 +3 -3 xml-axis/c/src/soap/SoapSerializer.h
Index: SoapSerializer.h
===================================================================
RCS file: /home/cvs/xml-axis/c/src/soap/SoapSerializer.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- SoapSerializer.h 5 Sep 2003 10:48:51 -0000 1.16
+++ SoapSerializer.h 11 Sep 2003 10:42:48 -0000 1.17
@@ -109,9 +109,9 @@
int setSoapEnvelope(SoapEnvelope* pSoapEnvelope);
SoapSerializer();
virtual ~SoapSerializer();
- IParam* setResponseParam(XSDTYPE nType, uParamValue Value);
- IParam* setResponseParam(IArrayBean* pArrayBean);
- IParam* setResponseParam(void* pObject, void* pDZFunct, void* pDelFunct);
+ IParam* AddOutputParam(XSDTYPE nType, uParamValue Value);
+ IParam* AddOutputParam(IArrayBean* pArrayBean);
+ IParam* AddOutputParam(void* pObject, void* pDZFunct, void* pDelFunct);
IArrayBean* makeArrayBean(XSDTYPE nType, void* pArray);
IArrayBean* makeArrayBean(void* pObject, void* pSZFunct, void* pDelFunct, void* pSizeFunct);
public: //Basic Type Serializing methods
1.10 +2 -2 xml-axis/c/src/wcg/Method.cpp
Index: Method.cpp
===================================================================
RCS file: /home/cvs/xml-axis/c/src/wcg/Method.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Method.cpp 5 Sep 2003 10:48:51 -0000 1.9
+++ Method.cpp 11 Sep 2003 10:42:48 -0000 1.10
@@ -186,7 +186,7 @@
file << endl;
if (m_pReturnType->IsComplexType())
{
- file << "\tIParam* pRetParam = pIWSSZ->setResponseParam(ret, (AXIS_SERIALIZE_FUNCT)Axis_Serialize_" <<
+ file << "\tIParam* pRetParam = pIWSSZ->AddOutputParam(ret, (AXIS_SERIALIZE_FUNCT)Axis_Serialize_" <<
m_pReturnType->GetTypeName() << ", (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_" << m_pReturnType->GetTypeName() << ");" << endl;
}
else
@@ -198,7 +198,7 @@
file << ".c_str()";
}
file << ";" << endl;
- file << "\tIParam* pRetParam = pIWSSZ->setResponseParam(" << m_pReturnType->GetTypeEnumStr() << ", value);" << endl;
+ file << "\tIParam* pRetParam = pIWSSZ->AddOutputParam(" << m_pReturnType->GetTypeEnumStr() << ", value);" << endl;
}
file << "\tpRetParam->SetName(\"" << m_Name << "Return\");" << endl;
file << "\treturn SUCCESS;" << endl;