This tutorial shows how to consume jax-ws webservice in Mule ESB step by step. You need to have some idea on SOAP based webservices otherwise it will be a bit difficult to understand. From jdk 6 onwards we don’t need to put any extra jar for jax-ws based webservices as it comes out of the box. You can also implement jax-ws service using Metro, Axis2, CXF framework but Metro implementation has the best support for jax-ws service.
Before you proceed you must go through creating jax-ws webservice in Mule Project.
Mule Studio 3.5.0
Step 1. Create new Mule flow under jax-ws-cxf project. Do right-click on the project and do like below screen-shot.
Step 2. In the popup window input name as jax-ws-consumer. The flow name will automatically be created. Click Finish.
Step 4. Do double-click jax-ws-consumerFlow1 and rename jax-ws-consumerFlow1 to jax-ws-consumer
Step 6. Do double-click on SOAP component and change the below properties.
Step 7. Do double-click on outbound HTTP endpoint and change the below properties.
Step 8. Object to String transformer is used to render the correct format data. HTTP outbound endpoint sends payload in XML format and expects to receive response in XML as well. However, SOAP client unmarshals XML content and sends plain String (returned from sayHello method). So, let’s turn the content-type into text/plain in order to avoid browser rendering issues.
Step 9. Save all and run the project as Mule Application.
Step 10. Now once the application successfully runs hit the URL http://localhost:8084/jax-ws-consumer/Soumitra. You will get below output in the browser.