Okay Shafreen helped diagnose this, the axis2.xml of API Manager 1.4 the default JSON message formatter enabled is this,
<messageFormatter contentType="application/json" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/> when the above is used the JSON formatting does not occur as expected, but when this is commented and the below formatter is enabled instead, <messageFormatter contentType="application/json" class="org.apache.axis2.json.JSONMessageFormatter"/> it works. Thanks Shafreen. On 16 December 2014 at 11:16, Uvindra Dias Jayasinha <[email protected]> wrote: > > This is using API Manager 1.4 which uses synapse version 2.1.1.wso2v5 > > On 16 December 2014 at 11:11, Uvindra Dias Jayasinha <[email protected]> > wrote: >> >> Hi All, >> >> Im trying to send a simple JSON response when an API gets invoked, but I >> can only manage a SOAP envelope as the response, here is the synapse >> configuration, >> >> <?xml version="1.0" encoding="UTF-8"?><api xmlns=" >> http://ws.apache.org/ns/synapse" name="HealthCheck_API" >> context="/check_health"> >> <resource methods="POST GET" url-mapping="/*"> >> <inSequence> >> <header name="To" action="remove"/> >> <property name="RESPONSE" value="true"/> >> <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/> >> <payloadFactory media-type="json"> >> <format>{ "status": "okay" }</format> >> </payloadFactory> >> <property name="messageType" value="application/json" >> scope="axis2"/> >> <property name="ContentType" value="application/json" >> scope="axis2"/> >> <send/> >> </inSequence> >> </resource> >> </api> >> >> >> This what Im getting now, >> >> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=" >> http://www.w3.org/2003/05/soap-envelope >> "><soapenv:Body><status>okay</status></soapenv:Body></soapenv:Envelope> >> >> >> This is what I want, >> >> { "status": "okay" } >> >> What am I missing? Thanks >> >> -- >> Regards, >> Uvindra >> >> Mobile: 777733962 >> > > > -- > Regards, > Uvindra > > Mobile: 777733962 > -- Regards, Uvindra Mobile: 777733962
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
