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 sa...@apache.org on 2004/08/13 08:25:23 UTC

cvs commit: ws-axis/c/samples/server/interoptests/base AxisServiceException.h AxisServiceException.cpp

sanjaya     2004/08/12 23:25:23

  Added:       c/samples/server/interoptests/base AxisServiceException.h
                        AxisServiceException.cpp
  Log:
  Added AxisServiceException files needed to compile interop base server
  sample
  
  Revision  Changes    Path
  1.1                  ws-axis/c/samples/server/interoptests/base/AxisServiceException.h
  
  Index: AxisServiceException.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(__AXISSERVICEEXCEPTION_EXCEPTION_H__INCLUDED_)
  #define __AXISSERVICEEXCEPTION_EXCEPTION_H__INCLUDED_
  
  #include <string>
  #include <exception>
  #include <axis/server/AxisException.h>
  #include <axis/ISoapFault.h>
  using namespace std;
  AXIS_CPP_NAMESPACE_USE 
  
  class AxisServiceException: public AxisException
  {
  public:
  	AxisServiceException();
  	AxisServiceException(ISoapFault* pFault);
  	AxisServiceException(int iExceptionCode);
  	AxisServiceException(exception* e);
  	AxisServiceException(exception* e, int iExceptionCode);
  	virtual ~AxisServiceException() 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(ISoapFault* pFault);
  	 void processException(exception* e, int iExceptionCode);
  	 void processException(int iExceptionCode);
  	 string m_sMessage;
  	 int m_iExceptionCode;
  
  };
  
  #endif /* !defined(__AXISSERVICEEXCEPTION_EXCEPTION_H__INCLUDED_)*/
  
  
  
  1.1                  ws-axis/c/samples/server/interoptests/base/AxisServiceException.cpp
  
  Index: AxisServiceException.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 "AxisServiceException.h"
  
  #include <axis/server/AxisWrapperAPI.h>
  
  AxisServiceException::AxisServiceException()
  {
  /* This only serves the pupose of indicating that the 
   * service has thrown an excpetion 
   */ 
  	m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION; 
  	processException(m_iExceptionCode); 
  }
  
  AxisServiceException::AxisServiceException(ISoapFault* pFault)
  {
  	m_iExceptionCode = AXISC_SERVICE_THROWN_EXCEPTION;
  	processException(pFault);}
  
  AxisServiceException::AxisServiceException(int iExceptionCode)
  {
  
  	m_iExceptionCode = iExceptionCode;
  	processException (iExceptionCode);
  }
  
  AxisServiceException::AxisServiceException(exception* e)
  {
  	processException (e);
  }
  
  AxisServiceException::AxisServiceException(exception* e,int iExceptionCode)
  {
  
  	processException (e, iExceptionCode);
  }
  
  AxisServiceException::~AxisServiceException() throw () 
  {
  	m_sMessage ="";
  }
  
  void AxisServiceException:: processException(exception* e, int iExceptionCode)
  {
  	m_sMessage = getMessage (e) + getMessage (iExceptionCode);
  }
  
  void AxisServiceException::processException (ISoapFault* pFault)
  {
  	/*User can do something like deserializing the struct into a string*/
  }
  
  void AxisServiceException::processException(exception* e)
  {
  	m_sMessage = getMessage (e);
  }
  
  void AxisServiceException::processException(int iExceptionCode)
  {
  	m_sMessage = getMessage (iExceptionCode);
  }
  
  const string AxisServiceException::getMessage (exception* objException)
  {
  	string sMessage = objException->what();
  	return sMessage;
  }
  
  const string AxisServiceException::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* AxisServiceException::what() throw ()
  {
  	return m_sMessage.c_str ();
  }
  
  const int AxisServiceException::getExceptionCode(){
  	return m_iExceptionCode;
  }