I'm wondering is it a question about JAX-RS by any chance ?
Just in case it is :-) ('Response' is mentioned in the original mail) here's 
the info on how to do it in JAX-RS :
1. throw unchecked JAX-RS WebApplicationException, by initializing it
with an xml-based Response

2. Throw whatever custom exception youy need to throw, checked/unchecked and 
register
a JAX-RS ExceptionMapper, for ex MyExceptionMapper<BookException>, it will be used to convert BookException into Response instances...

Cheers, Sergey

P.S. If it's a JAX-RS question - then please consider adding JAX-RS: prefix in 
the future to avoid any confusions...

----- Original Message ----- From: "Daniel Kulp" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, July 17, 2008 12:32 PM
Subject: Re: Custom CXF Exceptions/Faults



In both cases, the easiest thing to do would probably to put an interceptor early in the FaultOut chain that pulls the Fault/ Exception out of the chain and replaces it with a SoapFault that you've built up with your needed codes and such.

In the second case, you could subclass our invoker (JAXWSMethodInvoker if using jaxws) and overwride the createFault method to do whatever you need.

Dan



On Jul 16, 2008, at 11:12 PM, David Castro wrote:

So my problem is twofold.  I need to be able to:

a) Catch all exceptions that CXF sends back to the client and replace
the exception with a custom exception.  Do I use an interceptor for
this? How do I basically return a Response object with custom XML and a
status code?

b) Have a standard way to throw exceptions from service methods and have
them serialized into a custom XML format.  Do I just need to try catch
everything from all my methods and build some XML or is there something more convenient? I know I can always use a spring interceptor fudge it
too...wondering if there is a CXF mechanism for doing this.

Thanks in advance.

Cheers,
David




---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to