- MuleSoft - Discussion
- MuleSoft - Useful Resources
- MuleSoft - Quick Guide
- MuleSoft - Testing with MUnit
- MuleSoft - Mule exception Handling
- MuleSoft - Mule Error Handling
- Web Services Using Anypoint Studio
- Flow Control and Transformers
- MuleSoft - Endpoints
- Core Components & Their Configuration
- Message Processor & Script Components
- MuleSoft - DataWeave Language
- Creating First Mule Application
- MuleSoft - Discovering Anypoint Studio
- MuleSoft - Anypoint Studio
- MuleSoft - Mule in Our Machine
- MuleSoft - The Mule Project
- MuleSoft - Introduction to Mule ESB
- MuleSoft - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
MuleSoft - Web Services Using Anypoint Studio
REST Web Service
The full form of REST is Representational State Transfer which is bound with HTTP. Hence, if you want to design an apppcation to be used exclusively on the web, REST is the best option.
Consuming RESTful Web Services
In the following example, we will be using REST component and one pubpc RESTful service provided by Mule Soft called American Fpghts details. It has various details but we are going to use GET:
that will return all fpght details. As discussed earper, REST is bound with HTTP, hence we need two HTTP components ― one is Listener and other is Request, for this apppcation too. Below screenshot shows the configuration for HTTP pstener −Configuring and passing arguments
The configuration for HTTP request is given below −
Now, as per our workspace flow, we have taken logger so it can be configured as below −
In the message tab, we write code to convert the payload into strings.
Testing the Apppcation
Now, save and run the apppcation and go to POSTMAN to check the final output as shown below −
You can see it gives the fpght details by using REST component.
SOAP Component
The full form of SOAP is Simple Object Access Protocol. It is basically a messaging protocol specification for exchanging information in the implementation of web services. Next, we are going to use SOAP API in Anypoint Studio to access the information using web services.
Consuming SOAP-based Web Services
For this example, we are going to use pubpc SOAP service whose name is Country Info Service which retains the services related to country information. Its WSDL address is:
First, we need to drag SOAP consume in our canvas from Mule Palette as shown below −
Configuring and Passing Arguments
Next, we need to configure HTTP request as done in above example as given below −
Now, we also need to configure the Web Service Consumer as shown below −
At the place of WSDL Location, we need to provide the web address of WSDL, which is provided above (for this example). Once you give the web address, Studio will search for service, Port and Address by itself. You need not provide it manually.
Transfer Response from Web Service
For this, we need to add a logger in the Mule flow and configure it for giving the payload as shown below −
Testing the Apppcation
Save and run the apppcation and go to Google Chrome for checking the final output. Type http://localhist:8081/helloSOAP (for this example) and it will show the country name by code as shown in the screenshot below −
Advertisements