0
votes

I am developing web service using Axis2, creating .aar file and deploying it in WSO2 Application Server. The Axis2 services deployed successfully and returns me the response as below.

<ns:serviceResponse xmlns:ns="http://service.axis.example.com">
    <ns:return>{"status":"SUCCESS"}</ns:return>
</ns:serviceResponse>  

But I am expecting a JSON response. Since Axis2 has support for JSON response, I tried following the below tutorial by modifying axis2.xml(Enabling messageBuilder and messageFormatter) but it was not successful.
http://axis.apache.org/axis2/java/core/docs/json_support.html
http://www.javacodegeeks.com/2012/02/json-web-service-with-java-and-axis2.html
Also,
I tried deploying wso2dynamic-response-20080916.170559-241.mar from UI (Modules Tab -> Add) and the uploaded file deployed to the following location(CARBON_HOME/repository/deployment/server/axis2modules).
And I tried copying wso2dynamic-response-1.5.jar as per suggestion in I can't to return json objects using Axis2 but still getting XML response instead of JSON.

Kindly let me know what I am doing wrong and guide to the right direction.
Thanks in Advance.

2

2 Answers

1
votes

Would JSONMessageFormatter.getJSONWriter Help?

0
votes

Enabling JSON message formatter in the axis2.xml should work..Anyway , what is your response's content type?..It should be application/json