SlideShare a Scribd company logo
1 of 11
Rest Component
REST stands for REpresentational State Transfer. It relies on HTTP for
transport and uses HTTP methods to perform operations on remote
Services. HTTP’s GET method would be for Read, POST for Create,
PUT for Update
REST has many advantages and many companies are adapting it
as Integration standard. However, one area it still needs
improvement is Security. Traditionally REST services can use
standard HTTP/S security (SSL/Mutual Authentication etc.,).
Mule ESB supports REST through Jersey (JAX-RS) implementation.
Lets build a example that demonstrates the use of REST component
in Mule Studio. Open “Mule Training” project and create a Mule
flow named “restexample”. Drag and drop a HTTP endpoint and specify
“localhost”, “8081” and “rest” as Host, Port and Path parameters as shown
below.
Where HTTP Listner Configuration is:
Create a simple Java class called “HelloRESTService” with a method
“sayHelloWithUri” as follows.
package restexample;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@Path(value = "/rest")
public class HelloRestService {
@POST
@Produces("text/plain")
@Path("/{name}")
public String sayHelloWithUri(@PathParam("name") String name) {
return "Hello " + name;
}
}
The bulk of work in REST is component creation. Mule flow will only have
a HTTP endpoint followed by REST component. Remaining hardwork is
done by JAX-RS.
Drag and drop and REST component next to HTTP endpoint.
Specify
“training.rest.HelloRESTService” for Class attributed of REST
component as shown below.
Save and run the project.
Access http://localhost:8081/rest/Antonio. Output,
which is nothing but return value from “sayHello”
method will be displayed.
Http component

More Related Content

What's hot

What's hot (20)

Weblogic 101 for dba
Weblogic  101 for dbaWeblogic  101 for dba
Weblogic 101 for dba
 
For each component in mule
For each component in muleFor each component in mule
For each component in mule
 
Filter expression in mule demo
Filter expression in mule demoFilter expression in mule demo
Filter expression in mule demo
 
How to connect redis and mule esb using spring data redis module
How to connect redis and mule esb using spring data redis moduleHow to connect redis and mule esb using spring data redis module
How to connect redis and mule esb using spring data redis module
 
Mule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce InterfaceMule ESB - Mock Salesforce Interface
Mule ESB - Mock Salesforce Interface
 
Mule security - saml
Mule  security - samlMule  security - saml
Mule security - saml
 
Oracle Enterprise manager 13c Installation
Oracle Enterprise manager 13c InstallationOracle Enterprise manager 13c Installation
Oracle Enterprise manager 13c Installation
 
Refresh development from productions
Refresh development from productionsRefresh development from productions
Refresh development from productions
 
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
 
Routing in mule
Routing in muleRouting in mule
Routing in mule
 
Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in mule
 
Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentation
 
Ebs clone r12.2.4
Ebs clone r12.2.4Ebs clone r12.2.4
Ebs clone r12.2.4
 
How to add storage to esxi 5.5
How to add storage to esxi 5.5How to add storage to esxi 5.5
How to add storage to esxi 5.5
 
Mule agent notifications
Mule agent notificationsMule agent notifications
Mule agent notifications
 
Upgrade OBIEE to 11.1.1.7.1
Upgrade OBIEE to 11.1.1.7.1Upgrade OBIEE to 11.1.1.7.1
Upgrade OBIEE to 11.1.1.7.1
 
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
 
Choice component in mule
Choice component in mule Choice component in mule
Choice component in mule
 
Mule flow complete
Mule flow completeMule flow complete
Mule flow complete
 
Mule esb
Mule esbMule esb
Mule esb
 

Viewers also liked

Plunge for Hunger article
Plunge for Hunger articlePlunge for Hunger article
Plunge for Hunger article
Zachary Burnett
 

Viewers also liked (16)

Example esb file-to-string flow
Example esb file-to-string flowExample esb file-to-string flow
Example esb file-to-string flow
 
Зустріч 2016 "На крилах спогадів"
Зустріч 2016 "На крилах спогадів"Зустріч 2016 "На крилах спогадів"
Зустріч 2016 "На крилах спогадів"
 
Esb first http flow
Esb first http flowEsb first http flow
Esb first http flow
 
Example esb flow
Example esb flowExample esb flow
Example esb flow
 
Transformation jsontoxmlesb
Transformation jsontoxmlesbTransformation jsontoxmlesb
Transformation jsontoxmlesb
 
Create web services jax - ws3
Create web services jax - ws3Create web services jax - ws3
Create web services jax - ws3
 
Transformation jsontojsonesb
Transformation jsontojsonesbTransformation jsontojsonesb
Transformation jsontojsonesb
 
Rest fullservices
Rest fullservicesRest fullservices
Rest fullservices
 
Example esb flow
Example esb flowExample esb flow
Example esb flow
 
Transformation xmltoobjectesb
Transformation xmltoobjectesbTransformation xmltoobjectesb
Transformation xmltoobjectesb
 
Plunge for Hunger article
Plunge for Hunger articlePlunge for Hunger article
Plunge for Hunger article
 
Transformation csvtoxml
Transformation csvtoxmlTransformation csvtoxml
Transformation csvtoxml
 
Create web services jax - ws2
Create web services jax - ws2Create web services jax - ws2
Create web services jax - ws2
 
Create web services jax - ws1
Create web services jax - ws1Create web services jax - ws1
Create web services jax - ws1
 
Json to json transformation in mule
Json to json transformation in muleJson to json transformation in mule
Json to json transformation in mule
 
Configurare http mule
Configurare http muleConfigurare http mule
Configurare http mule
 

Similar to Http component

Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSScalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JS
Cosmin Mereuta
 
Building+restful+webservice
Building+restful+webserviceBuilding+restful+webservice
Building+restful+webservice
lonegunman
 
Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet example
rvpprash
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
b_kathir
 

Similar to Http component (20)

Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
Scalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JSScalable network applications, event-driven - Node JS
Scalable network applications, event-driven - Node JS
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
 
RESTful SCA with Apache Tuscany
RESTful SCA with Apache TuscanyRESTful SCA with Apache Tuscany
RESTful SCA with Apache Tuscany
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0
 
Building+restful+webservice
Building+restful+webserviceBuilding+restful+webservice
Building+restful+webservice
 
Felix HTTP - Paving the road to the future
Felix HTTP - Paving the road to the futureFelix HTTP - Paving the road to the future
Felix HTTP - Paving the road to the future
 
REST library.pptx
REST library.pptxREST library.pptx
REST library.pptx
 
Rest web services
Rest web servicesRest web services
Rest web services
 
Oredev 2009 JAX-RS
Oredev 2009 JAX-RSOredev 2009 JAX-RS
Oredev 2009 JAX-RS
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Java EE7
Java EE7Java EE7
Java EE7
 
Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet example
 
Salesforce Integration using REST SOAP and HTTP callouts
Salesforce Integration using REST SOAP and HTTP calloutsSalesforce Integration using REST SOAP and HTTP callouts
Salesforce Integration using REST SOAP and HTTP callouts
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Rest fullservices
Rest fullservicesRest fullservices
Rest fullservices
 
Rest fullservices
Rest fullservicesRest fullservices
Rest fullservices
 
112815 java ee8_davidd
112815 java ee8_davidd112815 java ee8_davidd
112815 java ee8_davidd
 
Frequently asked MuleSoft Interview Questions and Answers from Techlightning
Frequently asked MuleSoft Interview Questions and Answers from TechlightningFrequently asked MuleSoft Interview Questions and Answers from Techlightning
Frequently asked MuleSoft Interview Questions and Answers from Techlightning
 

Recently uploaded

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
dannyijwest
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Recently uploaded (20)

Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Danikor Product Catalog- Screw Feeder.pdf
Danikor Product Catalog- Screw Feeder.pdfDanikor Product Catalog- Screw Feeder.pdf
Danikor Product Catalog- Screw Feeder.pdf
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
Passive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptPassive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.ppt
 
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
Unsatisfied Bhabhi ℂall Girls Ahmedabad Book Esha 6378878445 Top Class ℂall G...
 
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
Cybercrimes in the Darknet and Their Detections: A Comprehensive Analysis and...
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata Model
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Electromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptxElectromagnetic relays used for power system .pptx
Electromagnetic relays used for power system .pptx
 
Compressing and Sparsifying LLM in GenAI Applications
Compressing and Sparsifying LLM in GenAI ApplicationsCompressing and Sparsifying LLM in GenAI Applications
Compressing and Sparsifying LLM in GenAI Applications
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 

Http component

  • 2. REST stands for REpresentational State Transfer. It relies on HTTP for transport and uses HTTP methods to perform operations on remote Services. HTTP’s GET method would be for Read, POST for Create, PUT for Update REST has many advantages and many companies are adapting it as Integration standard. However, one area it still needs improvement is Security. Traditionally REST services can use standard HTTP/S security (SSL/Mutual Authentication etc.,).
  • 3. Mule ESB supports REST through Jersey (JAX-RS) implementation. Lets build a example that demonstrates the use of REST component in Mule Studio. Open “Mule Training” project and create a Mule flow named “restexample”. Drag and drop a HTTP endpoint and specify “localhost”, “8081” and “rest” as Host, Port and Path parameters as shown below.
  • 4.
  • 5. Where HTTP Listner Configuration is:
  • 6. Create a simple Java class called “HelloRESTService” with a method “sayHelloWithUri” as follows. package restexample; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces;
  • 7. @Path(value = "/rest") public class HelloRestService { @POST @Produces("text/plain") @Path("/{name}") public String sayHelloWithUri(@PathParam("name") String name) { return "Hello " + name; } }
  • 8. The bulk of work in REST is component creation. Mule flow will only have a HTTP endpoint followed by REST component. Remaining hardwork is done by JAX-RS. Drag and drop and REST component next to HTTP endpoint. Specify “training.rest.HelloRESTService” for Class attributed of REST component as shown below.
  • 9.
  • 10. Save and run the project. Access http://localhost:8081/rest/Antonio. Output, which is nothing but return value from “sayHello” method will be displayed.