Mule ESB
First HTTP Flow
OpenAnypointStudio
CreateaFileNewMuleProject
Click«Finish»
Expandthe«myfirstproject»onpackage
explorer
Doubleclickonmyfirstproject.xml
Oncefileisopen,showMessageFlow
FromMulePaletteview,searchfor
«HTTP»and selectthefirstone.
DragandDropitintoMessageFlowview.
Nowwehavetoconfigurelistnerforour
HTTPflow
DoubleclickonHTTPblueelement
BelowitwillappearHTTPview
OntheGeneralSettinglet’screateand
chooseanHTTPListener
ClickonAdd(+)andconfigure:
Host:localhost
Port:8081
On«BasicSettings»definewebservice:
Path:/myfirstFlow
Allow.Methods:GET
ClickOK
ClickonSAVEattop-leftofscreen
Nowwehavetoconfigureprocesspart
FromMulePaletteview,searchfor«set»
and select«SetPayload»
DragandDropitintoourflow,underthe
Processblock.
DoubleclickonSetPayloadgreen
element
BelowitwillappearSetPayloadview
OntheSetting–Valueconfigurethe
responsetoreturntothecallerofservice
Youcanwrotewhateveryouwant.
Thesintaxis:
#[‘(whatyouwant)‘]
ClickonSAVEattop-leftofscreen
NowwecanstartourMuleserverwith
theservicecreated
RightClickonmyfirstprojectRunAs
MuleApplication
OntheConsoleviewbelowserverisgoing
tostart
Attheendyouwillseethestatus
DEPLOYED
*******************************
*******************************
*myfirstproject *default
*DEPLOYED *
*******************************
*******************************
Thismeansthatserverisupandrunning
FromWebBrowser(IE,Chrome,orwhat
youwant)let’sinvokeour service
endpoint:
http://localhost:8081/myfirstFlow
Whatwereceiveisthemessagethatwe
definedinSetPayload,inmycaseis:
MyFirstHTTPServiceworks!
Enjoy with Mule!

Mule esb first http connector