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 da...@apache.org on 2004/05/24 07:44:20 UTC
cvs commit: ws-axis/c/src/soap SoapBody.cpp SoapDeSerializer.cpp SoapEnvelope.cpp SoapFault.cpp SoapFault.h SoapSerializer.cpp
damitha 2004/05/23 22:44:20
Modified: c/include/axis/client Call.h
c/include/axis/server AxisException.h AxisTrace.h
IWrapperSoapDeSerializer.h Param.h
SoapDeSerializer.h
c/samples/client/rpcfault Makefile.am MathOps.cpp MathOps.h
MathOpsClient.cpp SOAPStructFault.h
c/samples/server/rpcfault AxisDivByZeroException.cpp
MathOps.wsdl MathOpsWrapper.cpp SOAPStructFault.cpp
SOAPStructFault.h
c/src/common AxisConfig.cpp AxisTrace.cpp Makefile.am
c/src/engine Axis.cpp
c/src/engine/client Call.cpp
c/src/engine/server ServerAxisEngine.cpp ServerAxisEngine.h
c/src/soap SoapBody.cpp SoapDeSerializer.cpp
SoapEnvelope.cpp SoapFault.cpp SoapFault.h
SoapSerializer.cpp
Log:
exception handling and fault mapping related work
Revision Changes Path
1.14 +14 -0 ws-axis/c/include/axis/client/Call.h
Index: Call.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/client/Call.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Call.h 12 May 2004 07:36:46 -0000 1.13
+++ Call.h 24 May 2004 05:44:19 -0000 1.14
@@ -185,6 +185,9 @@
int (AXISCALL* checkMessage)(void *pObj, const AxisChar* pName,
const AxisChar* pNamespace);
+
+ int (AXISCALL* checkFault)(void *pObj, const AxisChar* pName,
+ const AxisChar* pNamespace);
/* Minimal error check */
int (AXISCALL* getStatus)(void *pObj);
@@ -332,6 +335,9 @@
virtual int AXISCALL checkMessage(const AxisChar* pName,
const AxisChar* pNamespace)=0;
+ virtual int AXISCALL checkFault(const AxisChar* pName,
+ const AxisChar* pNamespace)=0;
+
/* Minimal error check */
virtual int AXISCALL getStatus()=0;
@@ -535,6 +541,10 @@
static int AXISCALL s_CheckMessage(void *pObj, const AxisChar* pName,
const AxisChar* pNamespace)
{return ((CallBase*)pObj)->checkMessage(pName, pNamespace);};
+
+ static int AXISCALL s_CheckFault(void *pObj, const AxisChar* pName,
+ const AxisChar* pNamespace)
+ {return ((CallBase*)pObj)->checkFault(pName, pNamespace);};
/* Minimal error check */
static int AXISCALL s_GetStatus(void *pObj)
@@ -605,6 +615,7 @@
ms_VFtable.getAttributeAsTime = s_GetAttributeAsTime;
ms_VFtable.getAttributeAsDuration = s_GetAttributeAsDuration;
ms_VFtable.checkMessage = s_CheckMessage;
+ ms_VFtable.checkFault = s_CheckFault;
ms_VFtable.getStatus = s_GetStatus;
}
};
@@ -755,6 +766,9 @@
const AxisChar* pNamespace);
int AXISCALL checkMessage(const AxisChar* pName,
+ const AxisChar* pNamespace);
+
+ int AXISCALL checkFault(const AxisChar* pName,
const AxisChar* pNamespace);
int AXISCALL getStatus();
1.12 +1 -0 ws-axis/c/include/axis/server/AxisException.h
Index: AxisException.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/server/AxisException.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AxisException.h 20 May 2004 08:12:18 -0000 1.11
+++ AxisException.h 24 May 2004 05:44:19 -0000 1.12
@@ -165,6 +165,7 @@
AxisException(int iExceptionCode);
AxisException(exception* e);
AxisException(exception* e, int iExceptionCode);
+ AxisException(char* pcMessage){m_sMessage = pcMessage;};
virtual ~AxisException() throw();
virtual const char* what() throw();
virtual const int getExceptionCode();
1.16 +2 -2 ws-axis/c/include/axis/server/AxisTrace.h
Index: AxisTrace.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/server/AxisTrace.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AxisTrace.h 18 May 2004 12:30:26 -0000 1.15
+++ AxisTrace.h 24 May 2004 05:44:19 -0000 1.16
@@ -29,7 +29,7 @@
#define AXISTRACE3(X) g_pAT->trace(X);
#endif
-#if !defined(__AXISTRACE__)
+#if !defined(ENABLE_AXISTRACE)
#define AXISTRACE1(X,Y) "";
#define AXISTRACE2(X,Y,Z) "";
#define AXISTRACE3(X) "";
@@ -43,7 +43,7 @@
* @brief This is class is used to log messages when AXISTRACE is defined.
*
* writing to the log could be disabled by commenting the line
- * #define __AXISTRACE__
+ * #define ENABLE_AXISTRACE
* of Axisconfig.h.
* @author Damitha Kumarage (damitha@opensource.lk, damitha@jkcsworld.com)
*/
1.18 +9 -0 ws-axis/c/include/axis/server/IWrapperSoapDeSerializer.h
Index: IWrapperSoapDeSerializer.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/server/IWrapperSoapDeSerializer.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- IWrapperSoapDeSerializer.h 12 May 2004 07:36:46 -0000 1.17
+++ IWrapperSoapDeSerializer.h 24 May 2004 05:44:19 -0000 1.18
@@ -35,6 +35,8 @@
typedef struct {
int (AXISCALL* checkMessageBody)(void* pObj, const AxisChar* pName,
const AxisChar* pNamespace);
+ int (AXISCALL* checkForFault)(void* pObj, const AxisChar* pName,
+ const AxisChar* pNamespace);
/* Method used by wrappers to get a deserialized Array of complex types */
Axis_Array (AXISCALL* getCmplxArray)(void* pObj, void* pDZFunct,
void* pCreFunct, void* pDelFunct, void* pSizeFunct,
@@ -167,6 +169,8 @@
virtual int AXISCALL checkMessageBody(const AxisChar* pName,
const AxisChar* pNamespace)=0;
+ virtual int AXISCALL checkForFault(const AxisChar* pName,
+ const AxisChar* pNamespace)=0;
/* Method used by wrappers to get a deserialized Array of complex types */
virtual Axis_Array AXISCALL getCmplxArray(void* pDZFunct, void* pCreFunct,
void* pDelFunct, void* pSizeFunct, const AxisChar* pName,
@@ -291,6 +295,10 @@
const AxisChar* pNamespace)
{return ((IWrapperSoapDeSerializer*)pObj)->checkMessageBody(pName,
pNamespace);};
+ static int AXISCALL s_CheckForFault(void* pObj, const AxisChar* pName,
+ const AxisChar* pNamespace)
+ {return ((IWrapperSoapDeSerializer*)pObj)->checkMessageBody(pName,
+ pNamespace);};
static Axis_Array AXISCALL s_GetCmplxArray(void* pObj, void* pDZFunct,
void* pCreFunct, void* pDelFunct, void* pSizeFunct, const AxisChar*
pName, const AxisChar* pNamespace)
@@ -488,6 +496,7 @@
static void s_Initialize()
{
ms_VFtable.checkMessageBody = s_CheckMessageBody;
+ ms_VFtable.checkForFault = s_CheckForFault;
ms_VFtable.getCmplxArray = s_GetCmplxArray;
ms_VFtable.getBasicArray = s_GetBasicArray;
ms_VFtable.getCmplxObject = s_GetCmplxObject;
1.10 +1 -0 ws-axis/c/include/axis/server/Param.h
Index: Param.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/server/Param.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Param.h 30 Apr 2004 05:38:30 -0000 1.9
+++ Param.h 24 May 2004 05:44:19 -0000 1.10
@@ -39,6 +39,7 @@
class Param : public IParam
{
friend class SoapSerializer;
+ friend class SoapFault;
public:
Param(){ m_Type = USER_TYPE;};
/* if there is no attribute that says the type */
1.18 +3 -1 ws-axis/c/include/axis/server/SoapDeSerializer.h
Index: SoapDeSerializer.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/server/SoapDeSerializer.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- SoapDeSerializer.h 18 May 2004 11:09:08 -0000 1.17
+++ SoapDeSerializer.h 24 May 2004 05:44:19 -0000 1.18
@@ -56,7 +56,7 @@
/* Provider type of current service that uses this DeSerializer object */
PROVIDERTYPE m_ProviderType;
char* m_pcFaultDetail;
- SOAPTransport* m_pInputStream;
+ SOAPTransport* m_pInputStream;
private:
int AXISCALL getArraySize(const AnyElement* pElement);
@@ -80,6 +80,8 @@
bool isAnyMustUnderstandHeadersLeft();
int getFault();
int AXISCALL checkMessageBody(const AxisChar* pName,
+ const AxisChar* pNamespace);
+ int AXISCALL checkForFault(const AxisChar* pName,
const AxisChar* pNamespace);
/* to get any header blocks left in the Deserializer */
HeaderBlock* getHeaderBlock();
1.3 +1 -0 ws-axis/c/samples/client/rpcfault/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/client/rpcfault/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.am 20 May 2004 08:11:28 -0000 1.2
+++ Makefile.am 24 May 2004 05:44:19 -0000 1.3
@@ -4,5 +4,6 @@
mathops_SOURCES = MathOps.cpp \
MathOpsClient.cpp \
SOAPStructFault.cpp \
+ AxisDivByZeroException.cpp
mathops_LDADD = $(LDFLAGS)
INCLUDES = -I$(AXISCPP_HOME)/include
1.6 +60 -31 ws-axis/c/samples/client/rpcfault/MathOps.cpp
Index: MathOps.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/client/rpcfault/MathOps.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MathOps.cpp 20 May 2004 10:31:41 -0000 1.5
+++ MathOps.cpp 24 May 2004 05:44:19 -0000 1.6
@@ -44,11 +44,14 @@
*/
int MathOps::div(int Value0, int Value1)
{
- int Ret;
- char* cFaultcode;
- char* cFaultstring;
- char* cFaultactor;
- if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return Ret;
+ int Ret;
+ char* cFaultcode;
+ char* cFaultstring;
+ char* cFaultactor;
+ char* cFaultdetail;
+ try
+ {
+ if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return Ret;
m_pCall->setTransportProperty(SOAPACTION_HEADER , "MathOps#div");
m_pCall->setSOAPVersion(SOAP_VER_1_1);
m_pCall->setOperation("div", "http://localhost/axis/MathOps");
@@ -56,32 +59,58 @@
m_pCall->addParameter((void*)&Value1, "in1", XSD_INT);
if (AXIS_SUCCESS == m_pCall->invoke())
{
- if(AXIS_SUCCESS == m_pCall->checkMessage("divResponse",
- "http://localhost/axis/MathOps"))
- {
- Ret = m_pCall->getElementAsInt("addReturn", 0);
- }
- else if(AXIS_SUCCESS == m_pCall->checkMessage("fault",
- "http://localhost/axis/MathOps")) //Exception handling code goes here
- {
- cFaultcode = m_pCall->getElementAsString("faultcode", 0);
- cFaultstring = m_pCall->getElementAsString("faultstring", 0);
- cFaultactor = m_pCall->getElementAsString("faultactor", 0);
- if(AXIS_SUCCESS == m_pCall->checkMessage("detail",
- "http://localhost/axis/MathOps"))
- {
- SOAPStructFault* pFaultDetail = NULL;
- pFaultDetail = (SOAPStructFault*)m_pCall->
- getCmplxObject((void*) Axis_DeSerialize_SOAPStructFault,
- (void*) Axis_Create_SOAPStructFault,
- (void*) Axis_Delete_SOAPStructFault,"faultstruct", 0);
- throw AxisException();
-
- }
- }
- }
- m_pCall->unInitialize();
- return Ret;
+ if(AXIS_SUCCESS == m_pCall->checkMessage("divResponse",
+ "http://localhost/axis/MathOps"))
+ {
+ Ret = m_pCall->getElementAsInt("addReturn", 0);
+ }
+ }
+ }
+ catch(AxisException& e)
+ {
+ if(AXIS_SUCCESS == m_pCall->checkFault("Fault",
+ "http://localhost/axis/MathOps")) //Exception handling code goes here
+ {
+ cFaultcode = m_pCall->getElementAsString("faultcode", 0);
+ cFaultstring = m_pCall->getElementAsString("faultstring", 0);
+ cFaultactor = m_pCall->getElementAsString("faultactor", 0);
+ if(AXIS_SUCCESS == m_pCall->checkFault("faultdetail",
+ "http://localhost/axis/MathOps"))
+ {
+ printf("came\n");
+ m_pCall->getFaultDetail(&cFaultdetail);
+ printf("came1\n");
+ throw AxisException(cFaultdetail);
+ }
+ else
+ {
+ //cFaultdetail = m_pCall->getElementAsString("faultdetail", 0);
+ //if(NULL != cFaultdetail)
+ //{
+ // printf("came1\n");
+ // throw AxisException(cFaultdetail);
+ //}
+ SOAPStructFault* pFaultDetail = NULL;
+ pFaultDetail = (SOAPStructFault*)m_pCall->
+ getCmplxObject((void*) Axis_DeSerialize_SOAPStructFault,
+ (void*) Axis_Create_SOAPStructFault,
+ (void*) Axis_Delete_SOAPStructFault,"faultstruct", 0);
+
+ char* temp = pFaultDetail->varString;
+ printf("%s\n", temp);
+ /*start user code*/
+ printf("faultcode:%s\n", cFaultcode);
+ printf("faultstring:%s\n", cFaultstring);
+ printf("faultactor:%s\n", cFaultactor);
+ /*end user code*/
+ m_pCall->unInitialize();
+ throw AxisDivByZeroException(pFaultDetail);
+ }
+ }
+ else throw;
+ }
+ m_pCall->unInitialize();
+ return Ret;
}
int MathOps::getFaultDetail(char** ppcDetail)
1.3 +1 -1 ws-axis/c/samples/client/rpcfault/MathOps.h
Index: MathOps.h
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/client/rpcfault/MathOps.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MathOps.h 20 May 2004 10:31:41 -0000 1.2
+++ MathOps.h 24 May 2004 05:44:19 -0000 1.3
@@ -8,7 +8,7 @@
#include <axis/client/Call.h>
#include "SOAPStructFault.h"
-#include <axis/server/AxisException.h>
+#include "AxisDivByZeroException.h"
#include <ctype.h>
class MathOps
1.4 +6 -0 ws-axis/c/samples/client/rpcfault/MathOpsClient.cpp
Index: MathOpsClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/client/rpcfault/MathOpsClient.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MathOpsClient.cpp 20 May 2004 10:31:41 -0000 1.3
+++ MathOpsClient.cpp 24 May 2004 05:44:19 -0000 1.4
@@ -52,9 +52,15 @@
try
{
iResult = ws.div(i1, i2);
+ printf("Result is:%d\n", iResult);
+ }
+ catch(AxisDivByZeroException& e)
+ {
+ printf("Exception : %s\n", e.what());
}
catch(AxisException& e)
{
+ printf("Exception : %s\n", e.what());
}
catch(exception& e)
{
1.2 +7 -4 ws-axis/c/samples/client/rpcfault/SOAPStructFault.h
Index: SOAPStructFault.h
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/client/rpcfault/SOAPStructFault.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOAPStructFault.h 19 May 2004 05:46:07 -0000 1.1
+++ SOAPStructFault.h 24 May 2004 05:44:19 -0000 1.2
@@ -16,11 +16,14 @@
class SOAPStructFault
{
public:
- xsd__string varString;
+ xsd__string varString;
int varInt;
- float varFloat;
- SOAPStructFault();
- virtual ~SOAPStructFault();
+ float varFloat;
+ SOAPStructFault();
+ virtual ~SOAPStructFault();
+ void setFaultcode();
+ void setFaultstring();
+ void setFaultDetail();
};
#endif /* !defined(__SOAPSTRUCTFAULT_PARAM_H__OF_AXIS_INCLUDED_)*/
1.3 +10 -0 ws-axis/c/samples/server/rpcfault/AxisDivByZeroException.cpp
Index: AxisDivByZeroException.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/rpcfault/AxisDivByZeroException.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AxisDivByZeroException.cpp 20 May 2004 08:11:28 -0000 1.2
+++ AxisDivByZeroException.cpp 24 May 2004 05:44:19 -0000 1.3
@@ -82,6 +82,16 @@
const string AxisDivByZeroException::getMessage (int iExceptionCode)
{
+ string sMessage;
+ switch(iExceptionCode)
+ {
+ case AXISC_SERVICE_THROWN_EXCEPTION:
+ sMessage = "A service has thrown an exception. see detail";
+ break;
+ default:
+ sMessage = "Unknown Exception has occured";
+ }
+ return sMessage;
}
const char* AxisDivByZeroException::what() throw ()
1.3 +1 -1 ws-axis/c/samples/server/rpcfault/MathOps.wsdl
Index: MathOps.wsdl
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/rpcfault/MathOps.wsdl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MathOps.wsdl 18 May 2004 04:32:30 -0000 1.2
+++ MathOps.wsdl 24 May 2004 05:44:19 -0000 1.3
@@ -34,7 +34,7 @@
<wsdl:message name="divResponse">
<wsdl:part name="addReturn" type="xsd:int"/>
</wsdl:message>
- <message name="SOAPStructFault">
+ <message name="DivByZeroFault">
<part name="faultstruct" type="s:SOAPStructFault"/>
</message>
<wsdl:portType name="MathOps">
1.5 +8 -5 ws-axis/c/samples/server/rpcfault/MathOpsWrapper.cpp
Index: MathOpsWrapper.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/rpcfault/MathOpsWrapper.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MathOpsWrapper.cpp 20 May 2004 03:48:03 -0000 1.4
+++ MathOpsWrapper.cpp 24 May 2004 05:44:19 -0000 1.5
@@ -87,14 +87,17 @@
}
catch(AxisDivByZeroException& e)
{
- pIWSSZ->createSoapFault("SOAPStructFault", "http://soapinterop.org/"); SOAPStructFault* objFault = (SOAPStructFault*)pIWSDZ->
- getCmplxObject((void*)Axis_DeSerialize_SOAPStructFault,
+ pIWSSZ->createSoapFault("SOAPStructFault", "http://soapinterop.org/"); SOAPStructFault* objFault = (SOAPStructFault*)pIWSDZ->
+ getCmplxObject((void*)Axis_DeSerialize_SOAPStructFault,
(void*)Axis_Create_SOAPStructFault, (void*)Axis_Delete_SOAPStructFault,
"faultstruct", Axis_URI_SOAPStructFault);
- pIWSSZ->addFaultDetail(objFault, (void*)Axis_Serialize_SOAPStructFault,
- (void*)Axis_Delete_SOAPStructFault, "DivByZeroException", Axis_URI_SOAPStructFault);
- throw AxisDivByZeroException();
+ if(objFault)
+ pIWSSZ->addFaultDetail(objFault, (void*)Axis_Serialize_SOAPStructFault,
+ (void*)Axis_Delete_SOAPStructFault, "DivByZeroException",
+ Axis_URI_SOAPStructFault);
+
+ throw;
}
return pIWSSZ->addOutputParam("divReturn", (void*)&ret, XSD_INT);
}
1.2 +7 -0 ws-axis/c/samples/server/rpcfault/SOAPStructFault.cpp
Index: SOAPStructFault.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/rpcfault/SOAPStructFault.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOAPStructFault.cpp 19 May 2004 05:46:07 -0000 1.1
+++ SOAPStructFault.cpp 24 May 2004 05:44:19 -0000 1.2
@@ -41,6 +41,13 @@
param->varString = pIWSDZ->getElementAsString("varString",0);
param->varInt = pIWSDZ->getElementAsInt("varInt",0);
param->varFloat = pIWSDZ->getElementAsFloat("varFloat",0);
+ if(AXIS_FAIL == pIWSDZ->getStatus())
+ {
+ param->varString = "Division by zero exception";
+ param->varInt = 1;
+ param->varFloat = 10.52;
+ return AXIS_SUCCESS;
+ }
return pIWSDZ->getStatus();
}
1.2 +2 -2 ws-axis/c/samples/server/rpcfault/SOAPStructFault.h
Index: SOAPStructFault.h
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/rpcfault/SOAPStructFault.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SOAPStructFault.h 19 May 2004 05:46:07 -0000 1.1
+++ SOAPStructFault.h 24 May 2004 05:44:19 -0000 1.2
@@ -10,8 +10,8 @@
#include <axis/server/AxisUserAPI.h>
/*Local name and the URI for the type*/
-static const char* Axis_URI_SOAPStructFault = "http://soapinterop.org/xsd";
-static const char* Axis_TypeName_SOAPStructFault = "SOAPStructFault";
+static const char* Axis_URI_SOAPStructFault = "http://localhost/axis/MathOps";
+static const char* Axis_TypeName_SOAPStructFault = "DivByZeroFault";
class SOAPStructFault
{
1.22 +1 -1 ws-axis/c/src/common/AxisConfig.cpp
Index: AxisConfig.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/AxisConfig.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- AxisConfig.cpp 21 May 2004 06:01:14 -0000 1.21
+++ AxisConfig.cpp 24 May 2004 05:44:20 -0000 1.22
@@ -165,4 +165,4 @@
}
-*/
\ No newline at end of file
+*/
1.26 +14 -14 ws-axis/c/src/common/AxisTrace.cpp
Index: AxisTrace.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/AxisTrace.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- AxisTrace.cpp 21 May 2004 05:20:56 -0000 1.25
+++ AxisTrace.cpp 24 May 2004 05:44:20 -0000 1.26
@@ -44,11 +44,12 @@
int AxisTrace::openFile ()
{
//char* sFileName = g_pConfig->getAxisLogPath ();
- char* sFileName = g_pConfig->getAxConfProperty(AXCONF_LOGPATH);
- if (!sFileName) return AXIS_FAIL;
-#ifndef WIN32
+ char* sFileName = g_pConfig->getAxConfProperty(AXCONF_LOGPATH);
+ if (!sFileName) return AXIS_FAIL;
+/*#ifndef WIN32
setFilePerm(sFileName);
#endif
+*/
if(AXIS_FAIL == m_fileTrace.fileOpen(sFileName, "a"))
return AXIS_FAIL;
m_bLoggingOn = true;
@@ -58,11 +59,12 @@
int AxisTrace::openFileByClient ()
{
//char* sFileName = g_pConfig->getAxisClientLogPath ();
- char* sFileName = g_pConfig->getAxConfProperty(AXCONF_CLIENTLOGPATH);
- if (!sFileName) return AXIS_FAIL;
-#ifndef WIN32
+ char* sFileName = g_pConfig->getAxConfProperty(AXCONF_CLIENTLOGPATH);
+ if (!sFileName) return AXIS_FAIL;
+/*#ifndef WIN32
setFilePerm(sFileName);
#endif
+*/
if(AXIS_FAIL == m_fileTrace.fileOpen(sFileName, "a"))
return AXIS_FAIL;
m_bLoggingOn = true;
@@ -71,7 +73,7 @@
int AxisTrace::setFilePerm(const char* sFileName)
{
- int length = strlen (sFileName) + 12;
+/* int length = strlen (sFileName) + 12;
char* setPerm = (char *) malloc (length);
if (setPerm)
{
@@ -86,6 +88,7 @@
#endif
if (AXIS_SUCCESS != (m_fileTrace.fileOpen(sFileName, "a")))
return AXIS_FAIL;
+*/
return AXIS_SUCCESS;
}
@@ -152,7 +155,6 @@
}
int AxisTrace::logaxis (const char* sLog, int level, char* arg2, int arg3)
{
- if (!m_bLoggingOn) return AXIS_FAIL;
int iResult = logthis(sLog, level, arg2, arg3);
/* fputs ("\n", m_fileTrace);
fputs ("-------------------------------------------------", m_fileTrace);
@@ -173,7 +175,6 @@
int AxisTrace::logaxis (const char* sLog1, const char* sLog2, int level,
char* arg3, int arg4)
{
- if (!m_bLoggingOn) return AXIS_FAIL;
int iResult = logthis(sLog1, level, arg3, arg4);
if(AXIS_SUCCESS == iResult)
{
@@ -183,7 +184,8 @@
fputs ("\n", m_fileTrace);
fflush (m_fileTrace);*/
- m_fileTrace.filePuts (sLog2);
+ if(0 != sLog2)
+ m_fileTrace.filePuts (sLog2);
m_fileTrace.filePuts ("\n");
m_fileTrace.filePuts ("-------------------------------------------------");
m_fileTrace.filePuts ("\n");
@@ -199,9 +201,8 @@
int AxisTrace::logaxis (const char* sLog1, const int nLog2, int level,
char* arg3, int arg4)
{
- if (!m_bLoggingOn) return AXIS_FAIL;
- char* convToInt = (char*) malloc(4 * sizeof(char));
int iResult = logthis(sLog1, level, arg3, arg4);
+ char* convToInt = (char*) malloc(4 * sizeof(char));
if(AXIS_SUCCESS == iResult)
{
sprintf(convToInt, "%d", nLog2);
@@ -227,9 +228,8 @@
int AxisTrace::logaxis (const char* sLog1, const double dLog2, int level,
char* arg3, int arg4)
{
- if (!m_bLoggingOn) return AXIS_FAIL;
- char* convToDouble = (char*) malloc(4 * sizeof(char));
int iResult = logthis(sLog1, level, arg3, arg4);
+ char* convToDouble = (char*) malloc(4 * sizeof(char));
if(AXIS_SUCCESS == iResult)
{
sprintf(convToDouble, "%f", dLog2);
1.17 +2 -1 ws-axis/c/src/common/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/Makefile.am,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Makefile.am 18 May 2004 04:32:30 -0000 1.16
+++ Makefile.am 24 May 2004 05:44:20 -0000 1.17
@@ -12,7 +12,8 @@
AxisConfig.cpp \
AxisSocketUtils.cpp \
AdminUtils.cpp \
- AxisConfigException.cpp
+ AxisConfigException.cpp \
+ AxisMessage.cpp
libcommon_la_LIBADD = $(LDFLAGS)
INCLUDES = -I$(AXISCPP_HOME)/include
1.56 +6 -5 ws-axis/c/src/engine/Axis.cpp
Index: Axis.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/Axis.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- Axis.cpp 21 May 2004 06:07:41 -0000 1.55
+++ Axis.cpp 24 May 2004 05:44:20 -0000 1.56
@@ -64,7 +64,7 @@
#define WSDLDIRECTORY "/wsdls/"
// Define all global variables of the axisengine
-#ifdef _AXISTRACE
+#ifdef ENABLE_AXISTRACE
unsigned char chEBuf[1024];
#endif
@@ -117,9 +117,10 @@
}
else
{
- ServerAxisEngine* objTempServer = (ServerAxisEngine*) engine;
- objTempServer->setFaultOutputStream(Status, pStream);
- objTempServer = NULL;
+ ServerAxisEngine* pObjTempServer = (ServerAxisEngine*) engine;
+ pObjTempServer->setFaultOutputStream(Status, pStream);
+ pStream->flushOutput();
+ pObjTempServer = NULL;
Status = AXIS_SUCCESS;
}
}
@@ -255,7 +256,7 @@
if (status == AXIS_SUCCESS)
{
char *pWsddPath = g_pConfig->getAxConfProperty(AXCONF_WSDDFILEPATH);
-#if defined(__AXISTRACE__)
+#if defined(ENABLE_AXISTRACE)
status = g_pAT->openFile ();
if (status == AXIS_FAIL)
{
1.42 +6 -0 ws-axis/c/src/engine/client/Call.cpp
Index: Call.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/Call.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- Call.cpp 18 May 2004 11:09:09 -0000 1.41
+++ Call.cpp 24 May 2004 05:44:20 -0000 1.42
@@ -515,6 +515,12 @@
return m_nStatus;
}
+int Call::checkFault (const AxisChar* pName, const AxisChar* pNamespace)
+{
+ m_nStatus = m_pIWSDZ->checkForFault (pName, pNamespace);
+ return m_nStatus;
+}
+
void* Call::getCmplxObject (void* pDZFunct, void* pCreFunct, void* pDelFunct,
const AxisChar* pName, const AxisChar* pNamespace)
{
1.13 +54 -32 ws-axis/c/src/engine/server/ServerAxisEngine.cpp
Index: ServerAxisEngine.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/server/ServerAxisEngine.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ServerAxisEngine.cpp 20 May 2004 08:12:18 -0000 1.12
+++ ServerAxisEngine.cpp 24 May 2004 05:44:20 -0000 1.13
@@ -22,6 +22,7 @@
#include "../../common/AxisUtils.h"
#include "../../wsdd/WSDDDeployment.h"
#include "../HandlerPool.h"
+#include <axis/server/AxisMessage.h>
#include <axis/server/AxisTrace.h>
extern AxisTrace* g_pAT;
@@ -42,7 +43,7 @@
int ServerAxisEngine::process(SOAPTransport* pStream)
{
int Status = 0;
- const WSDDService* pService = NULL;
+ //const WSDDService* pService = NULL;
int nSoapVersion;
AXISC_TRY
if (!pStream)
@@ -101,8 +102,8 @@
}
/* get service description object from the WSDD Deployment object */
- pService = g_pWSDDDeployment->getService (service.c_str ());
- if (!pService)
+ m_pService = g_pWSDDDeployment->getService (service.c_str ());
+ if (!m_pService)
{
nSoapVersion = m_pMsgData->m_pDZ->getVersion ();
nSoapVersion =
@@ -114,9 +115,9 @@
break; // do .. while(0)
}
- m_pMsgData->setService (pService);
+ m_pMsgData->setService (m_pService);
- m_CurrentProviderType = pService->getProvider ();
+ m_CurrentProviderType = m_pService->getProvider ();
m_pSZ->setCurrentProviderType (m_CurrentProviderType);
m_pDZ->setCurrentProviderType (m_CurrentProviderType);
switch (m_CurrentProviderType)
@@ -188,11 +189,11 @@
m_pMsgData->setOperationName (sOperation.c_str ());
- if (pService->isAllowedMethod (sOperation.c_str ()))
+ if (m_pService->isAllowedMethod (sOperation.c_str ()))
{
/* load actual web service handler */
if (AXIS_SUCCESS != g_pHandlerPool->getWebService (&m_pWebService,
- sSessionId, pService))
+ sSessionId, m_pService))
{
/* error : couldnot load web service */
AXISTRACE1("SERVER_ENGINE_COULDNOTLOADSRV", CRITICAL);
@@ -247,7 +248,7 @@
}
// Get Service specific Handlers from the pool if configured any
if (AXIS_SUCCESS != (Status = g_pHandlerPool->getRequestFlowHandlerChain
- (&m_pSReqFChain, sSessionId, pService)))
+ (&m_pSReqFChain, sSessionId, m_pService)))
{
AXISTRACE1("SERVER_ENGINE_COULDNOTLOADHDL", CRITICAL);
THROW_AXIS_ENGINE_EXCEPTION(SERVER_ENGINE_COULDNOTLOADHDL);
@@ -257,7 +258,7 @@
if (AXIS_SUCCESS != (Status =
g_pHandlerPool->getResponseFlowHandlerChain (&m_pSResFChain,
- sSessionId, pService)))
+ sSessionId, m_pService)))
{
AXISTRACE1("SERVER_ENGINE_COULDNOTLOADHDL", CRITICAL);
THROW_AXIS_ENGINE_EXCEPTION(SERVER_ENGINE_COULDNOTLOADHDL);
@@ -310,23 +311,14 @@
}
m_pSZ->setOutputStream (pStream);
- // 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, stream->trtype);
- * Pool back the webservice
- */
- if (m_pWebService)
- g_pHandlerPool->poolWebService (sSessionId, m_pWebService, pService);
- //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.
- */
+ // Pool back the handlers and services
+ releaseHandlers(pStream);
+ //todo
+ /* An exception derived from exception which is not handled will be
+ * handled here. You can call a method in AxisModule which may unload
+ * the ServerAxisEngine from the webserver and report the error. You can
+ * also write this in a logfile specific to axis.
+ */
AXISC_CATCH(AxisException& e)
/*
* An exception which is not handled will be handled here.
@@ -338,6 +330,8 @@
AXISTRACE2("Exception:", tempStr, CRITICAL);
if(AXISC_SERVICE_THROWN_EXCEPTION == iExceptionCode)
{
+ m_pSZ->setOutputStream (pStream);
+ releaseHandlers(pStream);
return AXIS_SUCCESS;//Service created fault is written to the stream.
//so return success.
}
@@ -345,6 +339,10 @@
return e.getExceptionCode();
#endif
AXISC_CATCH(exception& e)
+#ifdef ENABLE_AXIS_EXCEPTION
+ /* Handle standerd exceptions here
+ */
+#endif
AXISC_CATCH(...)
#ifdef ENABLE_AXIS_EXCEPTION
return SERVER_UNKNOWN_ERROR;
@@ -426,6 +424,7 @@
{
Status = ((WrapperClassHandler *) m_pWebService->_object)->
invoke (pMsg);
+ AXISTRACE1("came", INFO);
}
else
Status = AXIS_FAIL;
@@ -486,11 +485,34 @@
int ServerAxisEngine::setFaultOutputStream(int iFaultCode, SOAPTransport* pStream)
{
- AxisException objException(iFaultCode);
- string sMessage = objException.getMessage(iFaultCode);
- SoapFault* objSoapFault = SoapFault::getSoapFault(iFaultCode);
- objSoapFault->setFaultDetail(sMessage);
- m_pSZ->setSoapFault(objSoapFault);
+ AxisMessage objMessage;
+ string sMessage = objMessage.getMessage(iFaultCode);
+ SoapFault* pObjSoapFault = SoapFault::getSoapFault(iFaultCode);
+ pObjSoapFault->setFaultDetail(sMessage);
+ AXISTRACE1("came70", INFO);
+ m_pSZ->setSoapFault(pObjSoapFault);
+ AXISTRACE1("came71", INFO);
m_pSZ->setOutputStream(pStream);
- return AXIS_SUCCESS;
+ AXISTRACE1("came72", INFO);
+ releaseHandlers(pStream);
+ AXISTRACE1("came73", INFO);
+ return AXIS_SUCCESS;
+}
+
+int ServerAxisEngine::releaseHandlers(SOAPTransport* pStream)
+{
+ string sSessionId = pStream->getSessionId();
+ // 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, stream->trtype);
+ * Pool back the webservice
+ */
+ if (m_pWebService)
+ g_pHandlerPool->poolWebService (sSessionId, m_pWebService, m_pService);
+
+ return AXIS_SUCCESS;
}
1.7 +12 -0 ws-axis/c/src/engine/server/ServerAxisEngine.h
Index: ServerAxisEngine.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/server/ServerAxisEngine.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ServerAxisEngine.h 18 May 2004 04:32:31 -0000 1.6
+++ ServerAxisEngine.h 24 May 2004 05:44:20 -0000 1.7
@@ -34,12 +34,24 @@
{
private:
BasicHandler* m_pWebService;
+ const WSDDService* m_pService;
public:
ServerAxisEngine();
virtual ~ ServerAxisEngine();
public:
int process(SOAPTransport* pSoap);
+
+ /** When fault occures it need to be written to the stream. If fail is
+ * returned from the process method of ServerAxisEngine this method is
+ * called within the process_request method of Axis.cpp
+ */
int setFaultOutputStream(int iFaultCode, SOAPTransport* pSoap);
+
+ /** When finished with handlers and webservices release them
+ * back to the pool
+ */
+ int releaseHandlers(SOAPTransport* pSoap);
+
protected:
virtual int invoke(MessageData* pMsg);
virtual void onFault(MessageData* pMsg);
1.20 +15 -8 ws-axis/c/src/soap/SoapBody.cpp
Index: SoapBody.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapBody.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- SoapBody.cpp 18 May 2004 04:32:31 -0000 1.19
+++ SoapBody.cpp 24 May 2004 05:44:20 -0000 1.20
@@ -33,6 +33,8 @@
#include <axis/server/SoapSerializer.h>
#include <axis/server/GDefine.h>
#include <axis/server/Attribute.h>
+#include <axis/server/AxisTrace.h>
+extern AxisTrace* g_pAT;
SoapBody::SoapBody()
{
@@ -69,6 +71,7 @@
do
{
+ AXISTRACE1("came5", INFO);
pSZ.serialize("<", gs_SoapEnvVersionsStruct[eSoapVersion].pchPrefix,
":", gs_SoapEnvVersionsStruct[eSoapVersion].pchWords[SKW_BODY],
NULL);
@@ -80,22 +83,25 @@
pSZ.serialize(">", NULL);
- if(m_pSoapMethod!=NULL)
- {
- iStatus= m_pSoapMethod->serialize(pSZ);
+ if(NULL != m_pSoapFault)
+ {
+ AXISTRACE1("came6", INFO);
+ iStatus= m_pSoapFault->serialize(pSZ);
if(iStatus==AXIS_FAIL)
{
+ AXISTRACE1("came7", INFO);
break;
}
- }
- else if(m_pSoapFault!=NULL)
- {
- iStatus= m_pSoapFault->serialize(pSZ);
+ }
+ else if(NULL != m_pSoapMethod)
+ {
+ AXISTRACE1("came8", INFO);
+ iStatus= m_pSoapMethod->serialize(pSZ);
if(iStatus==AXIS_FAIL)
{
break;
}
- }
+ }
else
{
m_pSoapFault = SoapFault::getSoapFault(SERVER_ENGINE_WEBSERVICEFAILED);
@@ -106,6 +112,7 @@
break;
}
}
+ AXISTRACE1("came9", INFO);
pSZ.serialize("</", gs_SoapEnvVersionsStruct[eSoapVersion].pchPrefix,
":", gs_SoapEnvVersionsStruct[eSoapVersion].pchWords[SKW_BODY],
1.49 +68 -1 ws-axis/c/src/soap/SoapDeSerializer.cpp
Index: SoapDeSerializer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapDeSerializer.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- SoapDeSerializer.cpp 20 May 2004 03:48:03 -0000 1.48
+++ SoapDeSerializer.cpp 24 May 2004 05:44:20 -0000 1.49
@@ -267,7 +267,6 @@
int SoapDeSerializer::getBody()
{
if (!m_pNode) m_pNode = m_pParser->next();
- AXISTRACE1("came2", INFO);
/* previous header searching may have left a node unidentified */
if (m_pNode)
{
@@ -305,6 +304,60 @@
return AXIS_SUCCESS;
}
+int SoapDeSerializer::checkForFault(const AxisChar* pName,
+ const AxisChar* pNamespace)
+{
+ //if (!m_pNode) m_pNode = m_pParser->next();
+ //if (!m_pNode || (START_ELEMENT != m_pNode->m_type)) return AXIS_FAIL;
+ if(0 == strcmp("Fault", pName))
+ {
+ AXISTRACE2("pName", pName, INFO);
+ AXISTRACE2("m_pChNameOrValue", m_pNode->m_pchNameOrValue, INFO);
+ if (0 != strcmp(m_pNode->m_pchNameOrValue, pName))
+ {
+ m_nStatus = AXIS_SUCCESS;
+ m_pNode = NULL;
+ THROW_AXIS_EXCEPTION(AXISC_NODEVALUE_MISMATCH_EXCEPTION);
+ }
+ /* we can check the namespace uri too here. Should we ?*/
+ m_nStatus = AXIS_SUCCESS;
+ m_pNode = NULL; /*This is to indicate that node is identified and used */
+ return AXIS_SUCCESS;
+ }
+ else
+ {
+ AXISTRACE1("came50", INFO);
+ /*m_pNode = m_pParser->next();
+ AXISTRACE2("came50,Node type:", m_pNode->m_type, INFO);
+ if (!m_pNode || (START_ELEMENT != m_pNode->m_type)) return AXIS_FAIL;
+ AXISTRACE2("pName", pName, INFO);
+ AXISTRACE2("m_pChNameOrValue", m_pNode->m_pchNameOrValue, INFO);
+ if (0 != strcmp(m_pNode->m_pchNameOrValue, pName))
+ {
+ m_nStatus = AXIS_SUCCESS;
+ m_pNode = NULL;
+ THROW_AXIS_EXCEPTION(AXISC_NODEVALUE_MISMATCH_EXCEPTION);
+ }
+ m_nStatus = AXIS_SUCCESS;
+ m_pNode = NULL;
+ return AXIS_SUCCESS;
+ */
+ char* tempChar = getElementAsString("faultdetail", 0);
+ if(0 == tempChar)
+ {
+ m_nStatus = AXIS_SUCCESS;
+ return AXIS_FAIL;
+ }
+ else
+ {
+ m_pcFaultDetail = tempChar;
+ return AXIS_SUCCESS;
+ }
+
+ }
+
+}
+
int SoapDeSerializer::getFault()
{
/* TODO : */
@@ -915,6 +968,7 @@
void* pDelFunct, const AxisChar* pName,
const AxisChar* pNamespace)
{
+ AXISTRACE1("came20", INFO);
if (AXIS_SUCCESS != m_nStatus) return NULL;
/* if anything has gone wrong earlier just do nothing */
if (RPC_ENCODED == m_nStyle)
@@ -925,8 +979,10 @@
if (!m_pNode) return NULL;
/* type can be checked here */
void* pObject = ((AXIS_OBJECT_CREATE_FUNCT)pCreFunct)(NULL, false, 0);
+ AXISTRACE1("came21", INFO);
if (pObject && pDZFunct)
{
+ AXISTRACE1("came22", INFO);
if (C_RPC_PROVIDER == getCurrentProviderType())
{
IWrapperSoapDeSerializer_C cWSD;
@@ -936,10 +992,13 @@
}
else
{
+ AXISTRACE1("came23", INFO);
m_nStatus = ((AXIS_DESERIALIZE_FUNCT)pDZFunct)(pObject, this);
+ AXISTRACE1("came24", INFO);
}
if (AXIS_SUCCESS == m_nStatus)
{
+ AXISTRACE1("came25", INFO);
m_pParser->next(); /* skip end node too */
return pObject;
}
@@ -948,6 +1007,7 @@
((AXIS_OBJECT_DELETE_FUNCT)pDelFunct)(pObject, false, 0);
}
}
+ AXISTRACE1("came26", INFO);
}
else
{
@@ -2136,18 +2196,25 @@
AxisChar* SoapDeSerializer::getElementAsString(const AxisChar* pName,
const AxisChar* pNamespace)
{
+ AXISTRACE2("pName:", pName, INFO);
AxisChar* ret = 0;
if (AXIS_SUCCESS != m_nStatus) return ret;
+ AXISTRACE1("came30", INFO);
if (RPC_ENCODED == m_nStyle)
{
+ AXISTRACE1("came31", INFO);
m_pNode = m_pParser->next();
/* wrapper node with type info Ex: <i xsi:type="xsd:int"> */
if (!m_pNode) return ret;
+ AXISTRACE1("came32", INFO);
if (XSD_STRING == getXSDType(m_pNode))
{
+ AXISTRACE1("came33", INFO);
m_pNode = m_pParser->next(true); /* charactor node */
+ AXISTRACE1("came34", INFO);
if (m_pNode && (CHARACTER_ELEMENT == m_pNode->m_type))
{
+ AXISTRACE1("came35", INFO);
ret = strdup(m_pNode->m_pchNameOrValue);
/* this is because the string may not be available later */
m_pNode = m_pParser->next(); /* skip end element node too */
1.18 +3 -0 ws-axis/c/src/soap/SoapEnvelope.cpp
Index: SoapEnvelope.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapEnvelope.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- SoapEnvelope.cpp 26 Apr 2004 04:04:37 -0000 1.17
+++ SoapEnvelope.cpp 24 May 2004 05:44:20 -0000 1.18
@@ -27,6 +27,8 @@
#include <axis/server/SoapSerializer.h>
#include <stdio.h>
+#include <axis/server/AxisTrace.h>
+extern AxisTrace* g_pAT;
SoapEnvelope::SoapEnvelope()
@@ -105,6 +107,7 @@
if (m_pSoapBody!=NULL)
{
iStatus= m_pSoapBody->serialize(pSZ, eSoapVersion);
+ AXISTRACE2("iStatus", iStatus, INFO);
if (iStatus == AXIS_FAIL)
{
break;
1.21 +53 -14 ws-axis/c/src/soap/SoapFault.cpp
Index: SoapFault.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapFault.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- SoapFault.cpp 18 May 2004 11:09:09 -0000 1.20
+++ SoapFault.cpp 24 May 2004 05:44:20 -0000 1.21
@@ -29,7 +29,7 @@
SoapFault::SoapFault()
{
-
+ m_bIsSimpleDetail = false;
}
SoapFault::~SoapFault()
@@ -44,23 +44,42 @@
int iStatus= AXIS_SUCCESS;
pSZ.serialize("<SOAP-ENV:Fault>", NULL);
- pSZ.serialize("<faultcode>", m_sFaultcode.c_str(), "</faultcode>", NULL);
- pSZ.serialize("<faultstring>", m_sFaultstring.c_str(), "</faultstring>", NULL);
+ AXISTRACE1("came11", INFO);
+ m_pFaultcodeParam->serialize(pSZ);
+ //pSZ.serialize("<faultcode>", m_sFaultcode.c_str(), "</faultcode>", NULL);
+ AXISTRACE1("came12", INFO);
+ m_pFaultstringParam->serialize(pSZ);
+ //pSZ.serialize("<faultstring>", m_sFaultstring.c_str(), "</faultstring>", NULL);
+ AXISTRACE1("came13", INFO);
- if(!m_sFaultactor.empty())
+ if(m_pFaultactorParam)
{
- pSZ.serialize("<faultactor>", m_sFaultactor.c_str(), "</faultactor>", NULL);
- }
+ AXISTRACE1("came14", INFO);
+ m_pFaultactorParam->serialize(pSZ);
+ //pSZ.serialize("<faultactor>", m_sFaultactor.c_str(), "</faultactor>", NULL);
+ }
- if(!m_sFaultDetail.empty())
+ /*if(!m_sFaultDetail.empty())
{
pSZ.serialize("<detail>", m_sFaultDetail.c_str(), "</detail>", NULL);
- }
+ }*/
if(m_pFaultDetail)
{
- pSZ.serialize("<detail>", m_pFaultDetail->serialize(pSZ), "</detail>", NULL);
+ if(m_bIsSimpleDetail)
+ {
+ m_pFaultDetail->serialize(pSZ);
+ AXISTRACE1("came161", INFO);
+ }
+ else
+ {
+ pSZ.serialize("<faultdetail>", NULL);
+ AXISTRACE1("came162", INFO);
+ m_pFaultDetail->serialize(pSZ);
+ pSZ.serialize("</faultdetail>", NULL);
+ }
}
+ AXISTRACE1("came17", INFO);
pSZ.serialize("</SOAP-ENV:Fault>", NULL);
@@ -134,11 +153,12 @@
/* the soap envelope namespace prefix to be obtained from
* gs_SoapEnvVersionsStruct should depend on the relevant SOAP VERSION
*/
- pSoapFault->m_sFaultcode= string(gs_SoapEnvVersionsStruct[SOAP_VER_1_1].pchPrefix) +
- ":" + s_parrSoapFaultStruct[iFaultCode].pcFaultcode;
- pSoapFault->m_sFaultstring= s_parrSoapFaultStruct[iFaultCode].pcFaultstring;
- pSoapFault->m_sFaultactor= s_parrSoapFaultStruct[iFaultCode].pcFaultactor;
- pSoapFault->m_sFaultDetail= s_parrSoapFaultStruct[iFaultCode].pcFaultDetail;
+ pSoapFault->setFaultcode(string(gs_SoapEnvVersionsStruct[SOAP_VER_1_1].pchPrefix) +
+ ":" + s_parrSoapFaultStruct[iFaultCode].pcFaultcode);
+ pSoapFault->setFaultstring(s_parrSoapFaultStruct[iFaultCode].pcFaultstring);
+ //pSoapFault->setFaultactor(s_parrSoapFaultStruct[iFaultCode].pcFaultactor);
+ pSoapFault->setFaultactor("http://endpoint/url");
+ pSoapFault->setFaultDetail(s_parrSoapFaultStruct[iFaultCode].pcFaultDetail);
return pSoapFault;
}
@@ -151,8 +171,19 @@
m_sFaultDetail= sDetail;
}
+int SoapFault::setParam(Param* pParam, const AxisChar* pchName, const void* pValue, XSDTYPE type)
+{
+ if (!pParam) return AXIS_FAIL;
+ pParam->m_Type = type;
+ pParam->m_sName = pchName;
+ pParam->m_Value.pStrValue = *((char**)(pValue));
+ return AXIS_SUCCESS;
+}
+
int SoapFault::setFaultcode(const string& sFaultcode)
{
+ m_pFaultcodeParam = new Param();
+ setParam(m_pFaultcodeParam, "faultcode", &sFaultcode, XSD_STRING);
m_sFaultcode= sFaultcode;
return AXIS_SUCCESS;
@@ -160,12 +191,16 @@
int SoapFault::setFaultstring(const string& sFaultstring)
{
+ m_pFaultstringParam = new Param();
+ setParam(m_pFaultstringParam, "faultstring", &sFaultstring, XSD_STRING);
m_sFaultstring= sFaultstring;
return AXIS_SUCCESS;
}
int SoapFault::setFaultactor(const string& sFaultactor)
{
+ m_pFaultactorParam = new Param();
+ setParam(m_pFaultactorParam, "faultactor", &sFaultactor, XSD_STRING);
m_sFaultactor = sFaultactor;
return AXIS_SUCCESS;
@@ -173,13 +208,17 @@
int SoapFault::setFaultDetail(const string& sFaultDetail)
{
+ m_pFaultDetail = new Param();
+ setParam(m_pFaultDetail, "faultdetail", &sFaultDetail, XSD_STRING);
m_sFaultDetail = sFaultDetail;
+ m_bIsSimpleDetail = true;
return AXIS_SUCCESS;
}
int SoapFault::setFaultDetail(const Param* pFaultDetail)
{
+ AXISTRACE1("came10", INFO);
m_pFaultDetail = (Param*) pFaultDetail;
return AXIS_SUCCESS;
1.2 +6 -0 ws-axis/c/src/soap/SoapFault.h
Index: SoapFault.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapFault.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SoapFault.h 18 May 2004 04:32:31 -0000 1.1
+++ SoapFault.h 24 May 2004 05:44:20 -0000 1.2
@@ -104,16 +104,22 @@
void setPrefix(const AxisChar* prefix);
+ int setParam(Param* pParam, const AxisChar* pchName, const void* pValue, XSDTYPE type);
+
private:
/* string m_sFaultSerialized; */
string m_sFaultDetail;
string m_sFaultactor;
string m_sFaultstring;
string m_sFaultcode;
+ Param* m_pFaultcodeParam;
+ Param* m_pFaultstringParam;
+ Param* m_pFaultactorParam;
Param* m_pFaultDetail;
AxisString m_strPrefix;
AxisString m_strLocalname;
AxisString m_strUri;
+ bool m_bIsSimpleDetail;
static volatile bool m_bInit;
};
1.48 +5 -1 ws-axis/c/src/soap/SoapSerializer.cpp
Index: SoapSerializer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/SoapSerializer.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- SoapSerializer.cpp 20 May 2004 03:48:03 -0000 1.47
+++ SoapSerializer.cpp 24 May 2004 05:44:20 -0000 1.48
@@ -206,6 +206,7 @@
void* pDelFunct, const AxisChar* pName,
const AxisChar* pNamespace )
{
+ AXISTRACE1("came1", INFO);
Param* pParam = new Param();
pParam->m_Value.pCplxObj = new ComplexObjectHandler;
pParam->m_Value.pCplxObj->pObject = pObject;
@@ -214,6 +215,7 @@
if(m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody) && (m_pSoapEnvelope->
m_pSoapBody->m_pSoapFault))
{
+ AXISTRACE1("came2", INFO);
m_pSoapEnvelope->m_pSoapBody->m_pSoapFault->setFaultDetail(pParam);
}
pParam->setName(pName);
@@ -222,6 +224,7 @@
int SoapSerializer::setSoapFault(SoapFault *pSoapFault)
{
+ AXISTRACE1("came3", INFO);
int intStatus= AXIS_FAIL;
if(m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody))
@@ -445,6 +448,7 @@
int SoapSerializer::createSoapFault(const AxisChar* sLocalName,
const AxisChar* sURI)
{
+ AXISTRACE1("came4", INFO);
SoapFault* pSoapFault = new SoapFault();
setSoapFault(pSoapFault);
pSoapFault->setLocalName(sLocalName);
@@ -452,7 +456,7 @@
pSoapFault->setUri(sURI);
pSoapFault->setFaultcode("Server");
pSoapFault->setFaultstring("Service thrown exception");
- pSoapFault->setFaultactor("");
+ pSoapFault->setFaultactor("http://endpoint/url");
return AXIS_SUCCESS;
}