Anypoint Exchange

Home to the complete listing of connectors, templates, examples and APIs.
Discover and use proven assets built by the MuleSoft ecosystem, or add assets to a private
tenant of Anypoint Exchange for collaboration and sharing of internal best practices.

Learn more
Sign up
HTTP Request Response with Logger

HTTP Request Response with Logger

β˜…
β˜…
β˜…
β˜…
β˜…
(0 reviews)

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

Download
Log into Anypoint Platform to download this asset

Overview

Type
Example
Created by
MO
MuleSoft Organization
Published onJun 22, 2017

Versions

VersionRuntime version
1.4.03.x
1.3.33.7
1.2.03.6
1.1.03.5