Hi Paul and all,

Let me explain a bit on this fall handling mechanism in client code.

Call api has two ways of getting notified if there is an error. One can either receive the fault as a java exception or he can receive the SOAP Fault in SOAP Body.

The default is you will receive a java exception. But for you to receive this error as an exception, the stack trace should come under the Detail element,, under Exception element.

<Envelope>
    <Header />
    <Body>
          <Detail>
              <Exception> your exception goes here </Exception?
          </Detail>
    <Body>
</Envelope>

This is sort of a mechanism is for the Call to work well with Axis2 server.

But if you want to receive the SOAP fault to the application, just set setExceptionToBeThrownOnSOAPFault(false) in the call api. This will give you back the Fault which you were looking for, without a java exception.

HTH.

Regards,
Chinthaka

Paul Fremantle wrote:
Folks

If I send an incorrect request to the XMethods (Glue-based) Stock Quote service, they send back this response...

<?xml version='1.0' encoding='UTF-8'?>
<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 ' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' ><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>symbol</faultstring><detail><e:electric-detail xmlns:e=' http://www.themindelectric.com/'><class>java.lang.NoSuchMethodException</class><message>symbol</message><trace>java.lang.NoSuchMethodException: symbol
    at electric.wsdl.PortType.getOperation (PortType.java:121)
    at electric.wsdl.WSDL.getOperation(WSDL.java:169)
    // etc
        at electric.util.ThreadPool.run(ThreadPool.java:105)
    at java.lang.Thread.run(Thread.java:479)
</trace></e:electric-detail></detail></soap:Fault></soap:Body></soap:Envelope>

But all I get in my Java stack trace is:

org.apache.axis2.AxisFault:
    at org.apache.axis2.clientapi.InOutMEPClient.invokeBlocking(InOutMEPClient.java:191)
    at org.apache.axis2.clientapi.Call.invokeBlocking (Call.java:90)
    at XMethodsTest.main(XMethodsTest.java:46)

Wouldn't it be useful to have the full SOAP fault information?

I'll raise a JIRA unless I've got it wrong and there is more info available.

Paul


Reply via email to