Please vote for https://issues.apache.org/jira/browse/AXIS2-5158
Workaround: Insert Spring JSON/Rest service between client and axis2 as a proxy. From: Yashwanth Rajaram -X (yrajaram - ZENSAR TECHNOLOGIES INC at Cisco) [mailto:yraja...@cisco.com] Sent: Sunday, November 13, 2011 8:45 AM To: java-user@axis.apache.org Subject: RE: RESTful Web Services using Axis2 and Mapped JSON We are also struggling with this ... seems like converting JSON payload to Axis' internal notation is the issue... If you make this work pls share a sample... thanks, -- Yashwanth From: Public Network Services [mailto:publicnetworkservi...@gmail.com] Sent: Saturday, November 12, 2011 4:41 AM To: java-user@axis.apache.org Subject: RESTful Web Services using Axis2 and Mapped JSON Hi... I have been trying for days now to implement a simple REST web service using Axis 1.6.2 in Jetty 8.0.4, with serialization and deserialization in JSON, but with limited success: all the code works fine with SOAP, but not with REST. So, any help is very welcome. For start, I am trying to make the sample "MyService" in samples/userguide/example1 work with samples/userguide/clients/RESTClient. The service works fine with SOAP, but after adding options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE); it stops working, returning a cryptic AxisFault message referring to a NullPointerException, without any further information. I am aware of issue 5158 (https://issues.apache.org/jira/browse/AXIS2-5158), but the services.xml file in the repository/services/sample-MyService.aar archive already uses the required RawXMLINOutMessageReceiver and I have declared "application/json" in both the client and the service axis2.xml configuration file. TCPMon shows that the request is transmitted in proper Mapped JSON (I don't want Badgerfish) but, as already mentioned, an AxisFault is returned. I need to make this thing work asap and have run out of ideas. Any clues? Thanks! PS: These are the formatting statements in my axis2.xml files (client and service sides). <!-- ================================================= --> <!-- Message Receivers --> <!-- ================================================= --> <messageReceivers> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only" class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> </messageReceivers> <!-- ================================================= --> <!-- Message Formatter --> <!-- ================================================= --> <messageFormatters> <messageFormatter contentType="application/json" class="org.apache.axis2.json.JSONMessageFormatter"/> <messageFormatter contentType="application/x-www-form-urlencoded" class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/> <messageFormatter contentType="multipart/form-data" class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/> <messageFormatter contentType="application/xml" class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/> <messageFormatter contentType="text/xml" class="org.apache.axis2.transport.http.SOAPMessageFormatter"/> <messageFormatter contentType="application/soap+xml" class="org.apache.axis2.transport.http.SOAPMessageFormatter"/> </messageFormatters> <!-- ================================================= --> <!-- Message Builders --> <!-- ================================================= --> <messageBuilders> <messageBuilder contentType="application/json" class="org.apache.axis2.json.JSONOMBuilder"/> <messageBuilder contentType="application/xml" class="org.apache.axis2.builder.ApplicationXMLBuilder"/> <messageBuilder contentType="application/x-www-form-urlencoded" class="org.apache.axis2.builder.XFormURLEncodedBuilder"/> <messageBuilder contentType="multipart/form-data" class="org.apache.axis2.builder.MultipartFormDataBuilder"/> </messageBuilders>