If you have come up with the requirement of sending JSON responses from a proxy service, then following proxy configuration can be used straightaway to try that out.
i.e. Create a proxy service named JSONProxy with the following content. Then, you can try that out by issuing HTTP GET to
Proxy Configuration
i.e. Create a proxy service named JSONProxy with the following content. Then, you can try that out by issuing HTTP GET to
http://localhost:8280/services/JSONProxy Proxy Configuration
<proxy xmlns="http://ws.apache.org/ns/synapse" name="JSONProxy" transports="https,http"
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>
<format>
<person>
<fullName>
<firstName>Ruchira</firstName>
<lastName>Wageesha</lastName>
</fullName>
<birthDate>
<month>May</month>
<date>31</date>
<year>1984</year>
</birthDate>
<address>
<street>Flower Road</street>
<province>Western</province>
<city>Colombo</city>
<country>Sri Lanka</country>
<postalCode>0007</postalCode>
</address>
</person>
</format>
</payloadFactory>
<property name="messageType" value="application/json" scope="axis2"/>
<send/>
</inSequence>
</target>
<description></description>
</proxy>
JSON Response{
"person": {
"fullName": {
"firstName": "Ruchira",
"lastName": "Wageesha"
},
"birthDate": {
"month": "May",
"date": "31",
"year": "1984"
},
"address": {
"street": "Flower Road",
"province": "Western",
"city": "Colombo",
"country": "Sri Lanka",
"postalCode": "0007"
}
}
}