You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jaybytez <ja...@yahoo.com> on 2011/03/02 19:08:23 UTC

CXF and WebFault - Basic Exception Question

I have an exception I am throwing from my service endpoint and that exception
contains a collection of Objections that hold specific errors.

If I want the client to be able to have access to those models, will the
WebFault provide the serialization of the Object to XML in the service
endpoint of the response and then deserialize back to the Objects for the
client?

Or should I use a fault interceptor to do this?

Thanks,

Jay

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-and-WebFault-Basic-Exception-Question-tp3406924p3406924.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF and WebFault - Basic Exception Question

Posted by jaybytez <ja...@yahoo.com>.
Actually...let me add that I just got WebFault working.

Thanks Willem for the blog...that did help.

So how do you use WebFault to communicate framework exceptions?

Like if my hibernate layer through a NoResultsFoundException, is it best
practice
to create custom faults codes for this and just return these custom codes?
Or
is it best practice to create wrapper (WebFault capable) exceptions around
the
framework exceptions?

Thanks...jay

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-and-WebFault-Basic-Exception-Question-tp3406924p3408361.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF and WebFault - Basic Exception Question

Posted by jaybytez <ja...@yahoo.com>.
So I am trying the two paths, 1) using WebFault, 2) using
AbstractSoapInterceptor to create custom SoapOutInterceptor (for my SEI) and
a SoapInInterceptor for clients.

Utilizing #2, I can successfully modify the content in the standard Soap
Fault and attach details to that Fault.  One the Client side my
SoapInInterceptor is part of the unmarshal phase and I can get the original
details.

My question is, maybe the unmarshal phase is not good, but my
SoapInInterceptor (for my service clients) is configured as an
inFaultInterceptor, and I notice that if I throw a (custom) RuntimeException
out of this Interceptor, it appears to the client as a Soap Fault Exception
and not my custom RuntimeException.

If I was going down this route, is there a different phase I should use?  Or
should I register this as a standard inInterceptor as opposed to a
inFaultInterceptor so that my custom RuntimeException doesn't get rethrown
as a Fault.

Thanks for your help and info...it is really beneficial.

Jay

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-and-WebFault-Basic-Exception-Question-tp3406924p3408334.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF and WebFault - Basic Exception Question

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 02 March 2011 1:08:23 PM jaybytez wrote:
> I have an exception I am throwing from my service endpoint and that
> exception contains a collection of Objections that hold specific errors.
> 
> If I want the client to be able to have access to those models, will the
> WebFault provide the serialization of the Object to XML in the service
> endpoint of the response and then deserialize back to the Objects for the
> client?
> 
> Or should I use a fault interceptor to do this?

CXF *CAN* do the mapping if everything is setup correctly and per jax-ws rules 
for faults and such.   For example, if you are doing a WSDL first thing with 
the faults defined in the wsdl, then everything should just map perfectly 
without really any issues.

With Java first, you would need to make sure there are getters and setters and 
such for the information you want returned.  It's a bit more complex, but it 
usually will work.


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: CXF and WebFault - Basic Exception Question

Posted by Willem Jiang <wi...@gmail.com>.
Please check this blog[1], it shows an example to let you understand the 
WebFault more :)

[1] 
http://willemjiang.blogspot.com/2011/01/how-to-map-soap-fault-message-with.html

On 3/3/11 2:08 AM, jaybytez wrote:
> I have an exception I am throwing from my service endpoint and that exception
> contains a collection of Objections that hold specific errors.
>
> If I want the client to be able to have access to those models, will the
> WebFault provide the serialization of the Object to XML in the service
> endpoint of the response and then deserialize back to the Objects for the
> client?
>
> Or should I use a fault interceptor to do this?
>
> Thanks,
>
> Jay
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-and-WebFault-Basic-Exception-Question-tp3406924p3406924.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