You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by SmellTheGlove <rf...@yahoo.com> on 2010/03/23 20:47:24 UTC
How to handle an exception not in the WSDL
I have a customer that is using Axis. They are sending faults that are not
in the WSDL they have supplied me and that I brought into CXF. The SOAP
headers look like:
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4. 2.2.GA (build: SVNTag=JBoss_4_2_2_GA
date=200710221139)/Tomcat-5.5
Content-Type: application/soap+xml;
action="http://www.w3.org/2005/08/addressing/soap/fault";charset=UTF-8
Date: Mon, 22 Mar 2010 21:55:52 GMT
Connection: close
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault
xmlns:aovexns="urn:com.company.services.exceptions.InvalidArgumentsException">
<soapenv:Code>
<soapenv:Value>aovexns:IA01</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Invalid
arguments</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail><Exception>org.apache.axis2.AxisFault:
Invalid arguments
stack
</soapenv:Detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
My code spits out:
Mar 23, 2010 12:41:55 PM com.sun.xml.messaging.saaj.soap.ver1_2.Fault1_2Impl
checkIfStandardFaultCode
SEVERE: SAAJ0435: {urn:com.company.services.exceptions.Exception}01 is not a
standard Code value
Exception: null class: java.lang.reflect.UndeclaredThrowableException
I'd like to be able to trap this fault and send something back to my code
that is meaningful that I can act on.
Any help is greatly appreciated.
Thanks,
Randy
--
View this message in context: http://old.nabble.com/How-to-handle-an-exception-not-in-the-WSDL-tp28006122p28006122.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: How to handle an exception not in the WSDL
Posted by Daniel Kulp <dk...@apache.org>.
You may just need to put an interceptor on the FaultInChain that would remap
it to a full exception of some sort. If you put it late in the chain, you
can probably call:
Exception f = message.getContent(Exception.class);
which would probably be a CXF Fault exception class. (specifically, the
SoapFault subclass) You can remap the exception to anything you want (or even
throw a new RuntimeException of some sort).
Dan
On Tuesday 23 March 2010 3:47:24 pm SmellTheGlove wrote:
> I have a customer that is using Axis. They are sending faults that are not
> in the WSDL they have supplied me and that I brought into CXF. The SOAP
> headers look like:
>
> HTTP/1.1 500 Internal Server Error
> Server: Apache-Coyote/1.1
> X-Powered-By: Servlet 2.4; JBoss-4. 2.2.GA (build: SVNTag=JBoss_4_2_2_GA
> date=200710221139)/Tomcat-5.5
> Content-Type: application/soap+xml;
> action="http://www.w3.org/2005/08/addressing/soap/fault";charset=UTF-8
> Date: Mon, 22 Mar 2010 21:55:52 GMT
> Connection: close
>
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope
> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
> <soapenv:Body>
> <soapenv:Fault
> xmlns:aovexns="urn:com.company.services.exceptions.InvalidArgumentsExceptio
> n"> <soapenv:Code>
> <soapenv:Value>aovexns:IA01</soapenv:Value>
> </soapenv:Code>
> <soapenv:Reason>
> <soapenv:Text xml:lang="en-US">Invalid
> arguments</soapenv:Text>
> </soapenv:Reason>
> <soapenv:Detail><Exception>org.apache.axis2.AxisFault:
> Invalid arguments
> stack
> </soapenv:Detail>
> </soapenv:Fault>
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> My code spits out:
>
> Mar 23, 2010 12:41:55 PM
> com.sun.xml.messaging.saaj.soap.ver1_2.Fault1_2Impl
> checkIfStandardFaultCode
> SEVERE: SAAJ0435: {urn:com.company.services.exceptions.Exception}01 is not
> a standard Code value
> Exception: null class: java.lang.reflect.UndeclaredThrowableException
>
>
> I'd like to be able to trap this fault and send something back to my code
> that is meaningful that I can act on.
>
> Any help is greatly appreciated.
>
> Thanks,
>
> Randy
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog