SOAP Component
Using the SOAP component.
The SOAP component allows connecting to an existing WSDL service. This allows you to expose the service as REST API or use the component data in service flow for more advanced service logic.
SOAP Service
In the SOAP Service section you need to enter the service URL. Once you enter the URL click the Retrieve buttons. This will ask API Express to learn about the service and automatically populate the Service drop down.
Select a service from the Service list. Once a service is selected, the Port list will be populated. Select a port and then select an operation. The Operation list will also be automatically populated.
When the operation is selected the Request Body and http://www.w3schools.com/xml/tempconvert.asmx?WSDL sections will be filled the correct request body.
Quickstart
First time here? Try this quickstart tutorial.
Header Parameters
You can enter an optional header parameter and map it to any Components Data variables.
Request Body
This section will be automatically filled when you select an operation. Some services will expect a parameter inside the request body. You can insert any Components Data variables into the request body. Here is an example how to do that. Note that it has to be inserted as a JavaScript string.
result =
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">' +
'<soapenv:Header/>' +
'<soapenv:Body>' +
'<ns:FahrenheitToCelsius xmlns:ns="http://www.w3schools.com/xml/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' +
'<ns:Fahrenheit>' + PARAMS.QUERY.temperature + '</ns:Fahrenheit>' +
'</ns:FahrenheitToCelsius>' +
'</soapenv:Body>' +
'</soapenv:Envelope>';
In the code example above, PARAMS.QUERY.temperature is inserted as a parameter.
Response Body
This section will be automatically filled when you select an operation.
Samples
This section has a number of samples using the SOAP component:
Basic Authentication Example
When a SOAP services is secured with Basic Authentication, here is how to use it in API Express:
- Create an administrator user in Users collection (Appery.io database).
- Upload your WSDL file into the Files collection.
- Specify that only administrator user can have access to this file (via ACL).
- Use the Master Key in WSDL URL for SOAP component. The URL will look like this: https://api.appery.io/rest/1/db/files/5617c3d1e4b01d89fb7656d9/5406f5d0......7a6bb.soap.wsdl?masterKey=<your_master_key>
- Add authentication header for SOAP request with username:password string in Base64 format.
- Header parameter name: Authorization.
- Header parameter value: Basic <base64_string>. For example user1:pass1 is dXNlcjE6cGFzczE= in Base64. You can use an online tool such as https://www.base64encode.org/ to create the string or use the browser console to invoke this JavaScript: window.btoa("user1:pass1");.
- You are now ready to test and run the service.
Video Example
This video example shows how to connect to an external SOAP service from the API Express.
Updated about 6 years ago