axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject svn commit: r394957 - in /webservices/axis/trunk/c: include/axis/ src/soap/ src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/
Date Tue, 18 Apr 2006 14:41:07 GMT
Author: dicka
Date: Tue Apr 18 07:39:51 2006
New Revision: 394957

URL: http://svn.apache.org/viewcvs?rev=394957&view=rev
Log:
Provide support for SOAP faults to be created in service wrapper when service code throws
an STL exception, in addition to the faults described within the WSDL.
Also allow service code to throw OtherFaultException.

Modified:
    webservices/axis/trunk/c/include/axis/IWrapperSoapSerializer.hpp
    webservices/axis/trunk/c/src/soap/SoapSerializer.cpp
    webservices/axis/trunk/c/src/soap/SoapSerializer.h
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java

Modified: webservices/axis/trunk/c/include/axis/IWrapperSoapSerializer.hpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/include/axis/IWrapperSoapSerializer.hpp?rev=394957&r1=394956&r2=394957&view=diff
==============================================================================
--- webservices/axis/trunk/c/include/axis/IWrapperSoapSerializer.hpp (original)
+++ webservices/axis/trunk/c/include/axis/IWrapperSoapSerializer.hpp Tue Apr 18 07:39:51 2006
@@ -22,6 +22,7 @@
 #include <axis/TypeMapping.hpp>
 #include <axis/WSDDDefines.hpp>
 #include <axis/ISoapAttachment.hpp>
+#include <axis/ISoapFault.hpp>
 #include <stdarg.h>
 #include <cctype>
 
@@ -49,6 +50,9 @@
                                          const AxisChar* sURI, 
                                          const AxisChar* sFaultCode,
                                          const AxisChar* sFaultString)=0;
+
+    virtual int AXISCALL setSoapFault(ISoapFault* pSoapFault)=0;
+
     /**
      * Returns the corrosponding namespace prefix.
      * @param pNamespace The namespace.
@@ -99,6 +103,14 @@
                                         void* pDelFunct, 
                                         const AxisChar* pName, 
                                         const AxisChar* pNamespace) = 0;
+
+    /**
+     * Use this method to add simple, ie text, detail to a SOAP fault.
+     * 
+     * @param pDetail The text to be used for the detail element of the SOAP fault.
+     * @return indicates success or failure of adding fault detail
+     */
+    virtual int AXISCALL addFaultDetail( const AxisChar * pDetail) = 0;
 
     /* Methods used to serialize arrays */
     virtual int AXISCALL serializeCmplxArray(const Axis_Array* pArray,

Modified: webservices/axis/trunk/c/src/soap/SoapSerializer.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/soap/SoapSerializer.cpp?rev=394957&r1=394956&r2=394957&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/SoapSerializer.cpp (original)
+++ webservices/axis/trunk/c/src/soap/SoapSerializer.cpp Tue Apr 18 07:39:51 2006
@@ -291,7 +291,20 @@
     return iSuccess;
 }
 
-int SoapSerializer::setSoapFault( SoapFault * pSoapFault)
+int SoapSerializer::addFaultDetail( const AxisChar * pDetail)
+{
+	int iStatus = AXIS_FAIL;
+    if( m_pSoapEnvelope &&
+        (m_pSoapEnvelope->m_pSoapBody) &&
+        (m_pSoapEnvelope->m_pSoapBody->m_pSoapFault))
+	{
+		iStatus = m_pSoapEnvelope->m_pSoapBody->m_pSoapFault->setFaultDetail(pDetail);
+	}
+
+	return iStatus;
+}
+
+int SoapSerializer::setSoapFault( ISoapFault * pSoapFault)
 {
     int intStatus = AXIS_FAIL;
 
@@ -300,7 +313,7 @@
         if(m_pSoapEnvelope->m_pSoapBody->m_pSoapFault)
             delete m_pSoapEnvelope->m_pSoapBody->m_pSoapFault;
 
-        m_pSoapEnvelope->m_pSoapBody->m_pSoapFault = pSoapFault;
+        m_pSoapEnvelope->m_pSoapBody->m_pSoapFault = (SoapFault *) pSoapFault;
         intStatus = AXIS_SUCCESS;
     }
 

Modified: webservices/axis/trunk/c/src/soap/SoapSerializer.h
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/soap/SoapSerializer.h?rev=394957&r1=394956&r2=394957&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/SoapSerializer.h (original)
+++ webservices/axis/trunk/c/src/soap/SoapSerializer.h Tue Apr 18 07:39:51 2006
@@ -117,7 +117,7 @@
     int setOutputStream(SOAPTransport* pStream);
     void markEndOfStream();
     int setSoapMethod(SoapMethod* pSoapMethod);
-    int setSoapFault(SoapFault* pSoapFault);
+    int AXISCALL setSoapFault(ISoapFault* pSoapFault);
     int setSoapBody(SoapBody* pSoapBody);
     int setSoapEnvelope(SoapEnvelope* pSoapEnvelope);
     SoapSerializer();
@@ -138,6 +138,8 @@
 
     int AXISCALL addFaultDetail(void* pObject, void* pSZFunct,
         void* pDelFunct, const AxisChar* pName, const AxisChar* pNamespace );
+
+    int AXISCALL addFaultDetail( const AxisChar * pDetail);
 
     int AXISCALL serializeCmplxArray(const Axis_Array* pArray, void* pSZFunct,
         void* pDelFunct, void* pSizeFunct, const AxisChar* pName, 

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.java?rev=394957&r1=394956&r2=394957&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.java
Tue Apr 18 07:39:51 2006
@@ -159,6 +159,7 @@
             writer.write("#include <axis/GDefine.hpp>\n");
             writer.write("#include <axis/Axis.hpp>\n");
             writer.write("#include <axis/AxisWrapperAPI.hpp>\n");
+            writer.write("#include <axis/OtherFaultException.hpp>\n");
             writer.write("#include \"AxisServiceException.hpp\" \n");
             writer.write("AXIS_CPP_NAMESPACE_USE \n\n");
             //writeFaultHeaders();

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java?rev=394957&r1=394956&r2=394957&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java Tue
Apr 18 07:39:51 2006
@@ -798,6 +798,29 @@
                 writeExceptions(faultType, faultInfoName, paramName, langName);
             }
         }
+        
+        // Handle SOAP faults not specified within the WSDL (ie OtherFaultException)
+        writer.write("\tcatch(OtherFaultException * pObjFault)\n");
+        writer.write("\t{\n");
+        writer.write("\t\tif (pObjFault)\n");
+        writer.write("\t\t{\n");
+        writer.write("\t\t\tpIWSSZ->createSoapFault(\"\", \"\", pObjFault->getFaultCode(),
pObjFault->getFaultString());\n");
+        writer.write("\t\t\tpIWSSZ->addFaultDetail(pObjFault->getFaultDetail());\n");
+        writer.write("\t\t\tdelete pObjFault;\n");
+        writer.write("\t\t\tthrow AxisServiceException(AXISC_SERVICE_THROWN_EXCEPTION);\n");
+        writer.write("\t\t}\n");
+        writer.write("\t\treturn AXIS_FAIL;\n");
+        writer.write("\t}\n");
+        
+        // Handle generic exception, placing the message into a generic SOAP fault
+        writer.write("\tcatch (exception & e)\n");
+        writer.write("\t{\n");
+        writer.write("\t\tpIWSSZ->createSoapFault(\"\", \"\", \"Server\", e.what());\n");
+        writer.write("\t\tthrow AxisServiceException(AXISC_SERVICE_THROWN_EXCEPTION);\n");
+        writer.write("\t\treturn AXIS_FAIL;\n");
+        writer.write("\t}\n");
+        
+        // Handle any other exception
         writer.write("\tcatch(...)\n");
         writer.write("\t{\n");
         writer.write("\t\treturn AXIS_FAIL;\n");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java?rev=394957&r1=394956&r2=394957&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
Tue Apr 18 07:39:51 2006
@@ -599,6 +599,29 @@
                 writeExceptions(faultType, faultInfoName, paramName, langName);
             }
         }
+        
+        // Handle SOAP faults not specified within the WSDL (ie OtherFaultException)
+        writer.write("\tcatch(OtherFaultException * pObjFault)\n");
+        writer.write("\t{\n");
+        writer.write("\t\tif (pObjFault)\n");
+        writer.write("\t\t{\n");
+        writer.write("\t\t\tpIWSSZ->createSoapFault(\"\", \"\", pObjFault->getFaultCode(),
pObjFault->getFaultString());\n");
+        writer.write("\t\t\tpIWSSZ->addFaultDetail(pObjFault->getFaultDetail());\n");
+        writer.write("\t\t\tdelete pObjFault;\n");
+        writer.write("\t\t\tthrow AxisServiceException(AXISC_SERVICE_THROWN_EXCEPTION);\n");
+        writer.write("\t\t}\n");
+        writer.write("\t\treturn AXIS_FAIL;\n");
+        writer.write("\t}\n");
+        
+        // Handle generic exception, placing the message into a generic SOAP fault
+        writer.write("\tcatch (exception & e)\n");
+        writer.write("\t{\n");
+        writer.write("\t\tpIWSSZ->createSoapFault(\"\", \"\", \"Server\", e.what());\n");
+        writer.write("\t\tthrow AxisServiceException(AXISC_SERVICE_THROWN_EXCEPTION);\n");
+        writer.write("\t\treturn AXIS_FAIL;\n");
+        writer.write("\t}\n");
+        
+        // Handle any other exception
         writer.write("\tcatch(...)\n");
         writer.write("\t{\n");
         writer.write("\t\treturn AXIS_FAIL;\n");



Mime
View raw message