I modified axis2.xml as per your suggestions: $ diff axis2.xml axis2.xml_orig 157,158d156 < <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" < class="org.apache.axis2.json.gson.rpc.JsonRpcMessageReceiver"/> 160c158,160 < class="org.apache.axis2.json.gson.rpc.JsonInOnlyRPCMessageReceiver"/> --- > class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> > <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" > class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> 179,180c179,182 < <messageFormatter contentType="application/json" < class="org.apache.axis2.json.gson.JsonFormatter"/> --- > > > <messageFormatter contentType="application/json-impl" > class="org.apache.axis2.json.gson.JsonFormatter" /> 195,196c197,200 < <messageBuilder contentType="application/json" < class="org.apache.axis2.json.gson.JsonBuilder"/> --- > > > <messageBuilder contentType="application/json-impl" > class="org.apache.axis2.json.gson.JsonBuilder" />
I rebuilt and uploaded the JsonService.aar. run.client still got the error: [java] Response status code: 500 [java] Response body: [java] <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action> http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action></soapenv:Header><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<' [java] at [row,col {unknown-source}]: [1,1]</soapenv:Text></soapenv:Reason><soapenv:Detail/></soapenv:Fault></soapenv:Body></soapenv:Envelope> On Thu, Dec 26, 2019 at 10:07 AM robertlazarski . <robertlazar...@gmail.com> wrote: > About the next release, not many committers are active right now and > we need to get the client side code to work under JDK 11 and also > remove all commons http client 3.x deps. Lots of Jira cleanup too. > > So we can use some help. If you or anyone else are interested in > becoming a committer to help in any way - docs and testing included - > feel free to inquire about it on this list. All it takes is 3 +1 votes > from existing committers. > > Regards, > Robert > > On Thu, Dec 26, 2019 at 5:00 AM robertlazarski . > <robertlazar...@gmail.com> wrote: > > > > I forgot to mention the json builders and formatters, see below. > > > > Also, the json support works by the content-type header flag so be > > sure to set it from whatever http client you use: > > > > curl -H "Content-Type: application/json" > > > > <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/xml" > > > > class="org.apache.axis2.transport.http.SOAPMessageFormatter"/> > > <messageFormatter contentType="application/soap+xml" > > > > class="org.apache.axis2.transport.http.SOAPMessageFormatter"/> > > <messageFormatter contentType="application/json" > > > class="org.apache.axis2.json.gson.JsonFormatter"/> > > </messageFormatters> > > > > <!-- ================================================= --> > > <!-- Message Builders --> > > <!-- ================================================= --> > > <!--Following content type to builder mapping can be used to > > implement support for different message --> > > <!--formats in Axis2. These message formats are expected to be > > resolved based on the content type. --> > > <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="application/json" > > class="org.apache.axis2.json.gson.JsonBuilder"/> > > </messageBuilders> > > > > On Thu, Dec 26, 2019 at 3:45 AM albert kao <albertk...@gmail.com> wrote: > > > > > > I modified axis2.xml as per your suggestions: > > > $ diff axis2.xml axis2.xml_orig > > > 157,158d156 > > > < <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" > > > < > class="org.apache.axis2.json.gson.rpc.JsonRpcMessageReceiver"/> > > > 160c158,160 > > > < > class="org.apache.axis2.json.gson.rpc.JsonInOnlyRPCMessageReceiver"/> > > > --- > > > > > class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> > > > > <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" > > > > > class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> > > > > > > > > > I rebuilt and uploaded the JsonService.aar. > > > run.client still got the error: > > > com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' > (code 123) in prolog; expected '<' > > > > > > > > > > > > When the next release be available? > > > > > > On Mon, Dec 23, 2019 at 10:09 AM robertlazarski . < > robertlazar...@gmail.com> wrote: > > >> > > >> The next release will include improved json docs and a few bug fixes, > > >> as this is the direction my day job has moved into for some time now. > > >> > > >> What I suspect is your problem, is that you need the right axis2.xml > > >> file config that supports json. Its setup for SOAP by default. > > >> > > >> Here's how mine looks. Note that I use one config for SOAP and another > > >> for json via build time tweaks of the file > > >> > > >> <messageReceivers> > > >> <!--deleteThisCommentForJSONWebServices > > >> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" > > >> > class="org.apache.axis2.json.gson.rpc.JsonRpcMessageReceiver" /> > > >> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" > > >> > class="org.apache.axis2.json.gson.rpc.JsonInOnlyRPCMessageReceiver"/> > > >> deleteThisCommentForJSONWebServices--> > > >> <!-- OPTIONAL DELETE OF Axis2 SOAP START --> > > >> <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"/> > > >> <!-- OPTIONAL DELETE OF Axis2 SOAP END --> > > >> </messageReceivers> > > >> > > >> Regards, > > >> Robert > > >> > > >> On Sat, Dec 21, 2019 at 4:20 AM albert kao <albertk...@gmail.com> > wrote: > > >> > > > >> > How to fix the "com.ctc.wstx.exc.WstxUnexpectedCharException: > Unexpected character '{' (code 123) in prolog; expected '<'" in > samples/json ? > > >> > > > >> > > > >> > cd $AXIS2_HOME/samples/json > > >> > ant run.client > > >> > > > >> > > > >> > > > >> > client.compile: > > >> > [javac] /home/carmen/axis2-1.7.9/samples/json/build.xml:66: > warning: 'includeantruntime' was not set, defaulting to > build.sysclasspath=last; set to false for repeatable builds > > >> > > > >> > client.jar: > > >> > [jar] Building jar: > /home/carmen/axis2-1.7.9/samples/json/build/json-client.jar > > >> > > > >> > run.client: > > >> > [java] log4j:WARN No appenders could be found for logger > (org.apache.commons.httpclient.params.DefaultHttpParams). > > >> > [java] log4j:WARN Please initialize the log4j system properly. > > >> > [java] Response status code: 500 > > >> > [java] Response body: > > >> > [java] <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope > xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Header > xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action> > http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action></soapenv:Header><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text > xml:lang="en-US">com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected > character '{' (code 123) in prolog; expected '<' > > >> > [java] at [row,col {unknown-source}]: > [1,1]</soapenv:Text></soapenv:Reason><soapenv:Detail/></soapenv:Fault></soapenv:Body></soapenv:Envelope> > > >> > > > >> > > >> --------------------------------------------------------------------- > > >> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > > >> For additional commands, e-mail: java-user-h...@axis.apache.org > > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org > For additional commands, e-mail: java-user-h...@axis.apache.org > >