SlideShare a Scribd company logo
Implementing RESTful WebService
An ESB is expected to function as a service provider as well as
a consumer. This tutorial will explain how Mule ESB can be
configured to function as a RESTful WebService endpoint. Mule
ESB provides a built-in REST component based
on Jersey project.
In the first example, we will explore the possibility of creating
RESTful web services without using the built-in component;
The HTTP endpoint of the flow is configured as below. The
examples of the earlier post covered one way HTTP end point,
this one covers two way or request-response paradigm.
The following configuration settings are done in the ‘General’
tab of the HTTP component.
Exchange-patterns: request-response
Host: localhost
Port: 8081
Path: rest
The next component in the flow is Body to Parameter Body.
Retain the default values. The final component in the flow
is Maps to XML component. Retain the default values for this
component as well.
To invoke the application, open any browser window and
type the following:
http://localhost:8081/rest?name=Rori&age=33
The output generated in the browser window is shown
below:
<?xml version="1.0" encoding="UTF-8"?>
<table>
<record>
<field name="age"
type="java.lang.String">40</field>
<field name="name"
type="java.lang.String">Rori</field>
</record>
</table>
The source code of the mule flow is shown below:
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns:tracking=http://www.mulesoft.org/schema/mule/ee
/tracking xmlns:jdbc-
ee=http://www.mulesoft.org/schema/mule/ee/jdbc
xmlns:http="http://www.mulesoft.org/schema/mule/http"
<flow name="http_restfulwsFlow" >
<http:inbound-endpoint exchange-pattern="request-
response"
host="localhost" port="8081" path="rest“
mimeType="text/plain" contentType="text/plain«
doc:name="HTTP"/>
<response>
<jdbc-ee:maps-to-xml-transformer doc:name="Maps to
XML"/>
</response>
<http:body-to-parameter-map-transformer doc:name="Body
to Parameter Map"/>
</flow>
</mule>
For all practical purposes, the developer would like to have
the ability to customize the output XML into a more sensible
format aligned to business domain. To achieve the same a new
Mule flow is created.
The grapfhic flow is:
Rest fullservices

More Related Content

PPTX
Bindings of components in mule
PPTX
Simple service rest
PPT
Data weave reference documentation
PPTX
Creating restful api using mule esb
PPTX
Component bindings in mule
PPTX
Data weave in mule
PPTX
For each component in mule
PPTX
Routing in mule
Bindings of components in mule
Simple service rest
Data weave reference documentation
Creating restful api using mule esb
Component bindings in mule
Data weave in mule
For each component in mule
Routing in mule

What's hot (17)

PPTX
Mule agent notifications
PPTX
Using mule with web services
PPTX
Dynamic file attribute
PPTX
Automatic documentation with mule
 
PPTX
Mule ESB - Mock Salesforce Interface
PPTX
Quartz connector mule
PPTX
Mule MongoDB connector
PPTX
Mule batch job
PPTX
Mule esb :Data Weave
PPTX
Filter expression in mule
PPTX
Send email attachment using smtp in mule esb
PPTX
Http mule
PPTX
SOAP To REST API Proxy
PPTX
Junit in mule demo
PPTX
xslt in mule
PPTX
Stored procedure in Mule
PPTX
Using message enricher
Mule agent notifications
Using mule with web services
Dynamic file attribute
Automatic documentation with mule
 
Mule ESB - Mock Salesforce Interface
Quartz connector mule
Mule MongoDB connector
Mule batch job
Mule esb :Data Weave
Filter expression in mule
Send email attachment using smtp in mule esb
Http mule
SOAP To REST API Proxy
Junit in mule demo
xslt in mule
Stored procedure in Mule
Using message enricher
Ad

Similar to Rest fullservices (20)

PPTX
Mule ESB Components
PDF
Top 50 MuleSoft interview questions
PPTX
Mule connectors-part 1
PPTX
Asp.net web api
PPTX
Mule connectors-session1
PPTX
How to – wrap soap web service around a database
PDF
Ibm tivoli access manager for e business tracing http connections redp4622
PDF
Pinterest like site using REST and Bottle
PDF
Mule ESB Interview or Certification questions
PDF
JavaEE6 my way
DOCX
Sending mail,web services
PDF
ASP.NET Web API Interview Questions By Scholarhat
PPTX
Rest Component
PPT
Rest Service In Mule
PPTX
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
PPT
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
DOCX
Bt0083, server side programming theory
PPT
Rest service in mule
PPTX
Http component
Mule ESB Components
Top 50 MuleSoft interview questions
Mule connectors-part 1
Asp.net web api
Mule connectors-session1
How to – wrap soap web service around a database
Ibm tivoli access manager for e business tracing http connections redp4622
Pinterest like site using REST and Bottle
Mule ESB Interview or Certification questions
JavaEE6 my way
Sending mail,web services
ASP.NET Web API Interview Questions By Scholarhat
Rest Component
Rest Service In Mule
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Bt0083, server side programming theory
Rest service in mule
Http component
Ad

More from Davide Rapacciuolo (20)

PPTX
Muleesbobjecttojson
PPTX
Mule esb db_2
PPTX
Mule esb db_1
PPTX
Consuming raml
PPTX
Transf from csv to xml
PPTX
Esb choice flow
PPTX
Xml to xml transformation in mule
PPTX
Transformation xmltoobjectesb
PPTX
Transformation jsontoxmlesb
PPTX
Transformation jsontojsonesb
PPTX
Transformation csvtoxml
PPTX
Xml to xml transformation in mule
PPTX
Mule esb object_to_json
PPTX
Mule esb object_to_jackson_json
PPTX
Mule esb expression_filter
PPTX
Mule esb collection_splitter
PPTX
Mule esb soap_service
PPTX
Transformation xmltoobjectesb
PPTX
Transformation jsontoxmlesb
PPTX
Mule esb csv_to_json
Muleesbobjecttojson
Mule esb db_2
Mule esb db_1
Consuming raml
Transf from csv to xml
Esb choice flow
Xml to xml transformation in mule
Transformation xmltoobjectesb
Transformation jsontoxmlesb
Transformation jsontojsonesb
Transformation csvtoxml
Xml to xml transformation in mule
Mule esb object_to_json
Mule esb object_to_jackson_json
Mule esb expression_filter
Mule esb collection_splitter
Mule esb soap_service
Transformation xmltoobjectesb
Transformation jsontoxmlesb
Mule esb csv_to_json

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Encapsulation theory and applications.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Electronic commerce courselecture one. Pdf
PPTX
Cloud computing and distributed systems.
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Big Data Technologies - Introduction.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Digital-Transformation-Roadmap-for-Companies.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
NewMind AI Monthly Chronicles - July 2025
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Encapsulation_ Review paper, used for researhc scholars
The AUB Centre for AI in Media Proposal.docx
NewMind AI Weekly Chronicles - August'25 Week I
Encapsulation theory and applications.pdf
A Presentation on Artificial Intelligence
Electronic commerce courselecture one. Pdf
Cloud computing and distributed systems.
Spectral efficient network and resource selection model in 5G networks
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Advanced methodologies resolving dimensionality complications for autism neur...
Big Data Technologies - Introduction.pptx

Rest fullservices

  • 2. An ESB is expected to function as a service provider as well as a consumer. This tutorial will explain how Mule ESB can be configured to function as a RESTful WebService endpoint. Mule ESB provides a built-in REST component based on Jersey project. In the first example, we will explore the possibility of creating RESTful web services without using the built-in component;
  • 3. The HTTP endpoint of the flow is configured as below. The examples of the earlier post covered one way HTTP end point, this one covers two way or request-response paradigm. The following configuration settings are done in the ‘General’ tab of the HTTP component. Exchange-patterns: request-response Host: localhost Port: 8081 Path: rest
  • 4. The next component in the flow is Body to Parameter Body. Retain the default values. The final component in the flow is Maps to XML component. Retain the default values for this component as well. To invoke the application, open any browser window and type the following: http://localhost:8081/rest?name=Rori&age=33 The output generated in the browser window is shown below:
  • 5. <?xml version="1.0" encoding="UTF-8"?> <table> <record> <field name="age" type="java.lang.String">40</field> <field name="name" type="java.lang.String">Rori</field> </record> </table>
  • 6. The source code of the mule flow is shown below: <?xml version="1.0" encoding="UTF-8"?> <mule xmlns:tracking=http://www.mulesoft.org/schema/mule/ee /tracking xmlns:jdbc- ee=http://www.mulesoft.org/schema/mule/ee/jdbc xmlns:http="http://www.mulesoft.org/schema/mule/http"
  • 7. <flow name="http_restfulwsFlow" > <http:inbound-endpoint exchange-pattern="request- response" host="localhost" port="8081" path="rest“ mimeType="text/plain" contentType="text/plain« doc:name="HTTP"/> <response> <jdbc-ee:maps-to-xml-transformer doc:name="Maps to XML"/>
  • 9. For all practical purposes, the developer would like to have the ability to customize the output XML into a more sensible format aligned to business domain. To achieve the same a new Mule flow is created. The grapfhic flow is: