You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Thomas S <th...@gmail.com> on 2012/02/17 22:22:32 UTC

Re: Axis2C Soap Exception Handling

A good while ago I realized that the (then) current label of Axis2C had a
problem returning all fields of a soap exception thrown by the remote
server. I looked into it for a while and entered JIRA
AXIS2C-1507<https://issues.apache.org/jira/browse/AXIS2C-1507>for
this.

As I noticed that over the last few months there had been numerous patches
and fixes applied to the trunk of Axis2C I tried latest Trunk code against
an asp.net soap service returning soap faults. Unfortunately, the issue
with not populating all fault members apparently has not been fixed yet as
current code behaves exactly the same way in regards to this functionality.

Has anyone come up with a workaround for this issue or am I the only one
having problems with this and having a need for soap fault support?

Thanks in advance,
Thomas

On Wed, Sep 1, 2010 at 2:20 PM, Thomas S <th...@gmail.com> wrote:

> I am currently working on porting a C++ soap client from the rather aged
> MS Soap Toolkit to Axis2C.
> To start with this will run on Windows but part of the exercise is to get
> our system ported to Linux.
> For the most part the port was fairly straight-forward and I am getting
> good results with my unit tests.
>
> However, there is one situation I haven't quite figured out yet - handling
> of Soap Faults.
>
> My unit test "SoapExceptionsService" returns the following (taken from
> SoapUI output).
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="
> http://www.w3.org/2001/XMLSchema">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode xmlns:q0="http://www.cc.com/SoapExceptionService
> ">q0:SoapExceptionService</faultcode>
>          <faultstring>System.Web.Services.Protocols.SoapException: This is
> the FaultString
>    at SoapExceptionService.Service1.HelloWorld(RequestInput
> ri)</faultstring>
>          <faultactor>http://www.cc.com/SoapExceptionService</faultactor>
>          <detail>
>             <DetailMessage>This is the Detail section</DetailMessage>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
> Using the MS Soap Toolkit there are methods returning all the separate
> pieces of the exception:
>
> FaultActor         = "http://www.cc.com/SoapExceptionService"
> FaultCode         = "SoapExceptionService"
> FaultCodeNamespace     = "http://www.cc.com/SoapExceptionService"
> FaultDetail         = "<detail><DetailMessage>This is the Detail
> section</DetailMessage></detail>"
> FaultString         = "System.Web.Services.Protocols.SoapException: This
> is the FaultString
>                    at
> SoapExceptionService.Service1.HelloWorld(RequestInput ri)"
>
> However, using Axis2C (I tried both 1.6 and latest 1.7 code from SVN) only
> returns a subset of these fields.
>
> Fault Code: (null)
> Exception: (null)
> Reason: (null)
> Role: http://www.cc.com/SoapExceptionService
> Detail xml: <detail><DetailMessage>This is the Detail
> section</DetailMessage></detail>
>
> If I retrieve the fault base node and serialize it I see the whole fault
> message so Axis has all the data available.
> I stepped through function axiom_soap_body_convert_fault_to_soap11() and
> it appears that the values are found and text elements are created for the
> missing items but when I try to retrieve them using the axis functions the
> string values end up being NULL.
>
> Example:
>
>                 axis2_char_t *strcodevalue = "";
>                 ::axiom_soap_fault_code *fcode =
> ::axiom_soap_fault_get_code(fault, env);  // returns ok value
>                 if (fcode) {
>                     ::axiom_soap_fault_value *fcodevalue =
> ::axiom_soap_fault_code_get_value(fcode, env);  // returns ok value
>                     if (fcodevalue) {
>                         strcodevalue =
> ::axiom_soap_fault_value_get_text(fcodevalue, env);  // return NULL
>                     }
>                 }
>
> I suppose I could manually parse the fault xml but I'd kinda prefer to let
> the Soap library handle these details.
>
> Am I missing something here or just plain oversimplifying things? Any
> pointers would be appreciated.
>
> Many thanks in advance,
> Thomas
>