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/27 13:50:41 UTC

cvs commit: ws-axis/c/samples/server/doclitfault deploy.wsdd undeploy.wsdd DivByZeroFault.cpp DivByZeroFault.h MathOps.cpp MathOps.h MathOpsService.cpp MathOpsWrapper.cpp MathOpsWrapper.h

damitha     2004/05/27 04:50:41

  Modified:    c/samples/server/doclitfault DivByZeroFault.cpp
                        DivByZeroFault.h MathOps.cpp MathOps.h
                        MathOpsService.cpp MathOpsWrapper.cpp
                        MathOpsWrapper.h
  Added:       c/samples/server/doclitfault deploy.wsdd undeploy.wsdd
  Log:
  
  
  Revision  Changes    Path
  1.2       +51 -40    ws-axis/c/samples/server/doclitfault/DivByZeroFault.cpp
  
  Index: DivByZeroFault.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/DivByZeroFault.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DivByZeroFault.cpp	27 May 2004 09:34:11 -0000	1.1
  +++ DivByZeroFault.cpp	27 May 2004 11:50:41 -0000	1.2
  @@ -1,15 +1,16 @@
  -///////////////////////////////////////////////////////////////////////////////////
  -//This file is automatically generated by the Axis C++ Wrapper Class Generator
  -//Web service wrapper class's implementation generated by Axis WCG
  -//Parameters and wrapper methos to manipulate DivByZeroFault
  -////////////////////////////////////////////////////////////////////////////////////
  +/*
  + *This file is automatically generated by the Axis C++ Wrapper Class Generator
  + *Web service wrapper class's implementation generated by Axis WCG
  + *Parameters and wrapper methos to manipulate DivByZeroFault
  + */
   
  +#include <malloc.h>
   #include "DivByZeroFault.h"
   #include <axis/server/AxisWrapperAPI.h>
   
  -/////////////////////////////////////////////////////////////////////////////
  -// This static method serialize a DivByZeroFault type of object
  -//////////////////////////////////////////////////////////////////////
  +/*
  + * This static method serialize a DivByZeroFault type of object
  + */
   int Axis_Serialize_DivByZeroFault(DivByZeroFault* param, IWrapperSoapSerializer* pSZ, bool bArray = false)
   {
   	if (bArray)
  @@ -19,53 +20,53 @@
   	else
   	{
   		const AxisChar* sPrefix = pSZ->getNamespacePrefix(Axis_URI_DivByZeroFault);
  -		pSZ->serialize("<" ,Axis_TypeName_DivByZeroFault ," xsi:type=\"" ,sPrefix ,":"
  -			, Axis_TypeName_DivByZeroFault , "\" xmlns:" , sPrefix , "=\""
  -			, Axis_URI_DivByZeroFault , "\">", NULL);
  +		pSZ->serialize("<", Axis_TypeName_DivByZeroFault, " xsi:type=\"", sPrefix, ":",
  +			Axis_TypeName_DivByZeroFault, "\" xmlns:", sPrefix, "=\"",
  +			Axis_URI_DivByZeroFault, "\">", 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_DivByZeroFault , ">", NULL);
  +	pSZ->serialize("</", Axis_TypeName_DivByZeroFault, ">", NULL);
   	return AXIS_SUCCESS;
   }
   
  -/////////////////////////////////////////////////////////////////////////////
  -// This static method deserialize a DivByZeroFault type of object
  -//////////////////////////////////////////////////////////////////////
  +/*
  + * This static method deserialize a DivByZeroFault type of object
  + */
   int Axis_DeSerialize_DivByZeroFault(DivByZeroFault* param, IWrapperSoapDeSerializer *pIWSDZ)
   {
  -	param->varString = pIWSDZ->getElementAsString("varString", 0);
  -	param->varInt = pIWSDZ->getElementAsInt("varInt", 0);
  -	param->varFloat = pIWSDZ->getElementAsFloat("varFloat", 0);
  +	param->varString = pIWSDZ->getElementAsString("varString",0);
  +	param->varInt = pIWSDZ->getElementAsInt("varInt",0);
  +	param->varFloat = pIWSDZ->getElementAsFloat("varFloat",0);
   	return pIWSDZ->getStatus();
   }
  -void* Axis_Create_DivByZeroFault(DivByZeroFault* param, bool bArray = false, int nSize=0)
  +void* Axis_Create_DivByZeroFault(DivByZeroFault* pObj, bool bArray = false, int nSize=0)
   {
   	if (bArray && (nSize > 0))
  -        {
  -            if(param)
  -            {
  -                DivByZeroFault* pNew = new DivByZeroFault[nSize];
  -                memcpy(pNew, param, sizeof(DivByZeroFault)*nSize/2);
  -                memset(param, 0, sizeof(DivByZeroFault)*nSize/2);
  -                delete [] param;
  -                return pNew;
  -            }
  -            else
  -            {
  -                return new DivByZeroFault[nSize];
  -            }
  -        }
  +	{
  +		if (pObj)
  +		{
  +			DivByZeroFault* pNew = new DivByZeroFault[nSize];
  +			memcpy(pNew, pObj, sizeof(DivByZeroFault)*nSize/2);
  +			memset(pObj, 0, sizeof(DivByZeroFault)*nSize/2);
  +			delete [] pObj;
  +			return pNew;
  +		}
  +		else
  +		{
  +			return new DivByZeroFault[nSize];
  +		}
  +	}
   	else
   		return new DivByZeroFault;
   }
   
  -/////////////////////////////////////////////////////////////////////////////
  -// This static method delete a DivByZeroFault type of object
  -//////////////////////////////////////////////////////////////////////
  +/*
  + * This static method delete a DivByZeroFault type of object
  + */
   void Axis_Delete_DivByZeroFault(DivByZeroFault* param, bool bArray = false, int nSize=0)
   {
   	if (bArray)
  @@ -74,14 +75,24 @@
   	}
   	else
   	{
  -		//delete any pointer members or array members of this struct here
   		delete param;
   	}
   }
  -/////////////////////////////////////////////////////////////////////////////
  -// This static method gives the size of DivByZeroFault type of object
  -//////////////////////////////////////////////////////////////////////
  +/*
  + * This static method gives the size of DivByZeroFault type of object
  + */
   int Axis_GetSize_DivByZeroFault()
   {
   	return sizeof(DivByZeroFault);
  +}
  +
  +DivByZeroFault::DivByZeroFault()
  +{
  +	/*do not allocate memory to any pointer members here
  +	 because deserializer will allocate memory anyway. */
  +}
  +
  +DivByZeroFault::~DivByZeroFault()
  +{
  +	/*delete any pointer and array members here*/
   }
  
  
  
  1.2       +10 -10    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DivByZeroFault.h	27 May 2004 09:34:11 -0000	1.1
  +++ DivByZeroFault.h	27 May 2004 11:50:41 -0000	1.2
  @@ -1,16 +1,16 @@
  -///////////////////////////////////////////////////////////////////////////////////
  -//This file is automatically generated by the Axis C++ Wrapper Class Generator
  -//Web service wrapper class's implementation generated by Axis WCG
  -//Parameters and wrapper methos to manipulate DivByZeroFault
  -////////////////////////////////////////////////////////////////////////////////////
  +/*
  + *This file is automatically generated by the Axis C++ Wrapper Class Generator
  + *Web service wrapper class's implementation generated by Axis WCG
  + *Parameters and wrapper methos to manipulate DivByZeroFault
  + */
   
   #if !defined(__DIVBYZEROFAULT_PARAM_H__INCLUDED_)
   #define __DIVBYZEROFAULT_PARAM_H__INCLUDED_
   
   #include <axis/server/AxisUserAPI.h>
   
  -//Local name and the URI for the type
  -static const char* Axis_URI_DivByZeroFault = "http://soapinterop.org/types";
  +/*Local name and the URI for the type*/
  +static const char* Axis_URI_DivByZeroFault = "http://localhost/axis/MathOps/types";
   static const char* Axis_TypeName_DivByZeroFault = "DivByZeroFault";
   
   class DivByZeroFault
  @@ -19,8 +19,8 @@
   	xsd__string varString;
   	int varInt;
   	float varFloat;
  -        DivByZeroFault();
  -        ~DivByZeroFault();
  +	DivByZeroFault();
  +	~DivByZeroFault();
   };
   
  -#endif // !defined(__DIVBYZEROFAULT_PARAM_H__INCLUDED_)
  +#endif /* !defined(__DIVBYZEROFAULT_PARAM_H__INCLUDED_)*/
  
  
  
  1.2       +6 -8      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MathOps.cpp	27 May 2004 09:34:11 -0000	1.1
  +++ MathOps.cpp	27 May 2004 11:50:41 -0000	1.2
  @@ -1,8 +1,8 @@
  -///////////////////////////////////////////////////////////////////////
  -//This is the Service implementation CPP file genarated by theWSDL2Ws.
  -//		MathOps.cpp: implemtation for the MathOps.
  -//
  -//////////////////////////////////////////////////////////////////////
  +/*
  + *This is the Service implementation CPP file genarated by theWSDL2Ws.
  + *		MathOps.cpp: implemtation for the MathOps.
  + *
  + */
   #include "MathOps.h"
   
   
  @@ -14,8 +14,6 @@
   {
   }
   
  -int  MathOps::div(int Value0, int Value1) throw(AxisDivByZeroException)
  +int MathOps::div(int Value0, int Value1)
   {
  -    if (Value1 == 0) throw AxisDivByZeroException();
  -        return Value0/Value1;
   }
  
  
  
  1.2       +7 -8      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MathOps.h	27 May 2004 09:34:11 -0000	1.1
  +++ MathOps.h	27 May 2004 11:50:41 -0000	1.2
  @@ -1,15 +1,14 @@
  -/////////////////////////////////////////////////////////////////////////////
  -// This is the Service Class genarated by the tool WSDL2Ws
  -//		MathOps.h: interface for the MathOpsclass.
  -//
  -//////////////////////////////////////////////////////////////////////
  +/*
  + * This is the Service Class genarated by the tool WSDL2Ws
  + * MathOps.h: interface for the MathOpsclass.
  + *
  + */
   #if !defined(__MATHOPS_SERVERSKELETON_H__INCLUDED_)
   #define __MATHOPS_SERVERSKELETON_H__INCLUDED_
   
   #include <axis/server/AxisUserAPI.h>
   
   #include "DivByZeroFault.h"
  -#include "AxisDivByZeroException.h"
   
   class MathOps 
   {
  @@ -18,7 +17,7 @@
   	public:
   		virtual ~MathOps();
   	public: 
  -		int  div(int value0, int value1) throw(AxisDivByZeroException);
  +		int div(int Value0,int Value1);
   };
   
  -#endif // !defined(__MATHOPS_SERVERSKELETON_H__INCLUDED_)
  +#endif /* !defined(__MATHOPS_SERVERSKELETON_H__INCLUDED_)*/
  
  
  
  1.2       +7 -7      ws-axis/c/samples/server/doclitfault/MathOpsService.cpp
  
  Index: MathOpsService.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/server/doclitfault/MathOpsService.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MathOpsService.cpp	27 May 2004 09:34:11 -0000	1.1
  +++ MathOpsService.cpp	27 May 2004 11:50:41 -0000	1.2
  @@ -1,5 +1,5 @@
  -//		This file is automatically generated by the Axis C++ Wrapper Class Generator
  -//		Service file containing the two export functions of the Web service Library
  +/*This file is automatically generated by the Axis C++ Wrapper Class Generator
  + *Service file containing the two export functions of the Web service Library*/
   #ifdef WIN32
   #define STORAGE_CLASS_INFO __declspec(dllexport)
   #else
  @@ -10,13 +10,13 @@
   STORAGE_CLASS_INFO
   int GetClassInstance(BasicHandler **inst)
   {
  -        *inst = new BasicHandler();
  +	*inst = new BasicHandler();
   	WrapperClassHandler* pWCH = new MathOpsWrapper();
  -        (*inst)->_functions = 0;
  +	(*inst)->_functions = 0;
   	if (pWCH)
   	{
  -                (*inst)->_object = pWCH;
  -                return pWCH->init();
  +		(*inst)->_object = pWCH;
  +		return pWCH->init();
   	}
   	return AXIS_FAIL;
   }
  @@ -28,7 +28,7 @@
   		WrapperClassHandler* pWCH = reinterpret_cast<WrapperClassHandler*>(inst);
   		pWCH->fini();
   		delete pWCH;
  -                delete inst;
  +		delete inst;
   		return AXIS_SUCCESS;
   	}
   	return AXIS_FAIL;
  
  
  
  1.2       +29 -48    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MathOpsWrapper.cpp	27 May 2004 09:34:11 -0000	1.1
  +++ MathOpsWrapper.cpp	27 May 2004 11:50:41 -0000	1.2
  @@ -1,15 +1,15 @@
  -///////////////////////////////////////////////////////////////////////
  -//This is the Service implementation CPP file genarated by theWSDL2Ws.
  -//		MathOpsWrapper.cpp: implemtation for the MathOpsWrapper.
  -//
  -//////////////////////////////////////////////////////////////////////
  +/*
  + * This is the Service implementation CPP file genarated by theWSDL2Ws.
  + * MathOpsWrapper.cpp: implemtation for the MathOpsWrapper.
  + * 
  + */
   
   #include "MathOpsWrapper.h"
   
   extern int Axis_DeSerialize_DivByZeroFault(DivByZeroFault* param, IWrapperSoapDeSerializer *pDZ);
  -extern void* Axis_Create_DivByZeroFault(bool bArray = false, int nSize=0);
  +extern void* Axis_Create_DivByZeroFault(DivByZeroFault *Obj, bool bArray = false, int nSize=0);
   extern void Axis_Delete_DivByZeroFault(DivByZeroFault* param, bool bArray = false, int nSize=0);
  -extern int Axis_Serialize_DivByZeroFault(DivByZeroFault* param, IWrapperSoapSerializer& pSZ, bool bArray = false);
  +extern int Axis_Serialize_DivByZeroFault(DivByZeroFault* param, IWrapperSoapSerializer* pSZ, bool bArray = false);
   extern int Axis_GetSize_DivByZeroFault();
   
   MathOpsWrapper::MathOpsWrapper()
  @@ -22,7 +22,7 @@
   	delete pWs;
   }
   
  -//implementation of WrapperClassHandler interface
  +/*implementation of WrapperClassHandler interface*/
   void MathOpsWrapper::onFault(void *pMsg)
   {
   }
  @@ -38,12 +38,12 @@
   }
   
   
  -/////////////////////////////////////////////////////////////////
  -// This method invokes the right service method 
  -//////////////////////////////////////////////////////////////////
  -int MathOpsWrapper::invoke(void* pMsg)
  +/*
  + * This method invokes the right service method 
  + */
  +int MathOpsWrapper::invoke(void *pMsg)
   {
  -        IMessageData* mc = (IMessageData*)pMsg;
  +	IMessageData* mc = (IMessageData*)pMsg;
   	const AxisChar *method = mc->getOperationName();
   	if (0 == strcmp(method, "div"))
   		return div(mc);
  @@ -51,47 +51,28 @@
   }
   
   
  -//Methods corresponding to the web service methods
  +/*Methods corresponding to the web service methods*/
   
  -/////////////////////////////////////////////////////////////////
  -// This method wrap the service method 
  -//////////////////////////////////////////////////////////////////
  -int MathOpsWrapper::div(void* pMsg) throw(AxisDivByZeroException)
  -{
  -        IMessageData* mc = (IMessageData*)pMsg;
  -        int nStatus;
  -        int ret;
  +/*
  + * This method wrap the service method 
  + */
  +int MathOpsWrapper::div(void* pMsg)
  +{
  +	IMessageData* mc = (IMessageData*)pMsg;
  +	int nStatus;
   	IWrapperSoapSerializer *pIWSSZ = NULL;
   	mc->getSoapSerializer(&pIWSSZ);
   	if (!pIWSSZ) return AXIS_FAIL;
   	IWrapperSoapDeSerializer *pIWSDZ = NULL;
   	mc->getSoapDeSerializer(&pIWSDZ);
   	if (!pIWSDZ) return AXIS_FAIL;
  -        /* check whether we have got correct message */
  -        if (AXIS_SUCCESS != pIWSDZ->checkMessageBody("div", "http://soapinterop.org/types")) return AXIS_FAIL;
  -	pIWSSZ->createSoapMethod("divResponse", "http://soapinterop.org/types");
  -        int v0 = pIWSDZ->getElementAsInt("in0",0);
  -        int v1 = pIWSDZ->getElementAsInt("in1",0);
  -        if (AXIS_SUCCESS != (nStatus = pIWSDZ->getStatus())) return nStatus;
  -	 try
  -        {
  -            ret = pWs->div(v0,v1);
  -        }
  -        catch(AxisDivByZeroException& e)
  -        {
  -            pIWSSZ->createSoapFault("SOAPStructFault", "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);
  +	/* check whether we have got correct message */
  +	if (AXIS_SUCCESS != pIWSDZ->checkMessageBody("div", "http://soapinterop.org/wsdl")) return AXIS_FAIL;
  +	pIWSSZ->createSoapMethod("divResponse", "http://soapinterop.org/wsdl");
  +	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);
  +	return pIWSSZ->addOutputParam("divReturn", (void*)&ret, XSD_INT);
   }
   
  
  
  
  1.2       +11 -12    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MathOpsWrapper.h	27 May 2004 09:34:11 -0000	1.1
  +++ MathOpsWrapper.h	27 May 2004 11:50:41 -0000	1.2
  @@ -1,8 +1,8 @@
  -/////////////////////////////////////////////////////////////////////////////
  -// This is the Service Class genarated by the tool WSDL2Ws
  -//		MathOpsWrapper.h: interface for the MathOpsWrapperclass.
  -//
  -//////////////////////////////////////////////////////////////////////
  +/*
  + * This is the Service Class genarated by the tool WSDL2Ws
  + *		MathOpsWrapper.h: interface for the MathOpsWrapperclass.
  + *
  + */
   #if !defined(__MATHOPSWRAPPER_SERVERWRAPPER_H__INCLUDED_)
   #define __MATHOPSWRAPPER_SERVERWRAPPER_H__INCLUDED_
   
  @@ -11,24 +11,23 @@
   #include <axis/server/IMessageData.h>
   #include <axis/server/GDefine.h>
   #include <axis/server/AxisWrapperAPI.h>
  -#include "AxisDivByZeroException.h"
   
   class MathOpsWrapper : public WrapperClassHandler
   {
  -private:// Actual web service object
  +private:/* Actual web service object*/
   	MathOps *pWs;
   public:
   	MathOpsWrapper();
   public:
   	virtual ~MathOpsWrapper();
  -public://implementation of WrapperClassHandler interface
  +public:/*implementation of WrapperClassHandler interface*/
   	int AXISCALL invoke(void* pMsg);
   	void AXISCALL onFault(void* pMsg);
   	int AXISCALL init();
   	int AXISCALL fini();
  -        AXIS_BINDING_STYLE AXISCALL getBindingStyle(){return DOC_LITERAL;};
  -private://Methods corresponding to the web service methods
  -	int div(void* pMsg) throw(AxisDivByZeroException);
  +	AXIS_BINDING_STYLE AXISCALL getBindingStyle(){return RPC_ENCODED;};
  +private:/*Methods corresponding to the web service methods*/
  +	int div(void* pMsg);
   };
   
  -#endif // !defined(__MATHOPSWRAPPER_SERVERWRAPPER_H__INCLUDED_)
  +#endif /* !defined(__MATHOPSWRAPPER_SERVERWRAPPER_H__INCLUDED_)*/
  
  
  
  1.1                  ws-axis/c/samples/server/doclitfault/deploy.wsdd
  
  Index: deploy.wsdd
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:CPP="http://xml.apache.org/axis/wsdd/providers/CPP">
  	<service name="MathOpsService" provider="CPP:RPC" description="Axis C++ web service">
  		<parameter name="className" value="/user/local/apache/axis/MathOpsService.so"/>
  		<parameter name="allowedMethods" value="div "/>
  	</service>
  </deployment>
  
  
  
  1.1                  ws-axis/c/samples/server/doclitfault/undeploy.wsdd
  
  Index: undeploy.wsdd
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <undeployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:CPP="http://xml.apache.org/axis/wsdd/providers/CPP">
  	<service name="MathOpsService"/>
  </undeployment>