[WSO2 ESB] GET Request to a Proxy Service Returned Nothing

If you do a GET request to a proxy without no body (which is most of the time), and if you expect a response, you should set the below property in the in-sequence.

<property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>

This property is used to specify the availability of a content body in a HTTP request. In case of GET and DELETE requests this property is set to true. This property should be removed if a user want to generate a response from the ESB to a request without an entity body, for example, GET request.


Here is an example where you can use this property in a REST API defined in ESB.

<api xmlns="http://ws.apache.org/ns/synapse" name="SampleAPI" context="/sample">
   <resource methods="GET">
      <inSequence>
         <property name="NO_ENTITY_BODY" scope="axis2" action="remove"></property>
         <payloadFactory media-type="xml">
            <format>
               <m:result xmlns:m="http://samples.org">true</m:result>
            </format>
            <args></args>
         </payloadFactory>
         <respond></respond>
      </inSequence>
   </resource>
</api>



You will get the response as below.

<m:result xmlns:m="http://samples.org">true</m:result>

Hasitha Hiranya

No comments:

Post a Comment

Instagram