HTTP Connector

HTTP Connector

(0reviews)

Using the HTTP or HTTPS protocol, the HTTP connector performs one of the following operations:

  • Listener - Starts executing the Mule flow upon receiving an HTTP request.
  • Request - Consumes an HTTP service.

Mule preconfigures the first HTTP connector in an empty flow as a Listener and trigger. When the app runs and the Listener hears a request, the flow executes.

By default, the Listener configuration connects to CloudHub using HTTP and the Request configuration connects to port 80 using HTTP and GET. You can quickly configure an app to consume an HTTP service using the two HTTP connector instances as follows:

  • Listener configuration: Path = /somepath, for example
  • Request configuration: Path Or URL = the URL of the HTTP service you want to consume

Note: This connector module only works with Mule 4 and Studio 7.

HTTP Requests

The HTTP connector has a Listener operation that receives requests over HTTP or HTTPS protocol. Receiving a request generates a Mule event and passes the request body to the next element of the flow as the message payload. You can refer to parts of the Event output. The method, headers, query parameters, and so on are returned in the attributes as HttpRequestAttributes.

HTTP Responses

The response to a request can include the following information:

  • Status code
  • Reason phrase
  • Body
  • Headers

You can configure a response for a successful or failed execution of the flow of the listener. By default, the former presents the payload as a body and yields a 200 status code. By default, the latter presents the error description as a body and yields a 500 status code.


Reviews

Overview

Type
Module
Created By
MO
MuleSoftOrganization
Published On
Aug 12, 2017