How to implement a dummy REST API in WSO2 ESB
esb, rest, wso2, wso2-esb
Solution
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>
Problem
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