You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by SGE0 <st...@hotmail.com> on 2009/11/11 13:13:12 UTC

How can Axis2/Java 1.4.1 client detect soap response contains a ?

Hi,

we have a Axis2/Java 1.4.1 client which sends a soap request and gets back a
soap response containing a  <soapenv:Fault>.

We want to throw an error in case the soap response contains a
<soapenv:Fault>.

How can we detect the soap response contains a <soapenv:Fault> ?

We use client classes derived with wsdl2java (adb).


The code is as follows:

      ... prepare the soaprequest...

      // Send the request 
      ....client.remove.RemoveStub.RequestResponse resp =
stub.request(operation);

      // In case an <soapenv:Fault> is returnd, throw error
      ???? ????

      // The response object contains a reference to this request
      String UUID = resp.get_return();

      

An example of a response with <soapenv:Fault>


<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
  <soapenv:Body>
    <soapenv:Fault>
      <soapenv:Code>
        <soapenv:Value>soapenv:Receiver</soapenv:Value>
      </soapenv:Code>
      <soapenv:Reason>
        <soapenv:Text xml:lang="en-US">documentUUID has not correct format.
Should start with urn:uuid: dddd</soapenv:Text>
      </soapenv:Reason>
      <soapenv:Detail />
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>
-- 
View this message in context: http://old.nabble.com/How-can-Axis2-Java-1.4.1-client-detect-soap-response-contains-a-%3Csoapenv%3AFault%3E---tp26300313p26300313.html
Sent from the Axis - User mailing list archive at Nabble.com.


RE: How can Axis2/Java 1.4.1 client detect soap response contains a ?

Posted by Jorge Medina <jm...@e-dialog.com>.
Your stub class is already throwing an Exception when a SOAP fault is received.
Just catch the exception and do whatever you want with it. 

-----Original Message-----
From: SGE0 [mailto:stefangeelen@hotmail.com] 
Sent: Wednesday, November 11, 2009 7:13 AM
To: axis-user@ws.apache.org
Subject: How can Axis2/Java 1.4.1 client detect soap response contains a <soapenv:Fault> ?


Hi,

we have a Axis2/Java 1.4.1 client which sends a soap request and gets back a soap response containing a  <soapenv:Fault>.

We want to throw an error in case the soap response contains a <soapenv:Fault>.

How can we detect the soap response contains a <soapenv:Fault> ?

We use client classes derived with wsdl2java (adb).


The code is as follows:

      ... prepare the soaprequest...

      // Send the request 
      ....client.remove.RemoveStub.RequestResponse resp = stub.request(operation);

      // In case an <soapenv:Fault> is returnd, throw error
      ???? ????

      // The response object contains a reference to this request
      String UUID = resp.get_return();

      

An example of a response with <soapenv:Fault>


<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
  <soapenv:Body>
    <soapenv:Fault>
      <soapenv:Code>
        <soapenv:Value>soapenv:Receiver</soapenv:Value>
      </soapenv:Code>
      <soapenv:Reason>
        <soapenv:Text xml:lang="en-US">documentUUID has not correct format.
Should start with urn:uuid: dddd</soapenv:Text>
      </soapenv:Reason>
      <soapenv:Detail />
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>
--
View this message in context: http://old.nabble.com/How-can-Axis2-Java-1.4.1-client-detect-soap-response-contains-a-%3Csoapenv%3AFault%3E---tp26300313p26300313.html
Sent from the Axis - User mailing list archive at Nabble.com.