HTTP Request Response with Logger icon

HTTP Request Response with Logger

(0 reviews)

home

Illustrates how to use Mule to build a simple HTTP request-response application. After reading this document, and creating and running the example in Mule, you should be able to leverage what you have learned to create a very simple HTTP request-response application. Also, this example demonstrates the interaction between an end user and Mule via an HTTP request, and Mule's ability to log activity in the application.

Example

In this example, an user calls the Mule application by submitting a request via his browser (such as, entering a specific URL, http://localhost:8084/echo). The application receives the request and returns the same payload, or "echoes", the response to the end user. In other words, when a user types http://localhost:8084/echo into the address bar of a browser, Mule returns a message in the browser that reads, /echo (see image below, left); if the user enters http://localhost:8084/moon, Mule responds with /moon (below, right).

There are two functions the Echo example application illustrates:

  1. Receives HTTP requests and returns HTTP responses.
  2. Logs the requests it receives.

Set Up and Run the Example

As with other example templates you can create template applications straight out of the box in Anypoint Studio or, in this case, also in Mule Standalone where this example is called echo. You can tweak the configurations of these use case-based examples to create your own customized applications in Mule.

Follow the procedure below to create, then run the HTTP Request-Response with Logger application.

  1. Create, then run the example application in Anypoint Studio or Standalone.
  2. Open your Web browser, type http://localhost:8084/echo in the address bar, then press Enter.
  3. Your browser presents a message that reads, /echo.
  4. In your browser’s address bar, replace the word echo with the word moon, then press Enter.
  5. Your browser presents a message that reads, /moon.

Documentation

Read full documentation in GitHub

Examples to Try Next

If you understood this example
Filtering a Message - Learn how to use filter components to filter an incoming message.View
If you struggled with this example
Hello World - The first applications you should get running with Mule.View

Reviews

TypeExample
OrganizationMulesoft Inc.
Published by
MuleSoft Organization
Published onMar 17, 2018
Asset overview

Asset versions for 1.4.x

Asset versions
VersionActions
1.4.0