You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2006/03/21 12:55:41 UTC

svn commit: r387505 - in /incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src: AxisServiceException.cpp AxisServiceException.h Makefile.am SCAWSWrapper.cpp

Author: robbinspg
Date: Tue Mar 21 03:55:37 2006
New Revision: 387505

URL: http://svn.apache.org/viewcvs?rev=387505&view=rev
Log:
TUSCANY-72 throw better exceptions for Axis errors

Added:
    incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.cpp   (with props)
    incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.h   (with props)
Modified:
    incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/Makefile.am
    incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/SCAWSWrapper.cpp

Added: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.cpp?rev=387505&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.cpp (added)
+++ incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.cpp Tue Mar 21 03:55:37 2006
@@ -0,0 +1,105 @@
+/*
+ * This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
+ * This file contains implementations of the Exception class of the web service.
+ */
+
+#include "AxisServiceException.h"
+
+#include <axis/AxisWrapperAPI.hpp>
+
+AxisServiceException::AxisServiceException()
+{
+/* This only serves the purpose 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;
+	m_pISoapFault = pFault;
+	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(string sMessage)
+{
+	 m_sMessage =sMessage;
+}
+
+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 = "The service has thrown an exception. see details";
+		break;
+		default:
+		sMessage = "Unknown Exception has occured in the service";
+	}
+return sMessage;
+}
+
+const char* AxisServiceException::what() throw ()
+{
+	return m_sMessage.c_str ();
+}
+
+const int AxisServiceException::getExceptionCode(){
+	return m_iExceptionCode;
+}
+
+const ISoapFault* AxisServiceException::getFault(){
+	return m_pISoapFault;
+}
+

Propchange: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.cpp
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.cpp
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.h?rev=387505&view=auto
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.h (added)
+++ incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.h Tue Mar 21 03:55:37 2006
@@ -0,0 +1,44 @@
+/*
+ * 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/AxisException.hpp>
+#include <axis/ISoapFault.hpp>
+
+using namespace std;
+AXIS_CPP_NAMESPACE_USE 
+
+class AxisServiceException: public AxisException
+{
+public:
+	STORAGE_CLASS_INFO AxisServiceException();
+	STORAGE_CLASS_INFO AxisServiceException(ISoapFault* pFault);
+	STORAGE_CLASS_INFO AxisServiceException(int iExceptionCode);
+	STORAGE_CLASS_INFO AxisServiceException(exception* e);
+	STORAGE_CLASS_INFO AxisServiceException(exception* e, int iExceptionCode);
+	STORAGE_CLASS_INFO AxisServiceException(string sMessage);
+	STORAGE_CLASS_INFO virtual ~AxisServiceException() 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(__AXISSERVICEEXCEPTION_EXCEPTION_H__INCLUDED_)*/

Propchange: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.h
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/AxisServiceException.h
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/Makefile.am
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/Makefile.am?rev=387505&r1=387504&r2=387505&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/Makefile.am (original)
+++ incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/Makefile.am Tue Mar 21 03:55:37 2006
@@ -1,10 +1,10 @@
 lib_LTLIBRARIES = libtuscany_sca_axis_wrapper.la
 
-libtuscany_sca_axis_wrapper_la_SOURCES = SCAWSWrapper.cpp
+libtuscany_sca_axis_wrapper_la_SOURCES = SCAWSWrapper.cpp AxisServiceException.cpp
 
 libtuscany_sca_axis_wrapper_la_LIBADD = -L$(top_builddir)/runtime/core/src -ltuscany_sca \
 	-L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -lxml2 -lstdc++ \
-	-L${AXISCPP_DEPLOY}/lib -laxis_client -laxis_clientC
+	-L${AXISCPP_DEPLOY}/lib -laxis_client
 	
 INCLUDES = -I$(top_builddir)/runtime/core/src \
            -I${TUSCANY_SDOCPP}/include \

Modified: incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/SCAWSWrapper.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/SCAWSWrapper.cpp?rev=387505&r1=387504&r2=387505&view=diff
==============================================================================
--- incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/SCAWSWrapper.cpp (original)
+++ incubator/tuscany/cpp/sca/runtime/axis_binding/wrapper/src/SCAWSWrapper.cpp Tue Mar 21 03:55:37 2006
@@ -23,6 +23,9 @@
 #include "tuscany/sca/util/Exceptions.h"
 #include "tuscany/sca/core/SCAEntryPoint.h"
 
+#include "axis/GDefine.h"
+#include "AxisServiceException.h"
+
 
 using namespace std;
 using namespace commonj::sdo;
@@ -205,11 +208,22 @@
     }
     catch(ServiceRuntimeException e)
     {
-        axisReturn = AXIS_FAIL;
+    	
+        // Throw a useful fault
+        string faultCode = string("Server.TuscanySCA.") + string(e.getEClassName());
+        string faultString = string(e.getEClassName()) + string(":") + string (e.getMessageText());
+        
+        pIWSSZ->createSoapFault("ServiceRuntimeException","tempURI", faultCode.c_str(), faultString.c_str());
+        throw AxisServiceException();
     }
     catch(SDORuntimeException e)
     {
-        axisReturn = AXIS_FAIL;
+    	// Throw a useful fault
+        string faultCode = string("Server.TuscanySDO.") + string(e.getEClassName());
+        string faultString = string(e.getEClassName()) + string(":") + string (e.getMessageText());
+        
+        pIWSSZ->createSoapFault("SDORuntimeException","tempURI", faultCode.c_str(), faultString.c_str());
+        throw AxisServiceException();
     }