I am Trying to Transform XML payload to JSON format using WSO2 Proxy service.As part of this I did the following.But I couldn,t recieve the JSON Format response.Could any one help me on this.
I have uuncommented the following message builder and formatter from axis2.xml and axis2_blocking_client.xml of wso2esb-4.9.0\repository\conf\axis2 path
messageBuilder contentType="application/json" class="org.apache.synapse.commons.json.JsonStreamBuilder"
messageFormatter contentType="application/json" class="org.apache.synapse.commons.json.JsonStreamFormatter"
ANd My Proxy is
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="TestXML_To_JSON" transports="http,https" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <header name="To" action="remove"/> <property name="RESPONSE" value="true"/> <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/> <payloadFactory media-type="xml"> <format> <person> <fullName> <firstName>Laks</firstName> <lastName>M</lastName> </fullName> <birthDate> <month>May</month> <date>31</date> <year>2015</year> </birthDate> <address> <street>test1</street> <province>test2</province> <city>Colombo</city> <country>test3</country> <postalCode>0002</postalCode> </address> </person> </format> <args/> </payloadFactory> <property name="messageType" value="application/json" scope="axis2" type="STRING"/> <send/> </inSequence> I am expecting the response in JSOn Format as key value pairs as I set the property messageType as application/json.But when I tenst this Proxy it gives the output as follows...... JSONObject
<jsonObject> <person> <fullName> <firstName>Laks</firstName> <lastName>M</lastName> </fullName> <birthDate> <month>May</month> <date>31</date> <year>2015</year> </birthDate> <address> <street>test1</street> <province>test2</province> <city>Colombo</city> <country>test3</country> <postalCode>0002</postalCode> </address> </person> </jsonObject> Please help me how to configure my proxy or message builder and formatters to get the response as actual JSOn format as Key valuye pairs.
Thanks, Lakshmi
No comments:
Post a Comment