Hi Uvindra, It is not safe to change the message formatter in API manager 1.4 as it uses binary relay and the changes will affect globally.
Instead of doing changes to axis2.xml message builder/formatters we can build the message using the builder mediator at the API. <builder class="org.apache.axis2.json.JSONBuilder" formatterClass="org.apache.axis2.json.JSONMessageFormatter"></builder> Thanks. On Tue, Dec 16, 2014 at 11:39 AM, Uvindra Dias Jayasinha <[email protected]> wrote: > > 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 > > -- *Isuru Udana* Senior *Software Engineer* WSO2 Inc.; http://wso2.com email: [email protected] cell: +94 77 3791887 blog: http://mytecheye.blogspot.com/ twitter: http://twitter.com/isudana
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
