You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by su...@apache.org on 2003/10/16 10:12:23 UTC

cvs commit: ws-axis/c/src/soap SoapBody.cpp

susantha    2003/10/16 01:12:23

  Modified:    c/src/client Call.cpp
               c/src/server/samples/cppservicewrapper CPPServiceWrapper.cpp
               c/src/server/samples/simplewebservice/webservicewrapper
                        WebServiceWrapper.cpp
               c/src/soap SoapBody.cpp
  Log:
  Fixed bug of server sending empty soap body.
  Fixed few problems in the samples
  
  Revision  Changes    Path
  1.17      +29 -17    ws-axis/c/src/client/Call.cpp
  
  Index: Call.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/client/Call.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Call.cpp	13 Oct 2003 05:03:13 -0000	1.16
  +++ Call.cpp	16 Oct 2003 08:12:23 -0000	1.17
  @@ -66,7 +66,7 @@
   #include "Call.h"
   #include "../common/AxisConfig.h"
   #include "transport/axis/AxisTransport.h"
  -
  +#include "transport/axis/Channel.hpp"
   //////////////////////////////////////////////////////////////////////
   // Construction/Destruction
   //////////////////////////////////////////////////////////////////////
  @@ -317,27 +317,39 @@
   	   Initialize re-usable objects of this instance (objects may have been populated by
   	   the previous call.
   	 */
  -	InitializeObjects();
  -	m_Soap.sessionid = "somesessionid1234";
  -	if (SUCCESS != OpenConnection()) return FAIL;
  -	if (m_pAxisEngine) delete m_pAxisEngine;
  -	m_pAxisEngine = new ClientAxisEngine();
  -	if (!m_pAxisEngine) return FAIL;
  -	if (SUCCESS == m_pAxisEngine->Initialize())
  -	{
  -		m_pMsgData = m_pAxisEngine->GetMessageData();
  -		if (m_pMsgData)
  +	try {
  +		InitializeObjects();
  +		m_Soap.sessionid = "somesessionid1234";
  +		if (SUCCESS != OpenConnection()) return FAIL;
  +		if (m_pAxisEngine) delete m_pAxisEngine;
  +		m_pAxisEngine = new ClientAxisEngine();
  +		if (!m_pAxisEngine) return FAIL;
  +		if (SUCCESS == m_pAxisEngine->Initialize())
   		{
  -			m_pMsgData->getSoapSerializer((IWrapperSoapSerializer**)(&m_pIWSSZ));
  -			m_pMsgData->getSoapDeSerializer((IWrapperSoapDeSerializer**)(&m_pIWSDZ));
  -			if (m_pIWSSZ && m_pIWSDZ)
  +			m_pMsgData = m_pAxisEngine->GetMessageData();
  +			if (m_pMsgData)
   			{
  -				return SUCCESS;
  +				m_pMsgData->getSoapSerializer((IWrapperSoapSerializer**)(&m_pIWSSZ));
  +				m_pMsgData->getSoapDeSerializer((IWrapperSoapDeSerializer**)(&m_pIWSDZ));
  +				if (m_pIWSSZ && m_pIWSDZ)
  +				{
  +					return SUCCESS;
  +				}
   			}
  +			return SUCCESS;
   		}
  -		return SUCCESS;
  +		return FAIL;
  +	}
  +	catch (ChannelException e)
  +	{
  +		printf(e.GetErr().c_str());
  +		return FAIL;
  +	}
  +	catch (...)
  +	{
  +		printf("Unknown exception occured in the client");
  +		return FAIL;
   	}
  -	return FAIL;
   }
   
   void Call::InitializeObjects()
  
  
  
  1.11      +3 -3      ws-axis/c/src/server/samples/cppservicewrapper/CPPServiceWrapper.cpp
  
  Index: CPPServiceWrapper.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/server/samples/cppservicewrapper/CPPServiceWrapper.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- CPPServiceWrapper.cpp	15 Oct 2003 06:11:29 -0000	1.10
  +++ CPPServiceWrapper.cpp	16 Oct 2003 08:12:23 -0000	1.11
  @@ -59,13 +59,13 @@
   
   int Axis_DeSerialize_Triangle(Triangle* p, IWrapperSoapDeSerializer *pDZ)
   {
  -	p->p1 = (Point*)pIWSDZ->GetObject((AXIS_DESERIALIZE_FUNCT)Axis_DeSerialize_Point, 
  +	p->p1 = (Point*)pDZ->GetObject((AXIS_DESERIALIZE_FUNCT)Axis_DeSerialize_Point, 
   		(AXIS_OBJECT_CREATE_FUNCT)Axis_Create_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point, 
   		Axis_TypeName_Point, Axis_URI_Point);
  -	p->p2 = (Point*)pIWSDZ->GetObject((AXIS_DESERIALIZE_FUNCT)Axis_DeSerialize_Point, 
  +	p->p2 = (Point*)pDZ->GetObject((AXIS_DESERIALIZE_FUNCT)Axis_DeSerialize_Point, 
   		(AXIS_OBJECT_CREATE_FUNCT)Axis_Create_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point, 
   		Axis_TypeName_Point, Axis_URI_Point);
  -	p->p3 = (Point*)pIWSDZ->GetObject((AXIS_DESERIALIZE_FUNCT)Axis_DeSerialize_Point, 
  +	p->p3 = (Point*)pDZ->GetObject((AXIS_DESERIALIZE_FUNCT)Axis_DeSerialize_Point, 
   		(AXIS_OBJECT_CREATE_FUNCT)Axis_Create_Point, (AXIS_OBJECT_DELETE_FUNCT)Axis_Delete_Point, 
   		Axis_TypeName_Point, Axis_URI_Point);
   	return SUCCESS;
  
  
  
  1.7       +6 -4      ws-axis/c/src/server/samples/simplewebservice/webservicewrapper/WebServiceWrapper.cpp
  
  Index: WebServiceWrapper.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/server/samples/simplewebservice/webservicewrapper/WebServiceWrapper.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WebServiceWrapper.cpp	15 Oct 2003 06:11:29 -0000	1.6
  +++ WebServiceWrapper.cpp	16 Oct 2003 08:12:23 -0000	1.7
  @@ -177,13 +177,14 @@
   	//SetResponseMethod(mc, "EchoResponse");
   	IWrapperSoapDeSerializer* pIWrapperSoapDeSerializer;
   	mc->getSoapDeSerializer(&pIWrapperSoapDeSerializer);
  +	IWrapperSoapSerializer* pIWSz;
  +	mc->getSoapSerializer(&pIWSz);
  +	pIWSz->createSoapMethod("EchoResponse", pIWSz->getNewNamespacePrefix(), "http://www.opensource.lk/WebService");
   	//IParam *param1 = pIWrapperSoapDeSerializer->GetParam();
   	//We know that parameter 1 should be an string
   	AxisString str = pIWrapperSoapDeSerializer->GetString();
   	//Call actual web service method with appropriate parameters
   	AxisString strRet = pWs->Echo(str);
  -	IWrapperSoapSerializer* pIWSz;
  -	mc->getSoapSerializer(&pIWSz);
   	//IParam* pRetParam = pIWSz->AddOutputParam(strRet.c_str());
   	//pRetParam->SetName("EchoReturn");
   	//return SUCCESS;
  @@ -195,6 +196,9 @@
   	//SetResponseMethod(mc, "AddResponse");
   	IWrapperSoapDeSerializer* pIWrapperSoapDeSerializer = NULL;
   	mc->getSoapDeSerializer(&pIWrapperSoapDeSerializer);
  +	IWrapperSoapSerializer* pIWSz = NULL;
  +	mc->getSoapSerializer(&pIWSz);
  +	pIWSz->createSoapMethod("AddResponse", pIWSz->getNewNamespacePrefix(), "http://www.opensource.lk/WebService");
   	//IParam *param1 = pIWrapperSoapDeSerializer->GetParam();
   	//IParam *param2 = pIWrapperSoapDeSerializer->GetParam();
   	//Convert parameters to actual types
  @@ -202,8 +206,6 @@
   	int i2 = pIWrapperSoapDeSerializer->GetInt();
   	//Call actual web service method with appropriate parameters
   	int ret = pWs->Add(i1, i2);
  -	IWrapperSoapSerializer* pIWSz = NULL;
  -	mc->getSoapSerializer(&pIWSz);
   	//IParam* pRetParam = pIWSz->AddOutputParam(ret);
   	//pRetParam->SetName("AddReturn");
   	return pIWSz->AddOutputParam("AddReturn", ret);
  
  
  
  1.8       +13 -1     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SoapBody.cpp	5 Sep 2003 10:48:51 -0000	1.7
  +++ SoapBody.cpp	16 Oct 2003 08:12:23 -0000	1.8
  @@ -119,10 +119,22 @@
   			if(iStatus==FAIL) {
   				break;
   			}
  -		} else if(m_pSoapFault!=NULL) {		
  +		} 
  +		else if(m_pSoapFault!=NULL) 
  +		{		
   			iStatus= m_pSoapFault->serialize(pSZ);
   			if(iStatus==FAIL) {
   				break;
  +			}
  +		}
  +		else
  +		{
  +			m_pSoapFault = SoapFault::getSoapFault(SF_WEBSERVICEFAILED);
  +			if(m_pSoapFault!=NULL) 
  +			{		
  +				iStatus= m_pSoapFault->serialize(pSZ);
  +				if(iStatus==FAIL) 
  +					break;
   			}
   		}