By the design, ESB expects a message body to send the request to backend server when the http method is POST or PUT. But you can overwrite this behavior by using the property FORCE_POST_PUT_NOBODY. Then you can post or put the request without message body or with the message body if exist to the backend server.
Bellow is the sample proxy service which capable for sending empty messages
<proxy xmlns="http://ws.apache.org/ns/synapse" name="httpendpoint" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="full" />
<property name="FORCE_POST_PUT_NOBODY" value="true" scope="axis2" type="BOOLEAN" />
</inSequence>
<outSequence>
<send />
</outSequence>
<endpoint>
<http uri-template="http://localhost:8080/echoempty/echoemptyrequest" />
</endpoint>
</target>
<description />
</proxy>
Then you can send the http messages as bellow to the proxy service.
POST /services/httpendpoint HTTP/1.1
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
Host: 127.0.0.1:8282
User-Agent: Apache-HttpClient/4.2.3 (java 1.5)
No comments:
Post a Comment