Reputation: 19905
I have installed Apache Axis2 1.6.1 in a Jetty 8.0.4 web server, but JSON parsing does not seem to work, so I was wondering whether something more needs to be installed or configured in order for the receiving (service) side to understand JSON.
More specifically, I use the POJO Deployment scenario for a simple service that I have developed and, while everything works as expected with SOAP requests, when I try to use JSON I keep getting the following exception:
org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<' at [row,col {unknown-source}]: [1,1]
This occurs consistently as a result of using any message sending method (e.g., sendReceive() or invokeRobust()), not only with my service, but even for the unit tests (e.g., JSONIntegrationTest) bundled with Axis2.
Using packet tracing I can see that the outgoing message is correctly formatted in JSON ("application/json" content type), so, given the exception, obviously the receiving end fails to deserialize the message into the service expecting it. Apparently, Axis2 is waiting for XML even when it is receiving JSON.
How do I tell Axis2 to deserialize JSON at the receiving (service) end?
Upvotes: 0
Views: 1877
Reputation: 9154
You will need to configure a JSON message builder on the server side. However, even with that it will not work because of AXIS2-5158.
Upvotes: 1