You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2004/06/23 13:11:47 UTC
cvs commit: ws-axis/c/tests/client/fault_mapping/gen_src AxisDivByZeroException.cpp AxisDivByZeroException.h AxisNormalDetailException.cpp AxisNormalDetailException.h AxisOutOfBoundException.cpp AxisOutOfBoundException.h DivByZeroStruct.cpp DivByZeroStruct.h FaultMapping.wsdl Makefile.am MathOps.cpp MathOps.h OutOfBoundStruct.cpp OutOfBoundStruct.h SpecialDetailStruct.cpp SpecialDetailStruct.h gen.sh
damitha 2004/06/23 04:11:47
Added: c/tests/client/fault_mapping Makefile.am MathOpsClient.cpp
c/tests/client/fault_mapping/gen_src
AxisDivByZeroException.cpp AxisDivByZeroException.h
AxisNormalDetailException.cpp
AxisNormalDetailException.h
AxisOutOfBoundException.cpp
AxisOutOfBoundException.h DivByZeroStruct.cpp
DivByZeroStruct.h FaultMapping.wsdl Makefile.am
MathOps.cpp MathOps.h OutOfBoundStruct.cpp
OutOfBoundStruct.h SpecialDetailStruct.cpp
SpecialDetailStruct.h gen.sh
Log:
Revision Changes Path
1.1 ws-axis/c/tests/client/fault_mapping/Makefile.am
Index: Makefile.am
===================================================================
SUBDIRS = gen_src
1.1 ws-axis/c/tests/client/fault_mapping/MathOpsClient.cpp
Index: MathOpsClient.cpp
===================================================================
#include "MathOps.h"
#include <axis/server/AxisException.h>
#include <ctype.h>
void PrintUsage();
bool IsNumber(const char* p);
int main(int argc, char* argv[])
{
char endpoint[256];
const char* server="localhost";
const char* port="80";
const char* op = 0;
const char* p1 = 0;
const char* p2 = 0;
int i1=0, i2=0;
int iResult;
char* pcDetail;
if (argc < 6)
{
PrintUsage();
}
else
{
server = argv[1];
port = argv[2];
}
printf("Sending Requests to Server http://%s:%s ........\n\n", server, port);
sprintf(endpoint, "http://%s:%s/axis/MathOps", server, port);
MathOps ws(endpoint);
op = argv[3];
p1 = argv[4];
p2 = argv[5];
if (!IsNumber(p1))
{
printf("Invalid value for first <parameter>\n\n");
PrintUsage();
}
if (!IsNumber(p2))
{
printf("Invalid value for second <parameter>\n\n");
PrintUsage();
}
i1 = atoi(p1);
i2 = atoi(p2);
if (strcmp(op, "div") == 0)
{
try
{
iResult = ws.div(i1, i2);
printf("Result is:%d\n", iResult);
}
catch(AxisDivByZeroException& e)
{
printf("Exception : %s\n", e.what());
}
catch(AxisOutOfBoundException& e)
{
printf("Exception : %s\n", e.what());
}
catch(AxisNormalDetailException& e)
{
printf("Exception : %s\n", e.what());
}
catch(AxisException& e)
{
printf("Exception : %s\n", e.what());
}
catch(exception& e)
{
}
catch(...)
{
}
}
else
{
printf("Invalid operation %s\n\n", op);
PrintUsage();
}
return 0;
}
void PrintUsage()
{
printf("Usage :\n MathOps <server> <port> <operation> <parameter> <parameter>\n\n");
exit(1);
}
bool IsNumber(const char* p)
{
for (int x=1; x < strlen(p); x++)
{
if (!isdigit(p[x])) return false;
}
return true;
}
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/AxisDivByZeroException.cpp
Index: AxisDivByZeroException.cpp
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains implementations of an Exception class of the web service.
*/
#include "AxisDivByZeroException.h"
#include <axis/server/AxisWrapperAPI.h>
AxisDivByZeroException::AxisDivByZeroException()
{
/* This only serves the pupose of indicating that the
* service has thrown an excpetion
*/
m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION;
processException(m_iExceptionCode);
}
AxisDivByZeroException::AxisDivByZeroException(DivByZeroStruct*pFault)
{
m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION;
processException(pFault);}
AxisDivByZeroException::AxisDivByZeroException(int iExceptionCode)
{
m_iExceptionCode = iExceptionCode;
processException (iExceptionCode);
}
AxisDivByZeroException::AxisDivByZeroException(exception* e)
{
processException (e);
}
AxisDivByZeroException::AxisDivByZeroException(exception* e,int iExceptionCode)
{
processException (e, iExceptionCode);
}
AxisDivByZeroException::~AxisDivByZeroException() throw ()
{
m_sMessage ="";
}
void AxisDivByZeroException:: processException(exception* e, int iExceptionCode)
{
m_sMessage = getMessage (e) + getMessage (iExceptionCode);
}
void AxisDivByZeroException::processException (DivByZeroStruct* pFault)
{
/*User can do something like deserializing the struct into a string*/
int iSize = strlen(pFault->varString) + 8;
char* sMessage = new char[iSize];
m_sMessage = new char[iSize];
char* carrTempBuff =new char[4 * sizeof(char)];
sprintf(carrTempBuff, "%d", pFault->varInt);
strcpy(sMessage, carrTempBuff);
strcat(sMessage, "\n");
sprintf(carrTempBuff, "%f", pFault->varFloat);
strcat(sMessage, carrTempBuff);
strcat(sMessage, "\n");
strcat(sMessage, pFault->varString);
strcat(sMessage, "\n");
m_sMessage = sMessage;
delete(sMessage);
}
void AxisDivByZeroException::processException(exception* e)
{
m_sMessage = getMessage (e);
}
void AxisDivByZeroException::processException(int iExceptionCode)
{
m_sMessage = getMessage (iExceptionCode);
}
const string AxisDivByZeroException::getMessage (exception* objException)
{
string sMessage = objException->what();
return sMessage;
}
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 ()
{
return m_sMessage.c_str ();
}
const int AxisDivByZeroException::getExceptionCode(){
return m_iExceptionCode;
}
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/AxisDivByZeroException.h
Index: AxisDivByZeroException.h
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains an Exception class of the web service.
*/
#if !defined(__AXISDIVBYZEROEXCEPTION_EXCEPTION_H__INCLUDED_)
#define __AXISDIVBYZEROEXCEPTION_EXCEPTION_H__INCLUDED_
#include <string>
#include <exception>
#include <axis/server/AxisException.h>
#include "DivByZeroStruct.h"
using namespace std;
class AxisDivByZeroException: public AxisException
{
public:
AxisDivByZeroException();
AxisDivByZeroException(DivByZeroStruct* pFault);
AxisDivByZeroException(int iExceptionCode);
AxisDivByZeroException(exception* e);
AxisDivByZeroException(exception* e, int iExceptionCode);
virtual ~AxisDivByZeroException() throw();
const char* what() throw();
const int getExceptionCode();
const string getMessage(exception* e);
const string getMessage(int iExceptionCode);
private:
void processException(exception* e);
void processException(DivByZeroStruct* pFault);
void processException(exception* e, int iExceptionCode);
void processException(int iExceptionCode);
string m_sMessage;
int m_iExceptionCode;
};
#endif /* !defined(__AXISDIVBYZEROEXCEPTION_EXCEPTION_H__INCLUDED_)*/
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/AxisNormalDetailException.cpp
Index: AxisNormalDetailException.cpp
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains implementations of an Exception class of the web service.
*/
#include "AxisNormalDetailException.h"
#include <axis/server/AxisWrapperAPI.h>
AxisNormalDetailException::AxisNormalDetailException()
{
/* This only serves the pupose of indicating that the
* service has thrown an excpetion
*/
m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION;
processException(m_iExceptionCode);
}
AxisNormalDetailException::AxisNormalDetailException(SpecialDetailStruct*pFault)
{
m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION;
processException(pFault);}
AxisNormalDetailException::AxisNormalDetailException(int iExceptionCode)
{
m_iExceptionCode = iExceptionCode;
processException (iExceptionCode);
}
AxisNormalDetailException::AxisNormalDetailException(exception* e)
{
processException (e);
}
AxisNormalDetailException::AxisNormalDetailException(exception* e,int iExceptionCode)
{
processException (e, iExceptionCode);
}
AxisNormalDetailException::~AxisNormalDetailException() throw ()
{
m_sMessage ="";
}
void AxisNormalDetailException:: processException(exception* e, int iExceptionCode)
{
m_sMessage = getMessage (e) + getMessage (iExceptionCode);
}
void AxisNormalDetailException::processException (SpecialDetailStruct* pFault)
{
/*User can do something like deserializing the struct into a string*/
int iSize = strlen(pFault->varString) + 8;
char* sMessage = new char[iSize];
m_sMessage = new char[iSize];
strcpy(sMessage, pFault->varString);
strcat(sMessage, "\n");
m_sMessage = sMessage;
delete(sMessage);
}
void AxisNormalDetailException::processException(exception* e)
{
m_sMessage = getMessage (e);
}
void AxisNormalDetailException::processException(int iExceptionCode)
{
m_sMessage = getMessage (iExceptionCode);
}
const string AxisNormalDetailException::getMessage (exception* objException)
{
string sMessage = objException->what();
return sMessage;
}
const string AxisNormalDetailException::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* AxisNormalDetailException::what() throw ()
{
return m_sMessage.c_str ();
}
const int AxisNormalDetailException::getExceptionCode(){
return m_iExceptionCode;
}
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/AxisNormalDetailException.h
Index: AxisNormalDetailException.h
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains an Exception class of the web service.
*/
#if !defined(__AXISNORMALDETAILEXCEPTION_EXCEPTION_H__INCLUDED_)
#define __AXISNORMALDETAILEXCEPTION_EXCEPTION_H__INCLUDED_
#include <string>
#include <exception>
#include <axis/server/AxisException.h>
#include "SpecialDetailStruct.h"
using namespace std;
class AxisNormalDetailException: public AxisException
{
public:
AxisNormalDetailException();
AxisNormalDetailException(SpecialDetailStruct* pFault);
AxisNormalDetailException(int iExceptionCode);
AxisNormalDetailException(exception* e);
AxisNormalDetailException(exception* e, int iExceptionCode);
virtual ~AxisNormalDetailException() throw();
const char* what() throw();
const int getExceptionCode();
const string getMessage(exception* e);
const string getMessage(int iExceptionCode);
private:
void processException(exception* e);
void processException(SpecialDetailStruct* pFault);
void processException(exception* e, int iExceptionCode);
void processException(int iExceptionCode);
string m_sMessage;
int m_iExceptionCode;
};
#endif /* !defined(__AXISNORMALDETAILEXCEPTION_EXCEPTION_H__INCLUDED_)*/
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/AxisOutOfBoundException.cpp
Index: AxisOutOfBoundException.cpp
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains implementations of an Exception class of the web service.
*/
#include "AxisOutOfBoundException.h"
#include <axis/server/AxisWrapperAPI.h>
AxisOutOfBoundException::AxisOutOfBoundException()
{
/* This only serves the pupose of indicating that the
* service has thrown an excpetion
*/
m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION;
processException(m_iExceptionCode);
}
AxisOutOfBoundException::AxisOutOfBoundException(OutOfBoundStruct*pFault)
{
m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION;
processException(pFault);}
AxisOutOfBoundException::AxisOutOfBoundException(int iExceptionCode)
{
m_iExceptionCode = iExceptionCode;
processException (iExceptionCode);
}
AxisOutOfBoundException::AxisOutOfBoundException(exception* e)
{
processException (e);
}
AxisOutOfBoundException::AxisOutOfBoundException(exception* e,int iExceptionCode)
{
processException (e, iExceptionCode);
}
AxisOutOfBoundException::~AxisOutOfBoundException() throw ()
{
m_sMessage ="";
}
void AxisOutOfBoundException:: processException(exception* e, int iExceptionCode)
{
m_sMessage = getMessage (e) + getMessage (iExceptionCode);
}
void AxisOutOfBoundException::processException (OutOfBoundStruct* pFault)
{
/*User can do something like deserializing the struct into a string*/
int iSize = strlen(pFault->varString) + 8;
char* sMessage = new char[iSize];
m_sMessage = new char[iSize];
char* carrTempBuff =new char[4 * sizeof(char)];
strcpy(sMessage, pFault->varString);
strcat(sMessage, "\n");
sprintf(carrTempBuff, "%d", pFault->varInt);
strcat(sMessage, carrTempBuff);
strcat(sMessage, "\n");
SpecialDetailStruct* pFaultDetail = pFault->specialDetail;
strcat(sMessage, pFaultDetail->varString);
m_sMessage = sMessage;
delete(sMessage);
}
void AxisOutOfBoundException::processException(exception* e)
{
m_sMessage = getMessage (e);
}
void AxisOutOfBoundException::processException(int iExceptionCode)
{
m_sMessage = getMessage (iExceptionCode);
}
const string AxisOutOfBoundException::getMessage (exception* objException)
{
string sMessage = objException->what();
return sMessage;
}
const string AxisOutOfBoundException::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* AxisOutOfBoundException::what() throw ()
{
return m_sMessage.c_str ();
}
const int AxisOutOfBoundException::getExceptionCode(){
return m_iExceptionCode;
}
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/AxisOutOfBoundException.h
Index: AxisOutOfBoundException.h
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains an Exception class of the web service.
*/
#if !defined(__AXISOUTOFBOUNDEXCEPTION_EXCEPTION_H__INCLUDED_)
#define __AXISOUTOFBOUNDEXCEPTION_EXCEPTION_H__INCLUDED_
#include <string>
#include <exception>
#include <axis/server/AxisException.h>
#include "OutOfBoundStruct.h"
using namespace std;
class AxisOutOfBoundException: public AxisException
{
public:
AxisOutOfBoundException();
AxisOutOfBoundException(OutOfBoundStruct* pFault);
AxisOutOfBoundException(int iExceptionCode);
AxisOutOfBoundException(exception* e);
AxisOutOfBoundException(exception* e, int iExceptionCode);
virtual ~AxisOutOfBoundException() throw();
const char* what() throw();
const int getExceptionCode();
const string getMessage(exception* e);
const string getMessage(int iExceptionCode);
private:
void processException(exception* e);
void processException(OutOfBoundStruct* pFault);
void processException(exception* e, int iExceptionCode);
void processException(int iExceptionCode);
string m_sMessage;
int m_iExceptionCode;
};
#endif /* !defined(__AXISOUTOFBOUNDEXCEPTION_EXCEPTION_H__INCLUDED_)*/
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/DivByZeroStruct.cpp
Index: DivByZeroStruct.cpp
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains functions to manipulate complex type DivByZeroStruct
*/
#include <malloc.h>
#include "DivByZeroStruct.h"
#include <axis/server/AxisWrapperAPI.h>
/*
* This static method serialize a DivByZeroStruct type of object
*/
int Axis_Serialize_DivByZeroStruct(DivByZeroStruct* param, IWrapperSoapSerializer* pSZ, bool bArray = false)
{
if (bArray)
{
pSZ->serialize("<", Axis_TypeName_DivByZeroStruct, ">", NULL);
}
else
{
const AxisChar* sPrefix = pSZ->getNamespacePrefix(Axis_URI_DivByZeroStruct);
pSZ->serialize("<", Axis_TypeName_DivByZeroStruct, " xsi:type=\"", sPrefix, ":",
Axis_TypeName_DivByZeroStruct, "\" xmlns:", sPrefix, "=\"",
Axis_URI_DivByZeroStruct, "\">", NULL);
}
pSZ->serializeAsElement("varString", (void*)&(param->varString), XSD_STRING);
pSZ->serializeAsElement("varInt", (void*)&(param->varInt), XSD_INT);
pSZ->serializeAsElement("varFloat", (void*)&(param->varFloat), XSD_FLOAT);
pSZ->serialize("</", Axis_TypeName_DivByZeroStruct, ">", NULL);
return AXIS_SUCCESS;
}
/*
* This static method deserialize a DivByZeroStruct type of object
*/
int Axis_DeSerialize_DivByZeroStruct(DivByZeroStruct* param, IWrapperSoapDeSerializer* pIWSDZ)
{
param->varString = pIWSDZ->getElementAsString("varString",0);
param->varInt = pIWSDZ->getElementAsInt("varInt",0);
param->varFloat = pIWSDZ->getElementAsFloat("varFloat",0);
return pIWSDZ->getStatus();
}
void* Axis_Create_DivByZeroStruct(DivByZeroStruct* pObj, bool bArray = false, int nSize=0)
{
if (bArray && (nSize > 0))
{
if (pObj)
{
DivByZeroStruct* pNew = new DivByZeroStruct[nSize];
memcpy(pNew, pObj, sizeof(DivByZeroStruct)*nSize/2);
memset(pObj, 0, sizeof(DivByZeroStruct)*nSize/2);
delete [] pObj;
return pNew;
}
else
{
return new DivByZeroStruct[nSize];
}
}
else
return new DivByZeroStruct;
}
/*
* This static method delete a DivByZeroStruct type of object
*/
void Axis_Delete_DivByZeroStruct(DivByZeroStruct* param, bool bArray = false, int nSize=0)
{
if (bArray)
{
delete [] param;
}
else
{
delete param;
}
}
/*
* This static method gives the size of DivByZeroStruct type of object
*/
int Axis_GetSize_DivByZeroStruct()
{
return sizeof(DivByZeroStruct);
}
DivByZeroStruct::DivByZeroStruct()
{
/*do not allocate memory to any pointer members here
because deserializer will allocate memory anyway. */
}
DivByZeroStruct::~DivByZeroStruct()
{
/*delete any pointer and array members here*/
}
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/DivByZeroStruct.h
Index: DivByZeroStruct.h
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains functions to manipulate complex type DivByZeroStruct
*/
#if !defined(__DIVBYZEROSTRUCT_PARAM_H__INCLUDED_)
#define __DIVBYZEROSTRUCT_PARAM_H__INCLUDED_
#include <axis/server/AxisUserAPI.h>
/*Local name and the URI for the type*/
static const char* Axis_URI_DivByZeroStruct = "http://soapinterop.org/types";
static const char* Axis_TypeName_DivByZeroStruct = "DivByZeroStruct";
class DivByZeroStruct
{
public:
xsd__string varString;
int varInt;
float varFloat;
DivByZeroStruct();
virtual ~DivByZeroStruct();
};
#endif /* !defined(__DIVBYZEROSTRUCT_PARAM_H__INCLUDED_)*/
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/FaultMapping.wsdl
Index: FaultMapping.wsdl
===================================================================
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://soapinterop.org/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://soapinterop.org/types" targetNamespace="http://soapinterop.org/wsdl">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://soapinterop.org/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://soapinterop.org/types">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="DivByZeroStruct">
<sequence>
<element name="varString" type="xsd:string"/>
<element name="varInt" type="xsd:int"/>
<element name="varFloat" type="xsd:float"/>
</sequence>
</complexType>
<complexType name="SpecialDetailStruct">
<sequence>
<element name="varString" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="OutOfBoundStruct">
<sequence>
<element name="varString" type="xsd:string"/>
<element name="varInt" type="xsd:int"/>
<element name="specialDetail" type="tns:SpecialDetailStruct"/>
</sequence>
</complexType>
</schema>
</types>
<message name="DivByZeroFault">
<part name="faultstruct1" type="ns2:DivByZeroStruct"/>
</message>
<message name="OutOfBoundFault">
<part name="faultstruct1" type="ns2:OutOfBoundStruct"/>
</message>
<message name="SpecialDetailFault">
<part name="faultstruct1" type="ns2:SpecialDetailStruct"/>
</message>
<message name="divRequest">
<part name="int0" type="xsd:int"/>
<part name="int1" type="xsd:int"/>
</message>
<message name="divResponse">
<part name="addReturn" type="xsd:int"/>
</message>
<portType name="MathOps">
<operation name="div" parameterOrder ="int0 int1">
<input message="tns:divRequest"/>
<output message="tns:divResponse"/>
<fault name="DivByZero" message="tns:DivByZeroFault"/>
<fault name="OutOfBound" message="tns:OutOfBoundFault"/>
<fault name="NormalDetail" message="tns:SpecialDetailFault"/>
</operation>
</portType>
<binding name="MathOpsBinding" type="tns:MathOps">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="div">
<soap:operation soapAction="MathOps#div"/>
<input name="divRequest">
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost/axis/MathOps"
use="encoded"/>
</input>
<output name="divResponse">
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost/axis/MathOps"
use="encoded"/>
</output>
<fault name="DivByZero">
<soap:fault name="DivByZero" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://soapinterop.org/wsdl"/>
</fault>
<fault name="OutOfBound">
<soap:fault name="OutOfBound" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://soapinterop.org/wsdl"/>
</fault>
<fault name="NormalDetail">
<soap:fault name="NormalDetail" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://soapinterop.org/wsdl"/>
</fault>
</operation>
</binding>
<service name="MathOpsService">
<port name="MathOps" binding="tns:MathOpsBinding">
<soap:address location="http://localhost/axis/MathOps"/>
</port>
</service>
<!-- Fault messages -->
</definitions>
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/Makefile.am
Index: Makefile.am
===================================================================
bin_PROGRAMS = mathops
SUBDIRS =
AM_CPPFLAGS = $(CPPFLAGS)
mathops_SOURCES = OutOfBoundStruct.cpp AxisDivByZeroException.cpp AxisNormalDetailException.cpp MathOps.cpp SpecialDetailStruct.cpp AxisOutOfBoundException.cpp DivByZeroStruct.cpp ../MathOpsClient.cpp
mathops_LDADD = $(LDFLAGS)
INCLUDES = -I$(AXISCPP_HOME)/include
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/MathOps.cpp
Index: MathOps.cpp
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains Client Stub implementation for remote web service.
*/
#include "MathOps.h"
#include <axis/server/AxisWrapperAPI.h>
using namespace std;
extern int Axis_DeSerialize_DivByZeroStruct(DivByZeroStruct* param, IWrapperSoapDeSerializer* pDZ);
extern void* Axis_Create_DivByZeroStruct(DivByZeroStruct *Obj, bool bArray = false, int nSize=0);
extern void Axis_Delete_DivByZeroStruct(DivByZeroStruct* param, bool bArray = false, int nSize=0);
extern int Axis_Serialize_DivByZeroStruct(DivByZeroStruct* param, IWrapperSoapSerializer* pSZ, bool bArray = false);
extern int Axis_GetSize_DivByZeroStruct();
extern int Axis_DeSerialize_SpecialDetailStruct(SpecialDetailStruct* param, IWrapperSoapDeSerializer* pDZ);
extern void* Axis_Create_SpecialDetailStruct(SpecialDetailStruct *Obj, bool bArray = false, int nSize=0);
extern void Axis_Delete_SpecialDetailStruct(SpecialDetailStruct* param, bool bArray = false, int nSize=0);
extern int Axis_Serialize_SpecialDetailStruct(SpecialDetailStruct* param, IWrapperSoapSerializer* pSZ, bool bArray = false);
extern int Axis_GetSize_SpecialDetailStruct();
extern int Axis_DeSerialize_OutOfBoundStruct(OutOfBoundStruct* param, IWrapperSoapDeSerializer* pDZ);
extern void* Axis_Create_OutOfBoundStruct(OutOfBoundStruct *Obj, bool bArray = false, int nSize=0);
extern void Axis_Delete_OutOfBoundStruct(OutOfBoundStruct* param, bool bArray = false, int nSize=0);
extern int Axis_Serialize_OutOfBoundStruct(OutOfBoundStruct* param, IWrapperSoapSerializer* pSZ, bool bArray = false);
extern int Axis_GetSize_OutOfBoundStruct();
MathOps::MathOps(const char* pchEndpointUri, AXIS_PROTOCOL_TYPE eProtocol)
:Stub(pchEndpointUri, eProtocol)
{
}
MathOps::MathOps()
:Stub(" ", APTHTTP)
{
m_pCall->setEndpointURI("http://localhost/axis/MathOps");
}
MathOps::~MathOps()
{
}
/*Methods corresponding to the web service methods*/
/*
* This method wrap the service method div
*/
int MathOps::div(int Value0, int Value1)
{
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://soapinterop.org/wsdl");
applyUserPreferences();
m_pCall->addParameter((void*)&Value0, "int0", XSD_INT);
m_pCall->addParameter((void*)&Value1, "int1", XSD_INT);
if (AXIS_SUCCESS == m_pCall->invoke())
{
if(AXIS_SUCCESS == m_pCall->checkMessage("divResponse", "http://soapinterop.org/wsdl"))
{
Ret = m_pCall->getElementAsInt("addReturn", 0);
}
}
m_pCall->unInitialize();
return Ret;
}
catch(AxisException& e)
{
int iExceptionCode = e.getExceptionCode();
if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
{
throw;
}
else 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(0 == strcmp("OutOfBoundStruct", cFaultstring))
{
if (AXIS_SUCCESS == m_pCall->checkFault("faultdetail","http://localhost/axis/MathOps"))
{
OutOfBoundStruct* pFaultDetail = NULL;
pFaultDetail = (OutOfBoundStruct*)m_pCall->
getCmplxObject((void*) Axis_DeSerialize_OutOfBoundStruct,
(void*) Axis_Create_OutOfBoundStruct,
(void*) Axis_Delete_OutOfBoundStruct,"faultstruct1", 0);
/*User code to handle the struct can be inserted here*/
printf("faultcode:%s\n", cFaultcode);
printf("faultstring:%s\n", cFaultstring);
printf("faultactor:%s\n", cFaultactor);
m_pCall->unInitialize();
throw AxisOutOfBoundException(pFaultDetail);
}
}
else if(0 == strcmp("DivByZeroStruct", cFaultstring))
{
if (AXIS_SUCCESS == m_pCall->checkFault("faultdetail","http://localhost/axis/MathOps"))
{
DivByZeroStruct* pFaultDetail = NULL;
pFaultDetail = (DivByZeroStruct*)m_pCall->
getCmplxObject((void*) Axis_DeSerialize_DivByZeroStruct,
(void*) Axis_Create_DivByZeroStruct,
(void*) Axis_Delete_DivByZeroStruct,"faultstruct1", 0);
/*User code to handle the struct can be inserted here*/
printf("faultcode:%s\n", cFaultcode);
printf("faultstring:%s\n", cFaultstring);
printf("faultactor:%s\n", cFaultactor);
m_pCall->unInitialize();
throw AxisDivByZeroException(pFaultDetail);
}
}
else if(0 == strcmp("SpecialDetailStruct", cFaultstring))
{
if (AXIS_SUCCESS == m_pCall->checkFault("faultdetail","http://localhost/axis/MathOps"))
{
SpecialDetailStruct* pFaultDetail = NULL;
pFaultDetail = (SpecialDetailStruct*)m_pCall->
getCmplxObject((void*) Axis_DeSerialize_SpecialDetailStruct,
(void*) Axis_Create_SpecialDetailStruct,
(void*) Axis_Delete_SpecialDetailStruct,"faultstruct1", 0);
/*User code to handle the struct can be inserted here*/
printf("faultcode:%s\n", cFaultcode);
printf("faultstring:%s\n", cFaultstring);
printf("faultactor:%s\n", cFaultactor);
m_pCall->unInitialize();
throw AxisNormalDetailException(pFaultDetail);
}
}
else
{
cFaultdetail = m_pCall->getElementAsString("faultdetail", 0);
throw AxisException(cFaultdetail);
}
}
else throw;
}
}
int MathOps::getFaultDetail(char** ppcDetail)
{
return m_pCall->getFaultDetail(ppcDetail);
}
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/MathOps.h
Index: MathOps.h
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains Client Stub Class for remote web service
*/
#if !defined(__MATHOPS_CLIENTSTUB_H__INCLUDED_)
#define __MATHOPS_CLIENTSTUB_H__INCLUDED_
#include <axis/client/Stub.h>
/*include Exception header files here*/
#include "DivByZeroStruct.h"
#include "SpecialDetailStruct.h"
#include "OutOfBoundStruct.h"
#include "AxisOutOfBoundException.h"
#include "AxisDivByZeroException.h"
#include "AxisNormalDetailException.h"
class MathOps :public Stub
{
public:
MathOps(const char* pchEndpointUri, AXIS_PROTOCOL_TYPE eProtocol=APTHTTP);
MathOps();
public:
virtual ~MathOps();
public:
int div(int Value0,int Value1);
int getFaultDetail(char** ppcDetail);
};
#endif /* !defined(__MATHOPS_CLIENTSTUB_H__INCLUDED_)*/
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/OutOfBoundStruct.cpp
Index: OutOfBoundStruct.cpp
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains functions to manipulate complex type OutOfBoundStruct
*/
#include <malloc.h>
#include "OutOfBoundStruct.h"
#include <axis/server/AxisWrapperAPI.h>
extern int Axis_DeSerialize_SpecialDetailStruct(SpecialDetailStruct* param, IWrapperSoapDeSerializer* pDZ);
extern void* Axis_Create_SpecialDetailStruct(SpecialDetailStruct* pObj, bool bArray = false, int nSize=0);
extern void Axis_Delete_SpecialDetailStruct(SpecialDetailStruct* param, bool bArray = false, int nSize=0);
extern int Axis_Serialize_SpecialDetailStruct(SpecialDetailStruct* param, IWrapperSoapSerializer* pSZ, bool bArray = false);
extern int Axis_GetSize_SpecialDetailStruct();
/*
* This static method serialize a OutOfBoundStruct type of object
*/
int Axis_Serialize_OutOfBoundStruct(OutOfBoundStruct* param, IWrapperSoapSerializer* pSZ, bool bArray = false)
{
if (bArray)
{
pSZ->serialize("<", Axis_TypeName_OutOfBoundStruct, ">", NULL);
}
else
{
const AxisChar* sPrefix = pSZ->getNamespacePrefix(Axis_URI_OutOfBoundStruct);
pSZ->serialize("<", Axis_TypeName_OutOfBoundStruct, " xsi:type=\"", sPrefix, ":",
Axis_TypeName_OutOfBoundStruct, "\" xmlns:", sPrefix, "=\"",
Axis_URI_OutOfBoundStruct, "\">", NULL);
}
pSZ->serializeAsElement("varString", (void*)&(param->varString), XSD_STRING);
pSZ->serializeAsElement("varInt", (void*)&(param->varInt), XSD_INT);
Axis_Serialize_SpecialDetailStruct(param->specialDetail, pSZ);
pSZ->serialize("</", Axis_TypeName_OutOfBoundStruct, ">", NULL);
return AXIS_SUCCESS;
}
/*
* This static method deserialize a OutOfBoundStruct type of object
*/
int Axis_DeSerialize_OutOfBoundStruct(OutOfBoundStruct* param, IWrapperSoapDeSerializer* pIWSDZ)
{
param->varString = pIWSDZ->getElementAsString("varString",0);
param->varInt = pIWSDZ->getElementAsInt("varInt",0);
param->specialDetail = (SpecialDetailStruct*)pIWSDZ->getCmplxObject((void*)Axis_DeSerialize_SpecialDetailStruct
, (void*)Axis_Create_SpecialDetailStruct, (void*)Axis_Delete_SpecialDetailStruct
, "specialDetail", Axis_URI_SpecialDetailStruct);
return pIWSDZ->getStatus();
}
void* Axis_Create_OutOfBoundStruct(OutOfBoundStruct* pObj, bool bArray = false, int nSize=0)
{
if (bArray && (nSize > 0))
{
if (pObj)
{
OutOfBoundStruct* pNew = new OutOfBoundStruct[nSize];
memcpy(pNew, pObj, sizeof(OutOfBoundStruct)*nSize/2);
memset(pObj, 0, sizeof(OutOfBoundStruct)*nSize/2);
delete [] pObj;
return pNew;
}
else
{
return new OutOfBoundStruct[nSize];
}
}
else
return new OutOfBoundStruct;
}
/*
* This static method delete a OutOfBoundStruct type of object
*/
void Axis_Delete_OutOfBoundStruct(OutOfBoundStruct* param, bool bArray = false, int nSize=0)
{
if (bArray)
{
delete [] param;
}
else
{
delete param;
}
}
/*
* This static method gives the size of OutOfBoundStruct type of object
*/
int Axis_GetSize_OutOfBoundStruct()
{
return sizeof(OutOfBoundStruct);
}
OutOfBoundStruct::OutOfBoundStruct()
{
/*do not allocate memory to any pointer members here
because deserializer will allocate memory anyway. */
specialDetail=0;
}
OutOfBoundStruct::~OutOfBoundStruct()
{
/*delete any pointer and array members here*/
delete specialDetail;
}
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/OutOfBoundStruct.h
Index: OutOfBoundStruct.h
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains functions to manipulate complex type OutOfBoundStruct
*/
#if !defined(__OUTOFBOUNDSTRUCT_PARAM_H__INCLUDED_)
#define __OUTOFBOUNDSTRUCT_PARAM_H__INCLUDED_
#include <axis/server/AxisUserAPI.h>
#include "SpecialDetailStruct.h"
/*Local name and the URI for the type*/
static const char* Axis_URI_OutOfBoundStruct = "http://soapinterop.org/types";
static const char* Axis_TypeName_OutOfBoundStruct = "OutOfBoundStruct";
class SpecialDetailStruct;
class OutOfBoundStruct
{
public:
xsd__string varString;
int varInt;
SpecialDetailStruct* specialDetail;
OutOfBoundStruct();
virtual ~OutOfBoundStruct();
};
#endif /* !defined(__OUTOFBOUNDSTRUCT_PARAM_H__INCLUDED_)*/
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/SpecialDetailStruct.cpp
Index: SpecialDetailStruct.cpp
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains functions to manipulate complex type SpecialDetailStruct
*/
#include <malloc.h>
#include "SpecialDetailStruct.h"
#include <axis/server/AxisWrapperAPI.h>
/*
* This static method serialize a SpecialDetailStruct type of object
*/
int Axis_Serialize_SpecialDetailStruct(SpecialDetailStruct* param, IWrapperSoapSerializer* pSZ, bool bArray = false)
{
if (bArray)
{
pSZ->serialize("<", Axis_TypeName_SpecialDetailStruct, ">", NULL);
}
else
{
const AxisChar* sPrefix = pSZ->getNamespacePrefix(Axis_URI_SpecialDetailStruct);
pSZ->serialize("<", Axis_TypeName_SpecialDetailStruct, " xsi:type=\"", sPrefix, ":",
Axis_TypeName_SpecialDetailStruct, "\" xmlns:", sPrefix, "=\"",
Axis_URI_SpecialDetailStruct, "\">", NULL);
}
pSZ->serializeAsElement("varString", (void*)&(param->varString), XSD_STRING);
pSZ->serialize("</", Axis_TypeName_SpecialDetailStruct, ">", NULL);
return AXIS_SUCCESS;
}
/*
* This static method deserialize a SpecialDetailStruct type of object
*/
int Axis_DeSerialize_SpecialDetailStruct(SpecialDetailStruct* param, IWrapperSoapDeSerializer* pIWSDZ)
{
param->varString = pIWSDZ->getElementAsString("varString",0);
return pIWSDZ->getStatus();
}
void* Axis_Create_SpecialDetailStruct(SpecialDetailStruct* pObj, bool bArray = false, int nSize=0)
{
if (bArray && (nSize > 0))
{
if (pObj)
{
SpecialDetailStruct* pNew = new SpecialDetailStruct[nSize];
memcpy(pNew, pObj, sizeof(SpecialDetailStruct)*nSize/2);
memset(pObj, 0, sizeof(SpecialDetailStruct)*nSize/2);
delete [] pObj;
return pNew;
}
else
{
return new SpecialDetailStruct[nSize];
}
}
else
return new SpecialDetailStruct;
}
/*
* This static method delete a SpecialDetailStruct type of object
*/
void Axis_Delete_SpecialDetailStruct(SpecialDetailStruct* param, bool bArray = false, int nSize=0)
{
if (bArray)
{
delete [] param;
}
else
{
delete param;
}
}
/*
* This static method gives the size of SpecialDetailStruct type of object
*/
int Axis_GetSize_SpecialDetailStruct()
{
return sizeof(SpecialDetailStruct);
}
SpecialDetailStruct::SpecialDetailStruct()
{
/*do not allocate memory to any pointer members here
because deserializer will allocate memory anyway. */
}
SpecialDetailStruct::~SpecialDetailStruct()
{
/*delete any pointer and array members here*/
}
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/SpecialDetailStruct.h
Index: SpecialDetailStruct.h
===================================================================
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains functions to manipulate complex type SpecialDetailStruct
*/
#if !defined(__SPECIALDETAILSTRUCT_PARAM_H__INCLUDED_)
#define __SPECIALDETAILSTRUCT_PARAM_H__INCLUDED_
#include <axis/server/AxisUserAPI.h>
/*Local name and the URI for the type*/
static const char* Axis_URI_SpecialDetailStruct = "http://soapinterop.org/types";
static const char* Axis_TypeName_SpecialDetailStruct = "SpecialDetailStruct";
class SpecialDetailStruct
{
public:
xsd__string varString;
SpecialDetailStruct();
virtual ~SpecialDetailStruct();
};
#endif /* !defined(__SPECIALDETAILSTRUCT_PARAM_H__INCLUDED_)*/
1.1 ws-axis/c/tests/client/fault_mapping/gen_src/gen.sh
Index: gen.sh
===================================================================
#!/bin/bash
java org.apache.axis.wsdl.wsdl2ws.WSDL2Ws FaultMapping.wsdl -lc++ -sclient