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 . <[email protected]>
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 <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>