Mule Expression Language Basics icon

Mule Expression Language Basics

(0 reviews)

home

Contains simple flows that introduce most of the basic implementations of Mule Expression Language (MEL).

Set Up and Run the Example

Import the Mule example project into your workspace and run it as a mule application

  • Flow 1: Through a web browser, access the URL http://localhost:8081/greet1?username=yourNameThe response prints the words Hello (yourName) in your browser.

  • Flow 2: Through a web browser, access the URL http://localhost:8081/greet2?username=yourName. This displays the words Hello (yourName) in your browser.Then, access the URL again, but this time do not include any parameters. Verify that the expected output is received.

  • Flow 3: Through a web browser, access the URL http://localhost:8081/greet3?username=yourName&age=22. This displays the words Hello (yourName) in your browser and also saves a CSV file that contains this data and the value true for the boolean parameter.

  • Flow 4: In a browser, access the URL http://localhost:8081/greet4?username=yourName&age=22. This prints the words Hello (yourName) in your browser and also saves a CSV file that contains this data, plus the value true for the boolean parameter.

  • Flow 5: Send the HTTP endpoint an HTTP request that includes a body with an attached XML file. Send a POST request to http://localhost:8081/greet5 attaching an XML to the body of the message. A sample XML is provided below.

The easiest way to do this is to send a POST via a browser extension such as Postman (for Google Chrome) or the curl command line utility.

< user >

< username > test < /username >

< age > 21 < /age >

< /user >

This displays the words Hello yourName in your browser and also saves a CSV file that contains this data and the value true for the boolean parameter.

  • Flow 6: Send the HTTP endpoint an HTTP request that includes a body with an attached JSON file. Send a POST request to http://localhost:8081/greet6, attaching a JSON object the body of the message. A sample JSON is provided below.

    The easiest way to do this is by sending a POST via a browser extension such as Postman (for Google Chrome) or the curl command line utility.

    { "username": "test", "age" : 21 }

    This displays the words Hello yourName in your browser and also saves a CSV file that contains this data and the value true for the boolean parameter.

Documentation

Read full documentation in GitHub

Examples to Try Next

If you understood this example
Content Based Routing - Learn how to route messages based on the logic you supply in the Choice Router.View
If you struggled with this example
HTTP Request Response with Logger - Learn how to use Mule to build a simple HTTP request-response application.View

Reviews

TypeExample
OrganizationMuleSoft
Published by
MuleSoft Organization
Published onJun 22, 2017
Asset overview

Asset versions for 1.4.x

Asset versions
VersionActions
1.4.0