SOAP package guide
Send SOAP requests and read complete or selected XML responses.
Version 2.16.2. Installed versions can differ. Examples are illustrative and not tested.
Prerequisites
Install the package on the Run Device with a compatible Mercury; no desktop application is needed. Get the address, SOAP version, operation, namespace, action and parameter names from the service contract. WSDL only finds the address; it builds no client and reads no operations or parameters. Nested or custom data needs a raw envelope.
Prepare Dictionary variables of Strings for Operation parameters, Custom headers and Substitutions; JSON text in a String is not a Dictionary.
Only HTTP and HTTPS work. Local and private addresses are blocked: for your own network, turn on allowInternalNetwork. Redirects are refused, also for WSDL. Basic sign-in goes only with the SOAP request, never the WSDL. Use HTTPS; the HTTP exception is under allowInsecureConnection.
Relative paths start in the Run working folder; the account needs access to the WSDL, certificate and output files. WSDL files over 64 MB are refused, and WSDL or selected response XML over 16,777,216 characters fails. A DTD in parsed WSDL or a selected response fails; external XML is not loaded. The whole response comes back as text and is not checked as XML. Save as XML writes the whole body, also for an HTTP fault, and replaces an existing file: use a test file for the example.
Two settings use the same two choices with different meanings:
| Setting | completeResponse | selectedResponse |
|---|---|---|
| Parameter details | Build the request from Operation and Operation parameters. | Send your own XML envelope. |
| Response scope | Return the whole reply. | Return what the XPath expression selects. |
All fields stay visible in both modes. Clear the fields of the mode you do not use.
Actions
SOAP Web Service (soapCommand)
Send a known SOAP operation and return the whole reply or a selected part.
Inputs
Only Operation is required in the editor.
Where to send
| Input | Editor field | Type; default | Use |
|---|---|---|---|
wsdl | Connect to WSDL by | Wsdldefault uri | uri: WSDL URI and the uri address; file: WSDL file and the uri address. The WSDL is read only when that address is blank. |
wsdl | WSDL URI | Stringdefault "" | WSDL URL, such as https://, in uri mode without Address location. |
uri | Address location | Stringdefault "" | SOAP address in uri mode; if set, the WSDL is not read. |
wsdl | WSDL file | Stringdefault "" | Local WSDL in file mode without uri, such as samples/. |
uri | Address location | Stringdefault "" | SOAP address in file mode; if set, the WSDL file is not read. |
service | Service | Stringdefault "" | Exact WSDL service name, such as Calculator; blank looks in all services. |
port | Port | Stringdefault "" | Exact WSDL port name, such as Calculator (a name, not a network port number); blank uses the first usable address. Fails if the port has no usable address. |
allow | Allow loopback, link-local, and private network destinations | Booleandefault false | False blocks request and WSDL addresses that are loopback, link-local or private; true allows them. Redirects stay refused. |
Request
| Input | Editor field | Type; default | Use |
|---|---|---|---|
soap | SOAP version | Soapdefault Soap11 | Soap11: SOAP 1.1 with the SOAPAction header. Soap12: SOAP 1.2 with the action in the content type, if set. |
operation | Operation | Stringdefault "" | Built request: XML operation name, such as Add. Required in the editor; raw mode sends its envelope instead. |
radio | Parameter details | Requestdefault complete | Request mode; see Prerequisites. |
request | Operation parameters | Dictionarydefault {} | Built request: Dictionary of Strings, such as $parameters$. Keys become flat child elements; values are XML-escaped. Nested XML needs raw mode. |
parameter | Raw data parameters | Rawdefault text | Raw mode: text reads raw; credential reads the Password of raw. |
raw | Raw data parameters | Stringdefault "" | Raw text: complete SOAP Envelope and Body, sent as is, without checks. |
raw | Substitutions | Dictionarydefault {} | Raw mode: Dictionary of String replacements, such as left = 19 for {{left}}. Exact and case-sensitive, without XML escaping. |
raw | Raw data credential | Credentialdefault empty Credential | Raw credential: Password holds the complete envelope; Username is ignored. Not sign-in. |
wsdl | Namespace | Stringdefault "" | Built operation namespace URI. Not read from the WSDL. |
wsdl | Prefix | Stringdefault ns | Built request namespace prefix. Blank omits the prefix, but keeps the namespace. |
wsdl | Action | Stringdefault "" | Service action URI. SOAP 1.1 always sends the SOAPAction header, also when blank; SOAP 1.2 sends the action only when set. |
wsdl | Namespace qualify XML elements | Xmldefault Default | Built request: Default or True put parameter elements in the operation namespace; False gives them no namespace. The operation element always keeps its namespace. |
custom | Custom headers | Dictionarydefault {} | Dictionary of String headers, such as $headers$ with X-Trace = sample-42. A content header, such as Content-Type, is set on the body. Not sent when the WSDL is read. |
timeout | Wait for action to complete(in milliseconds) | Numberdefault 60000 | Milliseconds; 0 or less means no limit. Timeout fails. |
Sign-in
| Input | Editor field | Type; default | Use |
|---|---|---|---|
authentication | Authentication mode | Soapdefault No | No or Basic. Basic uses the Username of basic and the Password of basic. |
basic | Username | Credentialdefault empty Credential | Basic: Credential Username is the service username (such as sample-reader); Password is ignored. |
basic | Password | Credentialdefault empty Credential | Basic: the Credential Password holds the service password; Username is ignored. |
Response
| Input | Editor field | Type; default | Use |
|---|---|---|---|
output | Save as XML | Stringdefault "" | Optional path, such as samples/. Saves the whole body before the HTTP status is checked, so also a SOAP fault. Creates missing folders and replaces an existing file. |
scope | Response scope | Responsedefault complete | Response mode; see Prerequisites. |
xpath | XPath expression | Stringdefault "" | Selected response: XPath 1.0, such as //*[local-name()=. Only prefixes declared on the root element work; use local-name() for deeper declarations or a default namespace. |
xml | Select XML output | Xmldefault values | Selected response: values for node text, inner for child markup, outer for whole nodes. Markup always returns a List, whatever Return content as says. |
content | Return content as | Contentdefault String | Selected values: String joins the hits with the delimiter; List returns one String per hit. Ignored for the whole response and for markup. |
delimiter | Delimited values using | Stringdefault None | Selected values as String: None joins without a separator, Custom uses Custom delimiter; other text is the separator, such as , . |
custom | Custom delimiter | Stringdefault "" | For delimiter=Custom, the exact separator between selected values, such as ~ . |
Certificates
| Input | Editor field | Type; default | Use |
|---|---|---|---|
certificate | Client certificate | Stringdefault "" | Optional certificate, such as samples/, used only when Keystore file is blank. For a client private key, use a PKCS#12 keystore. |
keystore | Keystore file | Stringdefault "" | PKCS#12 file with the client private key, such as samples/; wins over Client certificate. The Run account must be able to use the key. |
keystore | Keystore password | Credentialdefault empty Credential | The Credential Password unlocks the PKCS#12 file; Username is ignored. Empty Password for a file without a password. |
allow | Allow an insecure connection | Booleandefault false | False checks server certificates; true accepts any server certificate. Basic sign-in over HTTP works only with this and Allow loopback, link-local, and private network destinations turned on, and only when every address of the host is loopback or private IPv4 (RFC 1918). IPv6 unique-local and link-local addresses do not count; public HTTP with Basic is refused. |
Outputs
| Output | Type | Meaning |
|---|---|---|
response | Any | A String for the whole response or joined selected values, or a List of Strings for a list or markup selection. Bind to a matching variable or Any. |
status | Number | HTTP status of a successful response, for example 200. A status that is not 2xx fails the step; you cannot catch it as an output. |
Example
A test calculator at https://api.example.com/calc accepts Add(a,b) and returns AddResult=42 for 19 and 23. Create Dictionary $parameters$ with String a=19, b=23. Set:
wsdlUriOption=uri,uri=https://api.example.com/calc,soapVersion=Soap11.operation=Add,radioValue=completeResponse,requestParameters=$parameters$.wsdlOperationNamespace=https://example.com/calc,wsdlOperationNamespacePrefix=ns,wsdlOperationSoapAction=https://example.com/calc/Add.scope=selectedResponse,xpathExpression=//*[local-name()="AddResult"],xmlOutput=values,contentReturnAs=String.
Bind response to String $answer$ and status to Number $status$.
For WSDL lookup, clear uri and set wsdlUri=https://api.example.com/calc?wsdl, serviceName=Calculator, portName=CalculatorSoap. For a file, set wsdlUriOption=file, wsdlFile=samples/calc.wsdl, and leave uriFile blank. The WSDL must contain that service and port address.
For your own XML, set radioValue=selectedResponse, parameterOption=text, and put this envelope in rawData. Set rawParametersWithCV=$subs$, a Dictionary with String left=19. The replacement must already be safe XML.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns:Add xmlns:ns="https://example.com/calc">
<ns:a>{{left}}</ns:a><ns:b>23</ns:b>
</ns:Add>
</soap:Body>
</soap:Envelope>Expected result
$status$ is 200 and $answer$ is 42. With Response scope=completeResponse, response is the whole XML as a String. With selected values and Return content as=List, it is a List of Strings. No XPath hits gives an empty List or an empty String, in the same shape.
The step fails, with no outputs, on an HTTP fault (500 too; Save as XML still keeps the fault body), a WSDL without the address, a DTD in parsed XML, an invalid XPath, a blocked address, a redirect or a network error.