Hi Igor,

The steps you've taken are correct. There is just one more step missing here. In the axis2.xml you will find two sections called messageBuilder and messageFormatter. You need to add the json related builders and formatters into that section.

Add this to the messageFormatter section,

<messageFormatter contentType="application/json"

class="org.apache.axis2.json.JSONMessageFormatter"/>
        <messageFormatter contentType="application/json/badgerfish"

class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
        <messageFormatter contentType="text/javascript"

class="org.apache.axis2.json.JSONMessageFormatter"/>

and the following to the messageBuilder section,

<messageBuilder contentType="application/json"
                         class="org.apache.axis2.json.JSONOMBuilder"/>
        <messageBuilder contentType="application/json/badgerfish"

class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
        <messageBuilder contentType="text/javascript"
                         class="org.apache.axis2.json.JSONOMBuilder"/>

You might be better off using the axis2-json-1.4 jar too instead of 1.2. There may have been bug fixes in the new release.

If you are playing around with JavaScript extensively you might wanna try out our Mashup Server [1] too. Thats an environment where you can write mashups (services) using JavaScript.

Thanks,
Keith.

[1] http://wso2.org/projects/mashup

Dralyuk, Igor wrote:
Hi Keith,

I saw your response regarding JSON in WSAS: 
http://markmail.org/message/hyso2rvecqu6bgru?q=DynamicResponseHandler&page=2

I did a clean install of wsas 2.3, deployed the latest (SNAPSHOT 166) version 
of DynamicResponseHandler,
modified axis2.xml to globally engage the module, added the message formatters 
and builders for application/json and text/javascript
downloaded jettison-1.0.1.jar and axis2-json-1.2.jar into wsas/lib bounced the 
server
and tried to invoke the echoString service: 
http://localhost:9762/services/echo/echoString?in=hello&response=application/json/badgerfish
 and http://localhost:9762/services/echo/echoString?in=hello&response=json

But I am still getting xml back.

Could you point me to a step by step guide on how to enable JSON response in 
WSAS?

Thank you,
Igor

_______________________________________________
Wsas-java-user mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-user



_______________________________________________
Wsas-java-user mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-user

Reply via email to