10
How To Consume SOAP Based Web Service With MuleSoft Anypoint Studio

How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Embed Size (px)

Citation preview

Page 1: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

How To Consume SOAP Based Web

Service With MuleSoft Anypoint Studio

Page 2: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Consume SOAP Web Service

CXF is a Java web services framework used for SOAP (Simple Object Access Protocol)

messaging. It handles all serialization and deserialization as well as SOAP envelope and

namespace processing.

Page 3: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Consume SOAP Web Service

Place a HTTP listener to the source section of the flow and configure it as shown below in

snapshot.

Page 4: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Consume SOAP Web Service

Now place the Web Service Consumer components to the message processor in flow and

configure the components. Click on the Add Connector Configuration and it will open another

window. You can provide your WSDL Location (it can web service url or any physical WSDL

location) and click on Reload WSDL. So it will automatically fill the Service, Port and Address for

you. Press OK.

Page 5: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Consume SOAP Web Service

Now, you need to select one Operation that you need to perform on Web Service. In my case I

will use findFlights. This operation is expecting one argument that is destination.

Page 6: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Consume SOAP Web Service

We are expecting the destination as a query parameter in input request via HTTP listener and will

store query parameter in flow variable.

Page 7: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Consume SOAP Web Service

Place TransformMessage between FlowVariable and Web Service Consumer and you can see

that output metadata in DataWeave generated automatically and input data with flow variable

we have defined in previous steps. So we will map destination from FlowVariable to destination

argument required by Web Service.

Page 8: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Consume SOAP Web Service

Now we will place the one more TransformMessage after Web Service Consumer to map XML

result from Web Service to Json format. So you can see input metadata in DataWeave is

generated automatically and you can define output metadata as per your requirements and

perform mapping.

Page 9: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Testing The Application

You can use Postman to test the application. First deploy the application with Anypoint Studio.

Now we will use http GET method in Postman to send request to HTTP listening on url

http://localhost:8081/soap?destination=CLE.

Page 10: How To Consume SOAP Based Web Service With Mulesoft Anypoint Studio

Thank You