You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Davide Gesino <wi...@libero.it> on 2008/03/26 08:54:20 UTC

convert a SOAP Fault to the contained java exception

Assume I receive an answer such as:

//	<INFO - <?xml version="1.0" encoding="UTF-8"?>
//	<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
//	  <soap:Body>
//	    <soap:Fault>
//	      <faultcode>soap:Server</faultcode>
//	      <faultstring>processing failure exception</faultstring>
//	      <detail>
//	        <ProcessingFailureException xmlns="tmf854.v1">
//	          <exception>EXCPT_INTERNAL_ERROR</exception>
//	          <reason>session_token_unexisting</reason>
//	        </ProcessingFailureException>
//	      </detail>
//	    </soap:Fault>
//	  </soap:Body>
//	</soap:Envelope>

how can I recover the contained java exception? There is some utility code
in CXF that does that??
-- 
View this message in context: http://www.nabble.com/convert-a-SOAP-Fault-to-the-contained-java-exception-tp16297081p16297081.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: convert a SOAP Fault to the contained java exception

Posted by Glen Mazza <gl...@verizon.net>.
Providing you have the WSDL, you should be able to run wsdl2java and
have a ProcessingFailureException class that will contain that
information.  Look at [1], in particular Step #4 - the wsdl:message
"CorrelationIdNotFoundFault", Step #6, getAdditionResults() method to
see how this object gets thrown from the web service provider, and Step
#10, how this CorrelationIdNotFoundFault exception gets caught and its
underlying data (your "exception" and "reason" fields below) read.

If you're not using JAX-WS' generated Java objects but just using the
Dispatch interface, you can parse the results, look at here[2], Step #6,
for two of three parsing options (Search on "JAX-WS Dispatch provides
three usage options"), and here[3] for JAXBContext (search for "private
void invokeAddNumbers()" <-- the entire string, including ()'s.)

HTH,
Glen

[1] http://www.jroller.com/gmazza/date/20080308
[2] http://www.jroller.com/gmazza/date/20071102
[3] http://www.javapassion.com/handsonlabs/wsjaxwsadv/#Exercise_1


Am Mittwoch, den 26.03.2008, 00:54 -0700 schrieb Davide Gesino:
> Assume I receive an answer such as:
> 
> //	<INFO - <?xml version="1.0" encoding="UTF-8"?>
> //	<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> //	  <soap:Body>
> //	    <soap:Fault>
> //	      <faultcode>soap:Server</faultcode>
> //	      <faultstring>processing failure exception</faultstring>
> //	      <detail>
> //	        <ProcessingFailureException xmlns="tmf854.v1">
> //	          <exception>EXCPT_INTERNAL_ERROR</exception>
> //	          <reason>session_token_unexisting</reason>
> //	        </ProcessingFailureException>
> //	      </detail>
> //	    </soap:Fault>
> //	  </soap:Body>
> //	</soap:Envelope>
> 
> how can I recover the contained java exception? There is some utility code
> in CXF that does that??