Overview
This article will teach you to make an HTTP call using SOAP in Okta Workflows.
Solution
This KB uses the Number Conversion Service, specifically the NumberToWords endpoint (operation).
The service takes a number input and returns the string representation—for example, an input of 102 returns one hundred and two.
The following flow makes an HTTP call to a SOAP.
HTTP call to a SOAP service.
Flow steps
The flow has the following steps.
Flow input
The Helper Flow card sets up Input Number field as flow input.
Create XML body
The Compose card creates the XML service body.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/">
<ubiNum>Flow_input</ubiNum>
</NumberToWords>
</soap:Body>
</soap:Envelope>
Create HTTP header
The Object – Construct card creates the Content-Type HTTP header set to text/xml.
Make HTTP call
The API Connector – Raw Request card calls the SOAP service.
- The URL is set to https://www.dataaccess.com/webservicesserver/NumberConversion.wso
- The card receives data for the Headers and Body fields from previous cards.
Service’s response for input number 102:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <m:NumberToWordsResponse xmlns:m="http://www.dataaccess.com/webservicesserver/"> <m:NumberToWordsResult>one hundred and two </m:NumberToWordsResult> </m:NumberToWordsResponse> </soap:Body> </soap:Envelope>
Parse the XML response into JSON object
The XML response from the Raw Request card is parsed into a JSON object using the XML – Parse card. The JSON object looks like this:
{
"$": {
"xmlns:soap": "http://schemas.xmlsoap.org/soap/envelope/"
},
"soap:Body": [
{
"m:NumberToWordsResponse": [
{
"$": {
"xmlns:m": "http://www.dataaccess.com/webservicesserver/"
},
"m:NumberToWordsResult": [
"one hundred and two "
]
}
]
}
]
}
Get the result
In the last step, the Object – Get card gets the result using the soap:Body.0.m:NumberToWordsResponse.0.m:NumberToWordsResult.0 key.
Running the flow.
The Get card shows the service’s output: one hundred and two.
Related References
- Four Ways to Call an API in Okta Workflows.
- How To Get Multiple Values From an API Call JSON Response in Workflows.
- How to Call an API When It’s Not Available From an Existing Card (Connection).
- Understanding Okta Workflows Connectors.
