Use the SOAP Web Service action to send two numbers to an online calculator web service and return their sum.
About this task
In this example, you use the SOAP Web Service action to call an online calculator web service. You send the values 10 and 20 to the Add operation and display the sum, 30.
Procedure
- In the Bot editor, find the SOAP Web Service action in the Action pane, and then double-click it or drag it into your workflow.
-
Select a connection method:
- To connect using a URI, enter the URI, for example,
http://www.dneonline.com/calculator.asmx?WSDL. - To connect using a file, select a file from the Control Room or the desktop, or insert a variable.
- To connect using a URI, enter the URI, for example,
- Optional:
In the Address location field, enter the SOAP
endpoint.
If you specify the address location, the bot uses it during execution. Otherwise, the bot uses the address location from the WSDL file.Note: If you are creating the SOAP URI manually and not using the Build SOAP request option, go to step 6.
-
Click Build SOAP request.
The SOAP request dialog appears. It shows the services and ports, with details about their operations and parameters.
-
In the SOAP request dialog, select the operation to
call.
- Expand the service for which you want to view the list of ports.
- Click the port to display its available operations.
-
Select the operation and click Apply.
The operation details are retrieved from the SOAP request.
The Services, Port, Operation, and Operation parameters fields are populated automatically with details based on the operation you selected. Go to step 10. -
In the Service field, enter the service name.
This field identifies the collection of ports that the web service supports. It holds the
@service namevalue for a SOAP web service call, for example, Calculator. - Optional:
In the Port field, enter the endpoint to connect with.
If you do not specify a port, the bot will use the first port mentioned in the WSDL file based on the service selected. However, if that port is not supported by the SOAP web service, bot execution will fail.This field holds the
@binding namevalue for a SOAP web service call, for example, CalculatorSoap. -
Select the SOAP version of the endpoint that you specified
in the Port field.
Choose either 1.1 or 1.2.Note: You can determine the SOAP version from one of following namespaces specified in the WSDL file:
- SOAP 1.1 namespace: http://schemas.xmlsoap.org/soap/envelope
- SOAP 1.2 namespace: http://www.w3.org/2003/05/soap-envelope
-
In the Operation field, enter the name of the service
function for the endpoint that you specified in the Port
field.
The bot execution fails if either of the following is true:
- The port that you specified in the Port field has no operations.
- The operation in the SOAP request for the port is unavailable.
This field holds the@operation namevalue for a SOAP web service call, for example, Add. -
Select Operation parameters or Raw data
parameters to provide the parameter details.
Note: If you have selected Build SOAP request, the parameter details table in the Operation tab is automatically populated with the parameters of the selected operation. Provide values for these parameters. You can also add, edit, or delete the parameters for a particular operation.
- If you select Operation parameters, enter the name and
value of each parameter. For example, enter the following values:
- In the first Name field, enter intA.
- In the first Value field, enter 10.
- In the second Name field, enter intB.
- In the second Value field, enter 20.
- If you select Raw data
parameters, select Parameters or
Credential parameters.
- If you selected Parameters, use a credential value
without exposing it in plain text.
Map the credential in the credential mapper, and then use the reference name in the raw data within curly braces. For example, the following raw data contains the password in plain text:
<aut:AuthHeader> <aut:Password> abc@123</aut:Password> </aut:AuthHeader>To use the password from the credential vault, do the following:
- Click Add substitution.
In the Name in XML field, enter the reference name, for example, pwd. Select Credential to use a value from the credential vault, Variable to use a credential variable, or Insecure string to specify the value manually.
For more information about credential vaults and how to use them, see Credentials and lockers in the Credential Vault.
- Click Add.
- In the raw data, specify the reference within curly braces:
<aut:AuthHeader> <aut:Password>{{pwd}}</aut:Password> </aut:AuthHeader>The reference name
pwdin raw data is replaced with the corresponding value stored in the credential vault.Use the same reference name that you entered in the Name in XML. For example, if you entered pwd in the Name in XML field but
passwordin the raw data, the bot returns an error when it runs.
- Click Add substitution.
- If you selected Credential parameters, select Credential to use a value from the credential vault, Variable to use a credential variable, or Insecure string to specify the value manually.
- If you selected Parameters, use a credential value
without exposing it in plain text.
- If you select Operation parameters, enter the name and
value of each parameter. For example, enter the following values:
-
Select No Authentication or Basic
from the Authentication Mode list.
If you select Basic, enter your credentials.
- Optional: Provide a client certificate by selecting a file from the Control Room or your desktop, or by inserting a variable.
- Optional: Provide custom headers.
- Optional: Provide a file to save the XML output.
-
Select Complete response or Selected
response to narrow the scope of the response.
- If you select Complete response, go to the next step.
- If you select Selected response, do the following if you are creating the XPath
expression manually and do not use the Build Xpath
option.
- Provide the XPath expression. For example:
/*[local-name()='Envelope' and namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/']/*[local-name()='Body' and namespace-uri()='http://schemas.xmlsoap.org/soap/envelope/']/*[local-name()='AddResponse' and namespace-uri()='http://tempuri.org/']/*[local-name()='AddResult' and namespace-uri()='http://tempuri.org/'] - Select a section of the XML output: Values, Inner XML, or Outer XML.
- If you select Values,
choose the return content: String delimited by or
List of strings.
- If you select String delimited by, choose a
delimiter: Pipe,
Semicolon, or
Custom.If you select Custom, enter variables or characters in the Custom Delimiter (optional) field.Note: You cannot use the dollar sign ($) as a delimiter.
- Select List of strings to return the SOAP
response as a list of strings.Note: You can specify only a list type of variable with the string data type.
- If you select String delimited by, choose a
delimiter: Pipe,
Semicolon, or
Custom.
- Provide the XPath expression. For example:
-
Click Build Xpath.
The Output preview dialog appears.
-
Select the appropriate node from the response body, and then click
Apply.
The XML path is created automatically. If you use the Build Xpath option, XPath expression and Value fields are populated automatically with details based on the operation you selected.
- Optional:
To set a timeout for sending a SOAP request and receiving a response, in the
Wait for action to complete field, specify the wait time in
milliseconds.
By default, the wait time is 60000 milliseconds.
-
Configure the P12 certificate:
- To provide the SSL certificate file, select one of the following options: Control Room file, Desktop file, or Variable
- Configure the keystore properties:
- Keystore file (Optional): To provide the keystore file in .p12 format, select one of the following options: Control Room file, Desktop file, or Variable. The keystore file includes the client's private key and certificate.
- Keystore password (Optional): To provide the password for the keystore file, select one of the following options: Credential, Variable, or Insecure string. The password is used to access the keystore file.
-
Select a variable to store the XML output.
For example, prompt-assignment
-
Verify the output, insert a Message box
action after the SOAP Web Service
action and use the variable prompt-assignment as
the message.
When you run the bot, the message box shows 30.