I have been trying to implement a simple heart beat REST API in WSO2 ESB and am not able to get a response back. Below is the API
<api xmlns="http://ws.apache.org/ns/synapse" name="HealthCheckAPI" context="/HealthCheck">
<resource methods="GET" url-mapping="/status" faultSequence="fault">
<inSequence>
<payloadFactory media-type="json">
<format>{"Status":"OK"}</format>
<args></args>
</payloadFactory>
<log>
<property name="JSON-Payload" expression="json-eval($.)"></property>
</log>
<property name="messageType" value="application/json" scope="axis2" type="STRING"></property>
<respond></respond>
</inSequence>
</resource>
</api>
When I curl the API, the response is zero length. What could be wrong?
curl -v http://localhost:8280/HealthCheck/status
You need to set following property .
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"></property>
Please find the working example
<api xmlns="http://ws.apache.org/ns/synapse" name="HealthCheckAPI" context="/HealthCheck">
<resource methods="GET" url-mapping="/status" faultSequence="fault">
<inSequence>
<payloadFactory media-type="json">
<format>{"Status":"OK"}</format>
<args></args>
</payloadFactory>
<log>
<property name="JSON-Payload" expression="json-eval($.)"></property>
</log>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"></property>
<property name="messageType" value="application/json" scope="axis2" type="STRING"></property>
<respond></respond>
</inSequence>
</resource>
</api>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With