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
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to