mulesoft consuming web service - web service consumer

Post on 16-Apr-2017

525 Views

Category:

Software

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

CONSUMING SOAP WEB SERVICE

- MULESOFT WEB SERVICE CONSUMER

Vince Jason Soliza

Mulesoft Web Service ConsumerWhen developing applications with Mule, users often need to be able to consume a SOAP Web service to acquire data from an external source. The recommended way is to use the Web Service Consumer. It’s the quickest, easiest way to consume a Web service.

Create a Simple Flow• HTTP (inbound)• Transform Message (create a request)• Web Service Consumer (consume SOAP web service)

Configure Web Service Consumer• Get the WSDL file of the SOAP Web service you intend to consume, or

identifying the URL of the WSDL.• Using a WSDL file, copy the file into the` src/main/resources` folder of

your Studio project• Define the Global Configuration of the connector: click the plus sign next

to the Global Configuration field. • In the window that opens, begin by entering a value in the WSDL Location

field. Populate this field first, with either the WSDL’s URL, or the filepath and filename of the WSDL file you copied into the src/main/resources folder of your project. Upon filling this field, you five Studio the opportunity to read the contents of the WSDL and automatically populate the remaining empty fields — Service, Port and Address — using information contained in the WSDL file. Alternatively, you can manually populate these fields with the appropriate information about the Web service.

Configure Web Service ConsumerWhen the WSDL is located in the resource file.

Configure Web Service ConsumerWhen the WSDL is located in url.

Configure Web Service Consumer• Confirm that the Enable DataSense box is checked, then click OK to save.• Adjust the Operation of the Web Service Consumer, if you wish (and if the

SOAP Web service indeed offers more than one operation), then click inside the canvas to auto-save your configuration.

Transform Message• Create a request in Transform Message that will be used as payload to

invoke the web service consumer.

Test the application• Run the application in anypoint studio.• Send request through HTTP using Postman, browser or any client you

prefer.• We can see in the screenshot below, the response of the soap web service

we consumed using web service consumer.

Summary

When sending requests to an external web service, the recommended approach is to use the Web Service Consumer because it’s faster and easier to use.

QUESTIONS?Please leave a comment

top related