XML and SOAP support
Most third party integrations use REST http requests to send and receive data. Some software endpoints however, use XML or SOAP protocols. The Dev Platform also supports these formats.
This documentation will explain:
- XML requests
- SOAP request
- Use xPath to define output variables
- xPath for an XML Request
- xPath for a SOAP request
XML Requests
To create an XML request, the user will need to…
- Set the API method and URL
- Set this header - Content-Type: application/xml
- Select the “XML” radio option to validate the body as XML
For the output, the user should select the “XML” radio option to see a friendly formatted response.
XML header
XML radio option
SOAP Requests
SOAP requests also use XML for their request body and response. To create a SOAP request, the user will need to…
- Set the API method and URL
- Set this header - Content-Type: text/xml; charset=utf-8
- Select the “XML” radio option to validate the body as XML
For the output, the user should select the “XML” radio option to see a friendly formatted response.
Use xPath to traverse XML and define output variables
If you’re familiar with using dot notation to “traverse” JSON, xPath is the same concept, but with a different syntax for XML.
xPath for an XML Request
If you have an output like…
<Root>
<Address>
<State>California</State>
</Address>
</Root>
Then the xPath syntax for getting the “State” value would be…
/Root/Address/State
Which will output...
<State>California</State>
To get rid of the XML tags surrounding the data, use the “text()” function at the end, i.e.
/Root/Address/State/text()
xPath for a SOAP request
If you have an output like…
<soap:Root>
<soap:Address>
<soap:State>California</soap:State>
</soap:Address>
</soap:Root>
Then the xPath syntax for getting the “State” value would be…
/*[local-name()=‘Root]/*[local-name()=‘Address]/*[local-name()=‘State]
Which will output...
<State>California</State>
To get rid of the XML tags surrounding the data, use the “text()” function at the end, i.e.
/*[local-name()=‘Root]/*[local-name()=‘Address]/*[local-name()=‘State]/text()