3. About
The HTTP connector can send and receive HTTP and HTTPS requests given
a selected host, port and address.
Depending on your needs, you can either:
Listen for HTTP requests
Send HTTP requests
Through additional configuration, the connector allows you to:
Use TLS encryption to send or receive HTTPS requests
Send Authenticated Requests, via Basic Authentication, Digest and OAuth
4. Ways it works
In Studio, the HTTP connector can work in one of two ways, depending on
where it’s placed in a flow:
As an HTTP Listener
As an HTTP Requester
5. As HTTP Listener
To instantiate the connector as an HTTP listener connector, you must place it
onto a blank Anypoint Studio canvas into the Source section of a new flow (i.e.
as the first element in the flow) as you design your Mule application:
6. As HTTP Requester
To instantiate the connector as an HTTP request connector, you must place it
into the Process section of a flow (i.e. : anywhere except the beginning of it):
7. Sample Use Case
So now, we will see how http connector works as a listener:
10. Continue…
Step 3: Add a set payload transformer and a logger just after it
Value:
#['This is a sample payload']
Message:
#['LOGGER_MSG- '+message.payload]
13. Conclusion
So this way we have seen how http connector works as a listener, Similarly http
requester can be configured and be used.
HTTP listener can be configured for different HTTP methods- GET, POST, etc.