You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Vinh Nguyen (vinguye2)" <vi...@cisco.com> on 2009/07/11 01:17:42 UTC

json error response

Hi,
 
I have a service that returns a custom data object.  It returns JSON
fine.  To handle errors, it throws a WebApplicationException whose
response body detail is from a JAXB object.  But the error response is
coming as XML.  What configuration is needed to get the error response
as JSON?
 
Thanks,
-Vinh
 

RE: json error response

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi Vinh - thanks for confirming it

Cheers, Sergey

-----Original Message-----
From: Vinh Nguyen (vinguye2) [mailto:vinguye2@cisco.com] 
Sent: 11 July 2009 07:58
To: users@cxf.apache.org
Subject: RE: json error response

Sorry, please ignore.

CXF does properly serialize the response as JSON, including error
responses.  It was just my test code that was wrong.  The positive test
case was configured with Accepts="application/json", but the negative
test case wasn't updated and had Accepts="application/xml".  Coding for
too long can do wonders to your eyes:)


-----Original Message-----
From: Vinh Nguyen (vinguye2) 
Sent: Friday, July 10, 2009 4:18 PM
To: users@cxf.apache.org
Subject: json error response

Hi,
 
I have a service that returns a custom data object.  It returns JSON
fine.  To handle errors, it throws a WebApplicationException whose
response body detail is from a JAXB object.  But the error response is
coming as XML.  What configuration is needed to get the error response
as JSON?
 
Thanks,
-Vinh
 

RE: json error response

Posted by "Vinh Nguyen (vinguye2)" <vi...@cisco.com>.
Sorry, please ignore.

CXF does properly serialize the response as JSON, including error
responses.  It was just my test code that was wrong.  The positive test
case was configured with Accepts="application/json", but the negative
test case wasn't updated and had Accepts="application/xml".  Coding for
too long can do wonders to your eyes:)


-----Original Message-----
From: Vinh Nguyen (vinguye2) 
Sent: Friday, July 10, 2009 4:18 PM
To: users@cxf.apache.org
Subject: json error response

Hi,
 
I have a service that returns a custom data object.  It returns JSON
fine.  To handle errors, it throws a WebApplicationException whose
response body detail is from a JAXB object.  But the error response is
coming as XML.  What configuration is needed to get the error response
as JSON?
 
Thanks,
-Vinh