SlideShare a Scribd company logo
1 of 10
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/tra
cking 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

What's hot

What's hot (17)

Mule agent notifications
Mule agent notificationsMule agent notifications
Mule agent notifications
 
Using mule with web services
Using mule with web servicesUsing mule with web services
Using mule with web services
 
Dynamic file attribute
Dynamic file attributeDynamic file attribute
Dynamic file attribute
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with mule
 
Mule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce InterfaceMule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce Interface
 
Quartz connector mule
Quartz connector   muleQuartz connector   mule
Quartz connector mule
 
Mule MongoDB connector
Mule MongoDB connectorMule MongoDB connector
Mule MongoDB connector
 
Mule batch job
Mule batch jobMule batch job
Mule batch job
 
Mule esb :Data Weave
Mule esb :Data WeaveMule esb :Data Weave
Mule esb :Data Weave
 
Filter expression in mule
Filter expression in muleFilter expression in mule
Filter expression in mule
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
 
Http mule
Http muleHttp mule
Http mule
 
SOAP To REST API Proxy
SOAP To REST API ProxySOAP To REST API Proxy
SOAP To REST API Proxy
 
Junit in mule demo
Junit in mule demoJunit in mule demo
Junit in mule demo
 
xslt in mule
xslt in mulexslt in mule
xslt in mule
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure in Mule
 
Using message enricher
Using message enricherUsing message enricher
Using message enricher
 

Viewers also liked

Viewers also liked (13)

Brayan
BrayanBrayan
Brayan
 
DFSO TERCER PARCIAL 3D
DFSO TERCER PARCIAL 3DDFSO TERCER PARCIAL 3D
DFSO TERCER PARCIAL 3D
 
Groovy example in mule
Groovy example in muleGroovy example in mule
Groovy example in mule
 
Informe Clima de Negocios LATAM 2015
Informe Clima de Negocios LATAM 2015Informe Clima de Negocios LATAM 2015
Informe Clima de Negocios LATAM 2015
 
Wood_Design_Details (1)
Wood_Design_Details (1)Wood_Design_Details (1)
Wood_Design_Details (1)
 
Senior Project
Senior ProjectSenior Project
Senior Project
 
Boletín de novidades. Sección adultos. Novembro-decembro 2016
Boletín de novidades. Sección adultos. Novembro-decembro 2016Boletín de novidades. Sección adultos. Novembro-decembro 2016
Boletín de novidades. Sección adultos. Novembro-decembro 2016
 
Taller Comparativo y Diseño de una Política de Seguridad de la Información
Taller Comparativo y Diseño de una Política de Seguridad de la InformaciónTaller Comparativo y Diseño de una Política de Seguridad de la Información
Taller Comparativo y Diseño de una Política de Seguridad de la Información
 
Maven tools & archetypes
Maven tools & archetypesMaven tools & archetypes
Maven tools & archetypes
 
Une Spain Latam les desea Felices Fiestas
Une Spain Latam les desea Felices FiestasUne Spain Latam les desea Felices Fiestas
Une Spain Latam les desea Felices Fiestas
 
Natural Language Processing: L02 words
Natural Language Processing: L02 wordsNatural Language Processing: L02 words
Natural Language Processing: L02 words
 
Funções do 1º e 2º grau
Funções do 1º e 2º grauFunções do 1º e 2º grau
Funções do 1º e 2º grau
 
今からでも大丈夫!Firebase入門
今からでも大丈夫!Firebase入門今からでも大丈夫!Firebase入門
今からでも大丈夫!Firebase入門
 

Similar to Rest fullservices

Ibm tivoli access manager for e business tracing http connections redp4622
Ibm tivoli access manager for e business tracing http connections redp4622Ibm tivoli access manager for e business tracing http connections redp4622
Ibm tivoli access manager for e business tracing http connections redp4622
Banking at Ho Chi Minh city
 
Pinterest like site using REST and Bottle
Pinterest like site using REST and Bottle Pinterest like site using REST and Bottle
Pinterest like site using REST and Bottle
Gaurav Bhardwaj
 
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptxTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
kmani5
 
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).pptTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
HusseinWassof
 

Similar to Rest fullservices (20)

Mule ESB Components
Mule ESB Components Mule ESB Components
Mule ESB Components
 
Top 50 MuleSoft interview questions
Top 50 MuleSoft interview questionsTop 50 MuleSoft interview questions
Top 50 MuleSoft interview questions
 
Mule connectors-part 1
Mule connectors-part 1Mule connectors-part 1
Mule connectors-part 1
 
Asp.net web api
Asp.net web apiAsp.net web api
Asp.net web api
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
 
How to – wrap soap web service around a database
How to – wrap soap web service around a databaseHow to – wrap soap web service around a database
How to – wrap soap web service around a database
 
Ibm tivoli access manager for e business tracing http connections redp4622
Ibm tivoli access manager for e business tracing http connections redp4622Ibm tivoli access manager for e business tracing http connections redp4622
Ibm tivoli access manager for e business tracing http connections redp4622
 
Pinterest like site using REST and Bottle
Pinterest like site using REST and Bottle Pinterest like site using REST and Bottle
Pinterest like site using REST and Bottle
 
Mule ESB Interview or Certification questions
Mule ESB Interview or Certification questionsMule ESB Interview or Certification questions
Mule ESB Interview or Certification questions
 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
 
Sending mail,web services
Sending mail,web servicesSending mail,web services
Sending mail,web services
 
Mule esb
Mule esbMule esb
Mule esb
 
Rest Component
Rest ComponentRest Component
Rest Component
 
Rest Service In Mule
Rest Service In Mule Rest Service In Mule
Rest Service In Mule
 
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptxTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
 
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).pptTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
 
Bt0083, server side programming theory
Bt0083, server side programming theoryBt0083, server side programming theory
Bt0083, server side programming theory
 
Rest service in mule
Rest service in mule Rest service in mule
Rest service in mule
 
Http component
Http componentHttp component
Http component
 
Web Server and how we can design app in C#
Web Server and how we can design app  in C#Web Server and how we can design app  in C#
Web Server and how we can design app in C#
 

More from Germano Barba (15)

Mule esb lesson 3
Mule esb   lesson 3Mule esb   lesson 3
Mule esb lesson 3
 
Mule esb lesson 2
Mule esb   lesson 2Mule esb   lesson 2
Mule esb lesson 2
 
Mule esb lesson 1
Mule esb   lesson 1Mule esb   lesson 1
Mule esb lesson 1
 
Transformation csvtoxml
Transformation csvtoxmlTransformation csvtoxml
Transformation csvtoxml
 
Transformation jsontojsonesb
Transformation jsontojsonesbTransformation jsontojsonesb
Transformation jsontojsonesb
 
Transformation jsontoxmlesb
Transformation jsontoxmlesbTransformation jsontoxmlesb
Transformation jsontoxmlesb
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
Mule esb first http connector
Mule esb first http connectorMule esb first http connector
Mule esb first http connector
 
Mule esb using file to string and logger component
Mule esb using file to string and logger componentMule esb using file to string and logger component
Mule esb using file to string and logger component
 
Mule esb using file to string and logger component
Mule esb using file to string and logger componentMule esb using file to string and logger component
Mule esb using file to string and logger component
 
Mule hppt java
Mule hppt javaMule hppt java
Mule hppt java
 
Mule io flow
Mule io flowMule io flow
Mule io flow
 
Mule esb add logger to existing flow
Mule esb add logger to existing flowMule esb add logger to existing flow
Mule esb add logger to existing flow
 
Mule esb first http connector
Mule esb first http connectorMule esb first http connector
Mule esb first http connector
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

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/tra cking 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: