Hi
On 26/06/14 14:02, Timo Hosters wrote:
Hello and thanks for your quick reply.
If I manually set the the Accept-header to "application/json" (resp.
"application/xml") in Soap UI, everything works as expected. So that is the
*most obvious solution* to that issue.
Thank you, Mr. Beryozkin!
I wonder: Is there a way CXF can determine the acceptable content-type
without an Accept-header, maybe based on the payload or a different
configuration of JSON-/JAXB-Providers?
This issue kept me on my toes for quite some time, even looking for other
culprits in different directions (like missing "propOrder" in the
annotations; cf. below). So as lessons-learned from that, here are *some
other remarks/hints that might help people* with future (Soap UI) issues:
As just proven today: Regardless how you set the media-type in Soap UI, it
will NOT automatically set an according Accept-header. So keep you eyes
peeled for that.
Furthermore: Soap UI can and will show you the JSON-aquivalent of XML if you
are in the JSON-tab. Thus you might think everything works. The clue that it
is not is the unexpected content-type in the header of the response.
The same applies if you expect XML but get JSON: Soap UI will show you XML.
But the elements are not in the proper order as specified by your XSD -> do
not blame CXF or a annotation specifying a "propOrder"; it's Soap UI's
doing.

No, CXF can't make the decision on what exactly the user expects based on the input content type if Accept is missing. But a custom filter can easily set HTTP Accept if preferred

Cheers, Sergey




--
View this message in context: 
http://cxf.547215.n5.nabble.com/Question-Getting-XML-instead-of-JSON-wrong-JAXB-JSON-provider-setup-tp5745600p5745627.html
Sent from the cxf-user mailing list archive at Nabble.com.


Reply via email to