This sample demonstrates the WSO2 Application Server's support for JSON, which comes from Apache axis2.
For more information on how JSON works in axis2, refer to the following external URLs:
To build the samples you need Apache Ant build tool.
The steps are as follows.
2. In a command prompt, switch to the sample directory.
For example, in Wndows, cd <AS_HOME>\samples\JSON
3. From there, type ant.
This will create the JSON service (JSONService.aar file) in <AS_HOME>/repository/deployment/server/axis2services directory. If you start the WSO2 Application Server, you can view the "JSONService" service on "Deployed Services" window. (Main -> Services -> List).
The WSDL for the service should be viewable at: http://<host>:<port>/services/JSONService?wsdl
Use the script run-client.sh (in Linux) or run-client.bat file (in Windows) to invoke the client using following optional parameters.
For example, ./run-client.sh -ct ajb
In the JSON sample, an XML element is sent to the Application Server via the client.
You can change the "http port" of the variable String epr = "http://localhost:9763/services/JSONService" in <AS_HOME>/samples/JSON/src/org/wso2/appserver/sample/json/client/JSONClient.java and monitor the JSON object that is passed through to the Application Server, using a capturing tool such as tcp monitor.
Image: JSON Object passing captured from tcp monitor.