The new HTTP Connector has different syntax from the old one. Besides a different name and different attributes, the new connector must always reference a global element, this is consistent with how most of the other connectors in Mule work. Multiple connectors can reference one single global element that encapsulates many of the common configuration settings.
On the old HTTP Connector, both for inbound and outbound endpoints, it was possible to set up the exchange-pattern so that messages only went in one direction, so inbound endpoints would send no request back to the requestor, and outbound endpoints would not listen for a response to their requests. The new HTTP Connector always has a two way communication.
Below are two basic examples, stripped down to the minimum, showing how the syntax differs between the old and the new connector in a minimal implementation.
Listen for HTTP Requests
New HTTP Connector
This is how to set up the new connector as a listener for incoming HTTP requests
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081"/>
<flow name="test_flow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="NEW HTTP Connector"/>
<...>
</flow>
Old HTTP Endpoint
This is how to set up the old connector as a listener for incoming HTTP Requests
<flow name="test_flow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="/" doc:name="OLD HTTP Connector"/>
<...>
</flow>
|
A key difference between the old HTTP connector and the new one is that – while the old connector listens by default to all subpaths below the one you define – the new HTTP Connector only listens to the specific path you define.
If you wish the new connector to accept subpaths, you can end the path with a wildcard (*)
|
Send an HTTP Request
New HTTP Connector
This is how to set up the new HTTP Connector to send out an HTTP request to an external address
<http:request-config name="HTTP_request_Configuration" host="localhost"
port="8081"/>
<flow name="test_flow">
<...>
<http:request config-ref="HTTP_request_Configuration" path="/" method="GET" doc:name="NEW HTTP Connector"/>
</flow>
Old HTTP Endpoint
This is how to set up the old HTTP Connector to send out an HTTP request to an external address
<flow name="test_flow">
<...>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" method="GET" doc:name="OLD HTTP Connector"/>
</flow>