...just an update, looks like what's happening is that during an unmarshalling error, the unmarshaller eats the exception and returns null. CXF then tries to invoke the service with the null result (sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)) which causes an NPE which is then wrapped in an xml fault response.
So my question remains the same. How can I format the fault response in JSON format? Furthermore how could I have caught the unmarshall exception earlier and handled it myself? Thanks, -Robert ----- Original Message ---- From: Wong <[EMAIL PROTECTED]> To: [email protected] Sent: Sunday, September 28, 2008 10:35:51 AM Subject: Re: How can I get a Fault Response in JSON format? Hi Sergey, Yup, JAX-RS via annotations. Thanks, -Robert ----- Original Message ---- From: Sergey Beryozkin <[EMAIL PROTECTED]> To: [email protected] Sent: Sunday, September 28, 2008 10:01:26 AM Subject: RE: How can I get a Fault Response in JSON format? Are you using JAX-RS ? Cheers, Sergey -----Original Message----- From: Wong [mailto:[EMAIL PROTECTED] Sent: 27 September 2008 02:20 To: [email protected] Subject: How can I get a Fault Response in JSON format? Is there a way to get Fault messages in JSON? Right now, I have a service that tries to consume (and produce) a JSON message. However if there is an UnmarshalException while tryng to bind the incoming message, an XML fault code message is returned (<ns1:XMLFault...). This can be bad if the caller was expecting JSON. A more general question would be how can I customize return messages even if an error happens upstream of my actual service? Thanks! -Robert ---------------------------- IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
