I've just picked up the latest Axis2 build (from 20070425) and am having trouble getting JSON and SOAP responses from the sample Version service. Really I think the problem is I just don't understand if Axis2 can do what I'd like it to do. The online documentation and googling for an answer (which revealed an interesting doc at WSO2) hasn't resulted in an answer.
I'd like to return one of the following depending on the content type specified on the request: 1. Plain XML 2. XML wrapped in a SOAP envelope 3. JSON I specified messageformatters and messagebuilders as follows: <messageFormatters> <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/javascript" class="org.apache.axis2.json.JSONMessageFormatter"/> </messageFormatters> <messageBuilders> <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"/> <messageBuilder contentType="text/javascript" class="org.apache.axis2.json.JSONOMBuilder"/> </messageBuilders> The rest of my axis2.xml file has not been modified. When I make a request to http://localhost:8080/axis2/services/Version/getVersion I get the following response: <ns:getVersionResponse xmlns:ns="http://axisversion.sample/xsd"> <ns:return>Hello I am Axis2 version service , My version is 1.2-SNAPSHOT</ns:return> </ns:getVersionResponse> Good. When I change the content type in the header to text/javascript (Content-Type: text/javascript) I get the following error (formatted for readability here): type: Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception java.lang.NullPointerException org.apache.axis2.json.JSONOMBuilder.processDocument(JSONOMBuilder.java:49) org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:130) org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:98) org.apache.axis2.transport.http.AxisServlet$ProcessRESTRequest.processURLRequest(AxisServlet.java:767) org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:238) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs. As for SOAP, I'm not sure what exactly I have to do to get a SOAP response. I tried setting the SOAPAction header (I read this somewhere) but that didn't help. Suggestions? Pointers to docs? Have I configured Axis2 correctly? Is this type of configuration known to work? Thanks, Lawrence --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]