axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ros...@apache.org
Subject cvs commit: ws-axis/c/samples/client/simple Calculator_AxisClientException.hpp Calculator_AxisClientException.cpp Calculator.hpp Calculator.cpp CalcClient.cpp
Date Tue, 04 Jan 2005 06:59:47 GMT
roshan      2005/01/03 22:59:47

  Modified:    c/samples/client/simple Calculator.cpp CalcClient.cpp
  Added:       c/samples/client/simple Calculator_AxisClientException.hpp
                        Calculator_AxisClientException.cpp Calculator.hpp
  Log:
  changed the source files of the simple sample to reflect the latest code generation, since
the files were not reflecting the latest
  
  Revision  Changes    Path
  1.10      +166 -71   ws-axis/c/samples/client/simple/Calculator.cpp
  
  Index: Calculator.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/client/simple/Calculator.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Calculator.cpp	24 Nov 2004 13:25:18 -0000	1.9
  +++ Calculator.cpp	4 Jan 2005 06:59:47 -0000	1.10
  @@ -1,134 +1,229 @@
   /*
  - * This is the Client Stub implementation file genarated by WSDL2Ws tool.
  - * Calculator.cpp: implemtation for the Calculator.
  - *
  + * This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
  + * This file contains Client Stub implementation for remote web service.
    */
   
  -#include "Calculator.h"
  +#include "Calculator.hpp"
   
   #include <axis/AxisWrapperAPI.hpp>
   
  -AXIS_CPP_NAMESPACE_USE
  +using namespace std;
   
  -bool CallBase::bInitialized;
  -//CallFunctions CallBase::ms_VFtable;
  -Calculator::Calculator(const char* pchEndpointUri)
  -{
  -	m_pCall = new Call();
  -	m_pCall->setProtocol(APTHTTP1_1);
  -	m_pCall->setEndpointURI(pchEndpointUri);
  + Calculator::Calculator(const char* pchEndpointUri, AXIS_PROTOCOL_TYPE eProtocol)
  +:Stub(pchEndpointUri, eProtocol)
  +{
  +}
  +
  +Calculator::Calculator()
  +:Stub(" ", APTHTTP1_1)
  +{
  +	m_pCall->setEndpointURI("http://localhost/axis/Calculator");
   }
   
   Calculator::~Calculator()
   {
  -	delete m_pCall;
   }
   
   
   /*Methods corresponding to the web service methods*/
   
   /*
  - * This method wrap the service methodadd
  + * This method wrap the service method add
    */
  -int Calculator::add(int Value0, int Value1)
  +xsd__int Calculator::add(xsd__int Value0, xsd__int Value1)
   {
  -	int Ret;
  -	if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return Ret;
  -	m_pCall->setTransportProperty(SOAPACTION_HEADER , "Calculator#add");
  -	m_pCall->setSOAPVersion(SOAP_VER_1_1);
  -	m_pCall->setOperation("add", "http://localhost/axis/Calculator");
  -	m_pCall->addParameter((void*)&Value0, "in0", XSD_INT);
  -	m_pCall->addParameter((void*)&Value1, "in1", XSD_INT);
  -	if (AXIS_SUCCESS == m_pCall->invoke())
  +	xsd__int Ret = 0;
  +	const char* pcCmplxFaultName;
  +	try
   	{
  -		if(AXIS_SUCCESS == m_pCall->checkMessage("addResponse", "http://localhost/axis/Calculator"))
  +		if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) 
  +			return Ret;
  +		m_pCall->setTransportProperty(SOAPACTION_HEADER , "Calculator#add");
  +		m_pCall->setSOAPVersion(SOAP_VER_1_1);
  +		m_pCall->setOperation("add", "http://localhost/axis/Calculator");
  +		applyUserPreferences();
  +		m_pCall->addParameter((void*)&Value0, "in0", XSD_INT);
  +		m_pCall->addParameter((void*)&Value1, "in1", XSD_INT);
  +		if (AXIS_SUCCESS == m_pCall->invoke())
   		{
  -			Ret = m_pCall->getElementAsInt("addReturn", 0);
  -                        printf("Ret:%d\n", Ret);
  +			if(AXIS_SUCCESS == m_pCall->checkMessage("addResponse", "http://localhost/axis/Calculator"))
  +			{
  +				Ret = m_pCall->getElementAsInt("addReturn", 0);
  +			}
   		}
  +	updateStateAfterResponse();
  +	m_pCall->unInitialize();
  +		return Ret;
   	}
  +	catch(AxisException& e)
  +	{
  +		int iExceptionCode = e.getExceptionCode();
  +		if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
  +		{
  +	updateStateAfterResponse();
  +	m_pCall->unInitialize();
  +			throw Calculator_AxisClientException(e.what());
  +		}
  +		ISoapFault* pSoapFault = (ISoapFault*) m_pCall->checkFault("Fault","http://localhost/axis/Calculator"
);
  +		if(pSoapFault)
  +		{
  +	updateStateAfterResponse();
   	m_pCall->unInitialize();
  -	return Ret;
  +			throw Calculator_AxisClientException(pSoapFault);
  +		}
  +		else throw;
  +	}
   }
   
   
   /*
  - * This method wrap the service methodsub
  + * This method wrap the service method sub
    */
  -int Calculator::sub(int Value0, int Value1)
  +xsd__int Calculator::sub(xsd__int Value0, xsd__int Value1)
   {
  -	int Ret;
  -	if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return Ret;
  -	m_pCall->setTransportProperty(SOAPACTION_HEADER , "Calculator#sub");
  -	m_pCall->setSOAPVersion(SOAP_VER_1_1);
  -	m_pCall->setOperation("sub", "http://localhost/axis/Calculator");
  -	m_pCall->addParameter((void*)&Value0, "in0", XSD_INT);
  -	m_pCall->addParameter((void*)&Value1, "in1", XSD_INT);
  -	if (AXIS_SUCCESS == m_pCall->invoke())
  +	xsd__int Ret = 0;
  +	const char* pcCmplxFaultName;
  +	try
   	{
  -		if(AXIS_SUCCESS == m_pCall->checkMessage("subResponse", "http://localhost/axis/Calculator"))
  +		if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) 
  +			return Ret;
  +		m_pCall->setTransportProperty(SOAPACTION_HEADER , "Calculator#sub");
  +		m_pCall->setSOAPVersion(SOAP_VER_1_1);
  +		m_pCall->setOperation("sub", "http://localhost/axis/Calculator");
  +		applyUserPreferences();
  +		m_pCall->addParameter((void*)&Value0, "in0", XSD_INT);
  +		m_pCall->addParameter((void*)&Value1, "in1", XSD_INT);
  +		if (AXIS_SUCCESS == m_pCall->invoke())
   		{
  -			Ret = m_pCall->getElementAsInt("subReturn", 0);
  -			printf("Ret:%d\n", Ret);
  +			if(AXIS_SUCCESS == m_pCall->checkMessage("subResponse", "http://localhost/axis/Calculator"))
  +			{
  +				Ret = m_pCall->getElementAsInt("subReturn", 0);
  +			}
   		}
  +	updateStateAfterResponse();
  +	m_pCall->unInitialize();
  +		return Ret;
   	}
  +	catch(AxisException& e)
  +	{
  +		int iExceptionCode = e.getExceptionCode();
  +		if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
  +		{
  +	updateStateAfterResponse();
  +	m_pCall->unInitialize();
  +			throw Calculator_AxisClientException(e.what());
  +		}
  +		ISoapFault* pSoapFault = (ISoapFault*) m_pCall->checkFault("Fault","http://localhost/axis/Calculator"
);
  +		if(pSoapFault)
  +		{
  +	updateStateAfterResponse();
   	m_pCall->unInitialize();
  -	return Ret;
  +			throw Calculator_AxisClientException(pSoapFault);
  +		}
  +		else throw;
  +	}
   }
   
   
   /*
  - * This method wrap the service methodmul
  + * This method wrap the service method mul
    */
  -int Calculator::mul(int Value0, int Value1)
  +xsd__int Calculator::mul(xsd__int Value0, xsd__int Value1)
   {
  -	int Ret;
  -	if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return Ret;
  -	m_pCall->setTransportProperty(SOAPACTION_HEADER , "Calculator#mul");
  -	m_pCall->setSOAPVersion(SOAP_VER_1_1);
  -	m_pCall->setOperation("mul", "http://localhost/axis/Calculator");
  -	m_pCall->addParameter((void*)&Value0, "in0", XSD_INT);
  -	m_pCall->addParameter((void*)&Value1, "in1", XSD_INT);
  -	if (AXIS_SUCCESS == m_pCall->invoke())
  +	xsd__int Ret = 0;
  +	const char* pcCmplxFaultName;
  +	try
   	{
  -		if(AXIS_SUCCESS == m_pCall->checkMessage("mulResponse", "http://localhost/axis/Calculator"))
  +		if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) 
  +			return Ret;
  +		m_pCall->setTransportProperty(SOAPACTION_HEADER , "Calculator#mul");
  +		m_pCall->setSOAPVersion(SOAP_VER_1_1);
  +		m_pCall->setOperation("mul", "http://localhost/axis/Calculator");
  +		applyUserPreferences();
  +		m_pCall->addParameter((void*)&Value0, "in0", XSD_INT);
  +		m_pCall->addParameter((void*)&Value1, "in1", XSD_INT);
  +		if (AXIS_SUCCESS == m_pCall->invoke())
   		{
  -			Ret = m_pCall->getElementAsInt("addReturn", 0);
  -			printf("Ret:%d\n", Ret);
  +			if(AXIS_SUCCESS == m_pCall->checkMessage("mulResponse", "http://localhost/axis/Calculator"))
  +			{
  +				Ret = m_pCall->getElementAsInt("addReturn", 0);
  +			}
   		}
  +	updateStateAfterResponse();
  +	m_pCall->unInitialize();
  +		return Ret;
   	}
  +	catch(AxisException& e)
  +	{
  +		int iExceptionCode = e.getExceptionCode();
  +		if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
  +		{
  +	updateStateAfterResponse();
   	m_pCall->unInitialize();
  -	return Ret;
  +			throw Calculator_AxisClientException(e.what());
  +		}
  +		ISoapFault* pSoapFault = (ISoapFault*) m_pCall->checkFault("Fault","http://localhost/axis/Calculator"
);
  +		if(pSoapFault)
  +		{
  +	updateStateAfterResponse();
  +	m_pCall->unInitialize();
  +			throw Calculator_AxisClientException(pSoapFault);
  +		}
  +		else throw;
  +	}
   }
   
   
   /*
  - * This method wrap the service methoddiv
  + * This method wrap the service method div
    */
  -int Calculator::div(int Value0, int Value1)
  +xsd__int Calculator::div(xsd__int Value0, xsd__int Value1)
   {
  -	int Ret;
  -	if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) return Ret;
  -	m_pCall->setTransportProperty(SOAPACTION_HEADER , "Calculator#div");
  -	m_pCall->setSOAPVersion(SOAP_VER_1_1);
  -	m_pCall->setOperation("div", "http://localhost/axis/Calculator");
  -	m_pCall->addParameter((void*)&Value0, "in0", XSD_INT);
  -	m_pCall->addParameter((void*)&Value1, "in1", XSD_INT);
  -	if (AXIS_SUCCESS == m_pCall->invoke())
  +	xsd__int Ret = 0;
  +	const char* pcCmplxFaultName;
  +	try
   	{
  -		if(AXIS_SUCCESS == m_pCall->checkMessage("divResponse", "http://localhost/axis/Calculator"))
  +		if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER, NORMAL_CHANNEL)) 
  +			return Ret;
  +		m_pCall->setTransportProperty(SOAPACTION_HEADER , "Calculator#div");
  +		m_pCall->setSOAPVersion(SOAP_VER_1_1);
  +		m_pCall->setOperation("div", "http://localhost/axis/Calculator");
  +		applyUserPreferences();
  +		m_pCall->addParameter((void*)&Value0, "in0", XSD_INT);
  +		m_pCall->addParameter((void*)&Value1, "in1", XSD_INT);
  +		if (AXIS_SUCCESS == m_pCall->invoke())
   		{
  -			Ret = m_pCall->getElementAsInt("addReturn", 0);
  -			printf("Ret:%d\n", Ret);
  +			if(AXIS_SUCCESS == m_pCall->checkMessage("divResponse", "http://localhost/axis/Calculator"))
  +			{
  +				Ret = m_pCall->getElementAsInt("addReturn", 0);
  +			}
   		}
  +	updateStateAfterResponse();
  +	m_pCall->unInitialize();
  +		return Ret;
   	}
  +	catch(AxisException& e)
  +	{
  +		int iExceptionCode = e.getExceptionCode();
  +		if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
  +		{
  +	updateStateAfterResponse();
   	m_pCall->unInitialize();
  -	return Ret;
  +			throw Calculator_AxisClientException(e.what());
  +		}
  +		ISoapFault* pSoapFault = (ISoapFault*) m_pCall->checkFault("Fault","http://localhost/axis/Calculator"
);
  +		if(pSoapFault)
  +		{
  +	updateStateAfterResponse();
  +	m_pCall->unInitialize();
  +			throw Calculator_AxisClientException(pSoapFault);
  +		}
  +		else throw;
  +	}
   }
   
   int Calculator::getFaultDetail(char** ppcDetail)
   {
  -    m_pCall->getFaultDetail(ppcDetail);
  -	return 0;
  +	return m_pCall->getFaultDetail(ppcDetail);
   }
   
  
  
  
  1.11      +1 -1      ws-axis/c/samples/client/simple/CalcClient.cpp
  
  Index: CalcClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/client/simple/CalcClient.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- CalcClient.cpp	29 Nov 2004 12:39:30 -0000	1.10
  +++ CalcClient.cpp	4 Jan 2005 06:59:47 -0000	1.11
  @@ -1,4 +1,4 @@
  -#include "Calculator.h"
  +#include "Calculator.hpp"
   #include <axis/AxisException.hpp>
   #include <iostream>
   
  
  
  
  1.1                  ws-axis/c/samples/client/simple/Calculator_AxisClientException.hpp
  
  Index: Calculator_AxisClientException.hpp
  ===================================================================
  /*
   * 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(__AXISCLIENTEXCEPTION_EXCEPTION_H__INCLUDED_)
  #define __AXISCLIENTEXCEPTION_EXCEPTION_H__INCLUDED_
  
  #include <string>
  #include <exception>
  #include <axis/AxisException.hpp>
  #include <axis/ISoapFault.hpp>
  using namespace std;
  AXIS_CPP_NAMESPACE_USE 
  
  class Calculator_AxisClientException: public AxisException
  {
  public:
  	STORAGE_CLASS_INFO Calculator_AxisClientException();
  	STORAGE_CLASS_INFO Calculator_AxisClientException(ISoapFault* pFault);
  	STORAGE_CLASS_INFO Calculator_AxisClientException(int iExceptionCode);
  	STORAGE_CLASS_INFO Calculator_AxisClientException(exception* e);
  	STORAGE_CLASS_INFO Calculator_AxisClientException(exception* e, int iExceptionCode);
  	STORAGE_CLASS_INFO Calculator_AxisClientException(string sMessage);
  	STORAGE_CLASS_INFO virtual ~Calculator_AxisClientException() throw();
  	STORAGE_CLASS_INFO const char* what() throw();
  	STORAGE_CLASS_INFO const int getExceptionCode();
  	STORAGE_CLASS_INFO const string getMessage(exception* e);
  	STORAGE_CLASS_INFO const string getMessage(int iExceptionCode);
  	STORAGE_CLASS_INFO const ISoapFault* getFault();
  
  private:
  	 void processException(exception* e);
  	 void processException(ISoapFault* pFault);
  	 void processException(exception* e, int iExceptionCode);
  	 void processException(int iExceptionCode);
  	 string m_sMessage;
  	 int m_iExceptionCode;
  	 ISoapFault* m_pISoapFault;
  
  };
  
  #endif /* !defined(__AXISCLIENTEXCEPTION_EXCEPTION_H__INCLUDED_)*/
  
  
  
  1.1                  ws-axis/c/samples/client/simple/Calculator_AxisClientException.cpp
  
  Index: Calculator_AxisClientException.cpp
  ===================================================================
  /*
   * This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
   * This file contains implementations of the Calculator Exception class of the web service.
   */
  
  #include "Calculator_AxisClientException.hpp"
  
  #include <axis/AxisWrapperAPI.hpp>
  
  Calculator_AxisClientException::Calculator_AxisClientException()
  {
  /* This only serves the purpose of indicating that the 
   * service has thrown an excpetion 
   */ 
  	m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION; 
  	processException(m_iExceptionCode); 
  }
  
  Calculator_AxisClientException::Calculator_AxisClientException(ISoapFault* pFault)
  {
  	m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION;
  	m_pISoapFault = pFault;
  	processException(pFault);}
  
  Calculator_AxisClientException::Calculator_AxisClientException(int iExceptionCode)
  {
  
  	m_iExceptionCode = iExceptionCode;
  	processException (iExceptionCode);
  }
  
  Calculator_AxisClientException::Calculator_AxisClientException(exception* e)
  {
  	processException (e);
  }
  
  Calculator_AxisClientException::Calculator_AxisClientException(exception* e,int iExceptionCode)
  {
  
  	processException (e, iExceptionCode);
  }
  
  Calculator_AxisClientException::Calculator_AxisClientException(string sMessage)
  {
  	 m_sMessage =sMessage;
  }
  
  Calculator_AxisClientException::~Calculator_AxisClientException() throw () 
  {
  	m_sMessage ="";
  }
  
  void Calculator_AxisClientException:: processException(exception* e, int iExceptionCode)
  {
  	m_sMessage = getMessage (e) + getMessage (iExceptionCode);
  }
  
  void Calculator_AxisClientException::processException (ISoapFault* pFault)
  {
  	/*User can do something like deserializing the struct into a string*/
  }
  
  void Calculator_AxisClientException::processException(exception* e)
  {
  	m_sMessage = getMessage (e);
  }
  
  void Calculator_AxisClientException::processException(int iExceptionCode)
  {
  	m_sMessage = getMessage (iExceptionCode);
  }
  
  const string Calculator_AxisClientException::getMessage (exception* objException)
  {
  	string sMessage = objException->what();
  	return sMessage;
  }
  
  const string Calculator_AxisClientException::getMessage (int iExceptionCode)
  {
  	string sMessage;
  	switch(iExceptionCode)
  	{
  		case AXISC_SERVICE_THROWN_EXCEPTION:
  		sMessage = "The Calculator service has thrown an exception. see details";
  		break;
  		default:
  		sMessage = "Unknown Exception has occured in the Calculator service";
  	}
  return sMessage;
  }
  
  const char* Calculator_AxisClientException::what() throw ()
  {
  	return m_sMessage.c_str ();
  }
  
  const int Calculator_AxisClientException::getExceptionCode(){
  	return m_iExceptionCode;
  }
  
  const ISoapFault* Calculator_AxisClientException::getFault(){
  	return m_pISoapFault;
  }
  
  
  
  
  1.1                  ws-axis/c/samples/client/simple/Calculator.hpp
  
  Index: Calculator.hpp
  ===================================================================
  /*
   * 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(__CALCULATOR_CLIENTSTUB_H__INCLUDED_)
  #define __CALCULATOR_CLIENTSTUB_H__INCLUDED_
  
  #include <axis/client/Stub.hpp>
  #include "Calculator_AxisClientException.hpp"
  #include <axis/ISoapFault.hpp>
  
  class Calculator :public Stub
  {
  public:
  	STORAGE_CLASS_INFO Calculator(const char* pchEndpointUri, AXIS_PROTOCOL_TYPE eProtocol=APTHTTP1_1);
  	STORAGE_CLASS_INFO Calculator();
  public:
  	STORAGE_CLASS_INFO virtual ~Calculator();
  public: 
  	STORAGE_CLASS_INFO xsd__int add(xsd__int Value0,xsd__int Value1);
  	STORAGE_CLASS_INFO xsd__int sub(xsd__int Value0,xsd__int Value1);
  	STORAGE_CLASS_INFO xsd__int mul(xsd__int Value0,xsd__int Value1);
  	STORAGE_CLASS_INFO xsd__int div(xsd__int Value0,xsd__int Value1);
  	int getFaultDetail(char** ppcDetail);
  };
  
  #endif /* !defined(__CALCULATOR_CLIENTSTUB_H__INCLUDED_)*/
  
  
  

Mime
View raw message