cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: setting custom fault code on exceptions
Date Wed, 04 Jan 2012 18:35:16 GMT
On Wednesday, January 04, 2012 6:03:16 PM Guy Pardon wrote:
> Yes, however with the SOAPFaultException you move away from the fault
> messages defined in the WSDL (since you can't set the Detail easily).

I think with CXF you can do both.  If you throw your "MyCustomException" class 
defined in the WSDL, but set the cause of the exception to be a 
SOAPFaultException that fills in the message and faultcode and such, but NOT 
the details, then CXF will use the original exception for the details part.   

Dan



> So for now I prefer to stay with the generated code of "Server" as per jaxws
> mappings of my exceptions and stick with WSDL compliance. I guess it is a
> known 'issue' in the spec?
> 
> Thanks anyway,
> And: happy 2012!
> 
> Guy
> 
> On 4-jan-2012, at 16:25, Daniel Kulp wrote:
> 
> On Thursday, December 29, 2011 3:29:29 PM Guy Pardon wrote:
> > Hi,
> > 
> > What is the easiest way to set the "Code" element of an exception thrown
> > by my @WebMethod?
> 
> I THINK if the "cause" of an exception that is thrown is a
> SOAPFaultException, the information from that SOAPFault is used to populate
> the returned fault. Thus, you can set the code there.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Mime
View raw message