This example application is complementary to How To Series. It illustrates how to use Mule to create a REST proxy to an existing SOAP based web service.
In this example, for an existing SOAP web service we are using the project from How To Series - Part 1. We then build a REST API that proxies to this SOAP service. The REST API takes loanID as the input HTTP parameter and returns the loan details in the JSON response message.
As with other examples, you can run this application straight out of the box in Anypoint Studio. You may also modify the configurations of these examples to create your own customized applications in Mule.
Follow the steps to create, then run the application.
1. In this use case we are proxying to a SOAP web service. Refer to How To - Part 1 to download and deploy the web service on CloudHub.
2. Download the project rest-proxy-howto_1.0.0 from Anypoint Exchange, export it into Anypoint Studio.
3. Open the configuration file rest-proxy-soap.xml. Configure the "SOAP Webservice" component connector configuration "Web_Service_Consumer". Enter the correct WSDL location for the SOAP based web service that we are creating proxy to. This will populate all the other fields in the "Web_Service_Consumer" resource.
4. If you have deployed the web service as instructed in step 1 then the corresponding mappings would be valid. If you are using a different web service to proxy to then change the mappings in the component "Transform to SOAP request" and "Transform from SOAP response".
5. Once the mappings are configured correctly run the project as a mule application in Anypoint Studio. Once the project is running successfully, the API console comes up which can be used to test the REST API.