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/05/28 05:19:35 UTC
cvs commit: ws-axis/c/samples/server/doclitfault DivByZeroFault.h MathOps.cpp MathOps.h MathOpsWrapper.cpp MathOpsWrapper.h MathOps_doclit.wsdl
damitha 2004/05/27 20:19:35
Modified: c/samples/server/doclitfault DivByZeroFault.h MathOps.cpp
MathOps.h MathOpsWrapper.cpp MathOpsWrapper.h
MathOps_doclit.wsdl
Log:
Revision Changes Path
1.3 +1 -1 ws-axis/c/samples/server/doclitfault/DivByZeroFault.h
Index: DivByZeroFault.h
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/DivByZeroFault.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DivByZeroFault.h 27 May 2004 11:50:41 -0000 1.2
+++ DivByZeroFault.h 28 May 2004 03:19:35 -0000 1.3
@@ -20,7 +20,7 @@
int varInt;
float varFloat;
DivByZeroFault();
- ~DivByZeroFault();
+ virtual ~DivByZeroFault();
};
#endif /* !defined(__DIVBYZEROFAULT_PARAM_H__INCLUDED_)*/
1.3 +3 -1 ws-axis/c/samples/server/doclitfault/MathOps.cpp
Index: MathOps.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/MathOps.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MathOps.cpp 27 May 2004 11:50:41 -0000 1.2
+++ MathOps.cpp 28 May 2004 03:19:35 -0000 1.3
@@ -14,6 +14,8 @@
{
}
-int MathOps::div(int Value0, int Value1)
+int MathOps::div(int Value0, int Value1) throw(AxisDivByZeroException)
{
+ if (Value1 == 0) throw AxisDivByZeroException();
+ return Value0/Value1;
}
1.3 +2 -1 ws-axis/c/samples/server/doclitfault/MathOps.h
Index: MathOps.h
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/MathOps.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MathOps.h 27 May 2004 11:50:41 -0000 1.2
+++ MathOps.h 28 May 2004 03:19:35 -0000 1.3
@@ -9,6 +9,7 @@
#include <axis/server/AxisUserAPI.h>
#include "DivByZeroFault.h"
+#include "AxisDivByZeroException.h"
class MathOps
{
@@ -17,7 +18,7 @@
public:
virtual ~MathOps();
public:
- int div(int Value0,int Value1);
+ int div(int Value0,int Value1) throw(AxisDivByZeroException);
};
#endif /* !defined(__MATHOPS_SERVERSKELETON_H__INCLUDED_)*/
1.3 +21 -2 ws-axis/c/samples/server/doclitfault/MathOpsWrapper.cpp
Index: MathOpsWrapper.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/MathOpsWrapper.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MathOpsWrapper.cpp 27 May 2004 11:50:41 -0000 1.2
+++ MathOpsWrapper.cpp 28 May 2004 03:19:35 -0000 1.3
@@ -56,10 +56,11 @@
/*
* This method wrap the service method
*/
-int MathOpsWrapper::div(void* pMsg)
+int MathOpsWrapper::div(void* pMsg) throw(AxisDivByZeroException)
{
IMessageData* mc = (IMessageData*)pMsg;
int nStatus;
+ int ret;
IWrapperSoapSerializer *pIWSSZ = NULL;
mc->getSoapSerializer(&pIWSSZ);
if (!pIWSSZ) return AXIS_FAIL;
@@ -72,7 +73,25 @@
int v0 = pIWSDZ->getElementAsInt("int0",0);
int v1 = pIWSDZ->getElementAsInt("int1",0);
if (AXIS_SUCCESS != (nStatus = pIWSDZ->getStatus())) return nStatus;
- int ret = pWs->div(v0,v1);
+ try
+ {
+ ret = pWs->div(v0,v1);
+ }
+ catch(AxisDivByZeroException& e)
+ {
+ pIWSSZ->createSoapFault("DivByZeroFault", "http://soapinterop.org/");
+ DivByZeroFault* pObjFault = new DivByZeroFault();
+ pObjFault->varString = "Division by zero exception";
+ pObjFault->varInt = 1;
+ pObjFault->varFloat = 10.52;
+
+ if(pObjFault)
+ pIWSSZ->addFaultDetail(pObjFault, (void*)Axis_Serialize_DivByZeroFault,
+ (void*)Axis_Delete_DivByZeroFault, "DivByZeroException",
+ Axis_URI_DivByZeroFault);
+
+ throw;
+ }
return pIWSSZ->addOutputParam("divReturn", (void*)&ret, XSD_INT);
}
1.3 +3 -2 ws-axis/c/samples/server/doclitfault/MathOpsWrapper.h
Index: MathOpsWrapper.h
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/MathOpsWrapper.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MathOpsWrapper.h 27 May 2004 11:50:41 -0000 1.2
+++ MathOpsWrapper.h 28 May 2004 03:19:35 -0000 1.3
@@ -11,6 +11,7 @@
#include <axis/server/IMessageData.h>
#include <axis/server/GDefine.h>
#include <axis/server/AxisWrapperAPI.h>
+#include "AxisDivByZeroException.h"
class MathOpsWrapper : public WrapperClassHandler
{
@@ -25,9 +26,9 @@
void AXISCALL onFault(void* pMsg);
int AXISCALL init();
int AXISCALL fini();
- AXIS_BINDING_STYLE AXISCALL getBindingStyle(){return RPC_ENCODED;};
+ AXIS_BINDING_STYLE AXISCALL getBindingStyle(){return DOC_LITERAL;};
private:/*Methods corresponding to the web service methods*/
- int div(void* pMsg);
+ int div(void* pMsg) throw(AxisDivByZeroException);
};
#endif /* !defined(__MATHOPSWRAPPER_SERVERWRAPPER_H__INCLUDED_)*/
1.3 +1 -1 ws-axis/c/samples/server/doclitfault/MathOps_doclit.wsdl
Index: MathOps_doclit.wsdl
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/MathOps_doclit.wsdl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MathOps_doclit.wsdl 27 May 2004 11:17:49 -0000 1.2
+++ MathOps_doclit.wsdl 28 May 2004 03:19:35 -0000 1.3
@@ -71,7 +71,7 @@
</fault>
</operation>
</binding>
- <service name="MathOpsService">
+ <service name="MathOpsDLService">
<port name="MathOpsPort" binding="tns:MathOpsBinding">
<soap:address location="http://localhost/axis/MathOpsPort"/>
</port>