You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by simran <hs...@bayatree.com> on 2011/12/14 17:54:28 UTC
Customized SOAP faults
I am working on Webservice client to WCF webservice (asp.net). The webservice
is sending faults as per soap 1.2 standard, but instead of reserved keywords
Sender/Receiver, they are also sending some other faults like
a:ApplicationFault (which points to some namespace).
<s:Fault>
<s:Code>
<s:Value
xmlns:a="urn:mysystems.com:2004-05.Faults">*a:ApplicationFault*</s:Value>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">Object reference not set to an instance of an
object.</s:Text>
</s:Reason>
<s:Detail>
<ApplicationFault xmlns="urn:mysystems.com:2004-05.Faults"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Type>System.NullReferenceException</Type>
</ApplicationFault>
</s:Detail>
</s:Fault>
Due to this, client code is throwing exceptions that a:ApplicationFault is
not a standard value.
Can we handle these type of custom faults in CXF?
Thanks
--
View this message in context: http://cxf.547215.n5.nabble.com/Customized-SOAP-faults-tp5075038p5075038.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Customized SOAP faults
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
You need to do some work on the ClientFaultConverter to turn the
ApplicationFault to the exception which the client proxy can be thrown.
<ApplicationFault xmlns="urn:mysystems.com:2004-05.Faults"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Type>System.NullReferenceException</Type>
</ApplicationFault>
On Thu Dec 15 19:29:38 2011, simran wrote:
> Thanks for your reply Willem...
>
> Your blog shows when example when you know what type of exception will be
> thrown, but in our case the webservice is throwing UndeclaredThrowable
> exception and we have not rights to make any change in customer's
> webservice. Just to handle everything on client side (map/supress etc)...
>
> Can we cast undeclaredthrowable to soapexception or other type and then
> fetch the information from that?
> or any other way to handle this type of case?
>
> Thanks a lot...
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Customized-SOAP-faults-tp5075038p5077208.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
Re: Customized SOAP faults
Posted by simran <hs...@bayatree.com>.
Thanks for your reply Willem...
Your blog shows when example when you know what type of exception will be
thrown, but in our case the webservice is throwing UndeclaredThrowable
exception and we have not rights to make any change in customer's
webservice. Just to handle everything on client side (map/supress etc)...
Can we cast undeclaredthrowable to soapexception or other type and then
fetch the information from that?
or any other way to handle this type of case?
Thanks a lot...
--
View this message in context: http://cxf.547215.n5.nabble.com/Customized-SOAP-faults-tp5075038p5077208.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Customized SOAP faults
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
You may need to add a customer interceptor to interpret the detail message.
You can find some information here[1], and you need also take a look at
the code of org.apache.cxf.interceptor.ClientFaultConverter[2]
[1]http://willemjiang.blogspot.com/2011/01/how-to-map-soap-fault-message-with.html
[2]https://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
Willem
On Thu Dec 15 00:54:28 2011, simran wrote:
> I am working on Webservice client to WCF webservice (asp.net). The webservice
> is sending faults as per soap 1.2 standard, but instead of reserved keywords
> Sender/Receiver, they are also sending some other faults like
> a:ApplicationFault (which points to some namespace).
>
> <s:Fault>
> <s:Code>
> <s:Value
> xmlns:a="urn:mysystems.com:2004-05.Faults">*a:ApplicationFault*</s:Value>
> </s:Code>
> <s:Reason>
> <s:Text xml:lang="en-US">Object reference not set to an instance of an
> object.</s:Text>
> </s:Reason>
> <s:Detail>
> <ApplicationFault xmlns="urn:mysystems.com:2004-05.Faults"
> xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
> <Type>System.NullReferenceException</Type>
> </ApplicationFault>
> </s:Detail>
> </s:Fault>
>
> Due to this, client code is throwing exceptions that a:ApplicationFault is
> not a standard value.
>
> Can we handle these type of custom faults in CXF?
>
> Thanks
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Customized-SOAP-faults-tp5075038p5075038.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang