Creating A Simple HTTP GET Request Using Mule ESB

It is the first time im using Mule ESB, so im trying to create a simple tutorial using it.

In this tutorial, im trying to do a simple GET request. But first, a simple POST request for comparation.

<expression-component doc:name="Expression"> 
	<![CDATA[
	sendFields = new java.util.HashMap();
	sendFields['aaa']='1';
	sendFields['bbb']='2';
	
	payload = sendFields;]]>
</expression-component>
<http:outbound-endpoint exchange-pattern="request-response" 
			method="POST"
			address="http://192.168.0.1/" 
			contentType="application/x-www-form-urlencoded"
			doc:name="HTTP" />

Looks very simple, create a simple hashmap, send it through http outbond using POST method.
While this is my code for GET method

<http:outbound-endpoint exchange-pattern="request-response" 
			method="GET"
			connector-ref="NoSessionConnector" 
			address="http://192.168.0.1/?aaa=1&amp;bbb=2"
			contentType="text/html" 
			doc:name="HTTP" />

So instead of pushing my parameters via hashmaps, i add them directly on my url.

Leave a Comment

Your email address will not be published.