3. Expand the «myfirstproject» on package explorer
Double click on myfirstproject.xml
Once file is open, show Message Flow
From Mule Palette view, search for «HTTP» and select the first one.
Drag and Drop it into Message Flow view.
4. Now we have to configure listner for our HTTP flow
Double click on HTTP blue element
Below it will appear HTTP view
On the General Setting let’s create and choose an HTTP Listener
Click on Add (+) and configure:
Host: localhost
Port: 8081
On «Basic Settings» define web service:
Path: /myfirstFlow
Allow.Methods: GET
Click OK
Click on SAVE at top-left of screen
5. Now we have to configure process part
From Mule Palette view, search for «set» and select «Set Payload»
Drag and Drop it into our flow, under the Process block.
Double click on Set Payload green element
Below it will appear Set Payload view
On the Setting – Value configure the response to return to the caller of service
You can wrote whatever you want .
The sintax is:
# [‘ (what you want ) ‘]
Click on SAVE at top-left of screen
6. Now we can start our Mule server with the service created
Right Click on myfirstproject Run As Mule Application
On the Console view below server is going to start
At the end you will see the status DEPLOYED
**************************************************************
* myfirstproject * default * DEPLOYED *
**************************************************************
This means that server is up and running
7. From Web Browser (IE, Chrome, or what you want) let’s invoke our service endpoint:
http://localhost:8081/myfirstFlow
What we receive is the message that we defined in Set Payload, in my case is:
My First HTTP Service works !
Enjoy with Mule!