Hi Cristian,
There are two json notations supported in axis2. application/json/badgerfish
and application/json. In this case you need to use the former. Add both
formatters to your axis2.xml as below,
<messageFormatter contentType="application/json"
class="org.apache.axis2.json.JSONMessageFormatter"/>
<messageFormatter contentType="application/json/badgerfish"
class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
Then you can try
http://localhost:8080/axis2/services/Version/getVersion?response=application/json/badgerfish<http://localhost:8080/axis2/services/Version/getVersion?response=application/json>
I updated the above module to map application/json/badgerfish to
?response=json and application/json to ?response=application/json
Thanks,
Keith.
On Sun, May 4, 2008 at 1:12 AM, Cristian Bullokles <
[EMAIL PROTECTED]> wrote:
> Now looks like the parser is working the response is json format but
> allways is a fault. like that:
>
> {"Fault":"<soapenv:Fault
> xmlns:soapenv=\"http:\/\/www.w3.org\/2003\/05\/soap-envelope\"><soapenv:Code><soapenv:Value>soapenv:Receiver<\/soapenv:Value><\/soapenv:Code><soapenv:Reason><soapenv:Text
> xml:lang=\"en-US\">Mapped formatted JSON with namespaces are not supported
> in Axis2. Make sure that your request doesn't include namespaces or use the
> Badgerfish convention<\/soapenv:Text><\/soapenv:Reason><soapenv:Detail
> \/><\/soapenv:Fault>"}
>
> My request is only a get from a browser:
>
>
> http://localhost:8080/axis2/services/Version/getVersion?response=application/json
>
>
>
>
> On Sat, May 3, 2008 at 12:43 AM, keith chapman <[EMAIL PROTECTED]>
> wrote:
>
> > Hi Cristian,
> >
> > Have you engaged DynamicResponseHandler on the version service? If you
> > want to engage this blobally (That will effect all services running on your
> > system) you can do so by adding <module ref="DynamicResponseHandler"/> to
> > your axis2.xml.
> >
> > Thanks,
> > Keith.
> >
> >
> > On Sat, May 3, 2008 at 1:53 AM, Cristian Bullokles <
> > [EMAIL PROTECTED]> wrote:
> >
> > > Hi all
> > > I've modified the axis2.xml file adding this lines:
> > >
> > > <messageFormatters>
> > > <messageFormatter contentType="application/json"
> > >
> > > class="org.apache.axis2.json.JSONMessageFormatter"/>
> > >
> > > <messageBuilders>
> > > <messageBuilder contentType="application/json"
> > > class="org.apache.axis2.json.JSONOMBuilder"/>
> > >
> > > Also as Keith said in a previous thread I've compiled and
> > > installed the module dynamic response:
> > >
> > >
> > > http://wso2.org/repos/wso2/trunk/commons/dynamic-response/
> > >
> > > Then i've restarted tomcat and all continues working at the same
> > > way, when i tried:
> > >
> > >
> > >
> > > http://localhost:8080/axis2/services/Version/getVersion?response=application/json
> > >
> > > I've received the same XML response:
> > >
> > > <ns:getVersionResponse>
> > > <ns:return>
> > > Hello I am Axis2 version service , My version is 1.4
> > > </ns:return>
> > > </ns:getVersionResponse>
> > >
> > > I'm using axis2 1.4 in tomcat6.
> > >
> > > Any idea? I need a JSON response when I invoke using REST with
> > > response=application/json
> > >
> > > Regards
> > > Cristian
> > >
> > >
> >
> >
> > --
> > Keith Chapman
> > Senior Software Engineer
> > WSO2 Inc.
> > Oxygenating the Web Service Platform.
> > http://wso2.org/
> >
> > blog: http://www.keith-chapman.org
>
>
>
--
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/
blog: http://www.keith-chapman.org