cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davide Gesino <>
Subject Re: Custom Exception thrown from JAX-WS Handlers
Date Tue, 05 Feb 2008 16:10:31 GMT

Wrapping my custom exception in a cxf fault works well, the exception is
unwinded gracefully on the client side.

The reason I wanted to use a SOAPFaultException is I have the boundary not
to rely too much on the CXF API, and leave the more JAX-WS standard I can
(it's a designing issue provided from high above :-( ), for I'd rather use
interceptors if I could.
I know all of it does not make very sense, forv when you choose a technology
you'd better rely completely on it. 
Anyway even using the sole Fault exception binds me to the CXF API.

Trying to build my own SOAPFaultException and populating it I have some
weird error, that I am not able to get out, as it is better explained here:

thanks again.

dkulp wrote:
> On Friday 01 February 2008, Davide Gesino wrote:
>> I have som problems with JAX-WS handers... I have to do some
>> preprocessing stuff in an handler before validating the massage.
>> if the message does not respect my boundary I have to throw a custom
>> exception... 4 example ProcessingFailureException.
>> PFE does not inherit from RuntimeException.
>> CXf interceptor solve the problem in a really elegant way, for the
>> apache "Fault"specified in the handleMessage is a container for any
>> throwable, so I can encapsulate my custom exception and have it
>> gracefully unwinded and recovered on the client side.
>> a SoapFault is created, sent and received on the client side... and
>> somehow the right checked exception is recovered.
>> JAX-WS Handers are a trouble... my exception does not inherit from
>> RuntimeException, so I can't declare my exception in the handleMessage
>> signature.
>> I can create a SOAPFault and encapsulate some info in it, but what to
>> put insede it?
>> There is a way to recover the right exception on the client side
>> without pain?
>> Any idea?
> With PURE JAX-WS, you definitely are on your own.  You would have to 
> create the SOAPFaulException with the SOAPFault filled in inside it.  
> Unfortunately, you have to fill it all in yourself.   Youd want to set 
> the fault code, fault string, and then create the details element in it.   
> The easiest way to figure out what it would look like is to throw your 
> exception from a CXF interceptor and record the wire trace.  Then fill 
> in the details to make it look like that.
> With CXF, you should be able to wrapper the exception with a CXF Fault 
> object just like you did from an interceptor.   I believe that should 
> work.
> -- 
> J. Daniel Kulp
> Principal Engineer, IONA

View this message in context:
Sent from the cxf-user mailing list archive at

View raw message