There are situations where back-end does not need a payload for POST request. However in wso2 ESB has the payload that mediate before the back-end call. In order to drop the message payload you need to perform two tasks in the wso2 ESB.
- Create empty payload using Payload mediator
- use the FORCE_POST_PUT_NOBODY property to enforce.
Example is given below that demonstrate the use case.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<api xmlns="http://ws.apache.org/ns/synapse" name="strip" context="/strip"> | |
<resource methods="POST GET"> | |
<inSequence> | |
<header name="Authorization" scope="transport" value="Bearer XXXXXXXXXXXXXXXXXXXXX"></header> | |
<property name="uri.var.chargeId" expression="json-eval($.chargeId)" scope="default" type="STRING"></property> | |
<payloadFactory media-type="json"> | |
<format></format> | |
<args></args> | |
</payloadFactory> | |
<property name="ContentType" value="application/x-www-form-urlencoded" scope="axis2"></property> | |
<property name="messageType" value="application/x-www-form-urlencoded" scope="axis2"></property> | |
<property name="FORCE_POST_PUT_NOBODY" value="true" scope="axis2" type="BOOLEAN"></property> | |
<call> | |
<endpoint> | |
<address uri="https://api.stripe.com/v1/charges/{uri.var.chargeId}/refunds"></address> | |
</endpoint> | |
</call> | |
<respond></respond> | |
</inSequence> | |
</resource> | |
</api> |