Temp Conversion SOAP API
This tutorial shows how to configure a SOAP service with an example of a public temperature conversion WSDL. This example shows how to connect to a SOAP Service and demonstrates how DreamFactory can automatically wrap any SOAP WSDL with REST.
Create the SOAP Service
- In the admin console, go to the Services tab and click Create.
- Set the Service Type to 'SOAP Service'.
- Set the service name to 'temp'. This will be part of the URL when you call the service.
- Set the label to ‘Temperature’.
- Click the Config tab and enter the WSDL URI for the SOAP service. Set it to 'http://www.w3schools.com/xml/tempconvert.asmx?WSDL'.
- Click Create Service to save your new service.
Call the SOAP Service via REST
Click on the API Docs tab in the admin console, and select the 'temp' service from the list. It'll expand to show the available operations.
This UI was auto-generated based on the information obtained from the WSDL you specified when creating the service.
Click the blue GET button next to /temp then scroll down and click the Try it out! button. You'll see the request URL and response.
GET http://localhost:8888/api/v2/temp
{ "resource": [ { "name": "CelsiusToFahrenheit" }, { "name": "FahrenheitToCelsius" } ] }
It also shows the cURL command for the request. The URL ends with 'temp' which is the service name. Since we did a GET on the service name, the response indicates the available operations for the service, CelsiusToFahrenheit and FahrenheitToCelsius. Again, all of this information was discovered from the WSDL when the service was created.
To call one of these functions, click the green POST button next to /temp/CelsiusToFahrenheit.
Click Model Schema in the lower right, then click in the yellow text area to auto-populate the body text area. Change the value in the request body from "string" to a celsius temperature to convert. This is the JSON payload for your request. Click Try it out! and you'll see the request URL, this time with the operation name CelsiusToFahrenheit appended to the service name.
POST http://localhost:8888/api/v2/temp/CelsiusToFahrenheit { "Celsius": "100" }
The response contains the converted temperature. It's a single value in this case, but of course the JSON can be more complex depending on your SOAP service.
{ "CelsiusToFahrenheitResult": "212" }