Web Service Request

Make requests to a web service, according to the actions loaded from a Web Service Description Language (WSDL).

Command availability: IBM RPA SaaS and IBM RPA on premises

Description

Make requests to a web service, according to the actions loaded from a Web Service Description Language (WSDL).

Web Services Description Language (WSDL) is an Extensible Markup Language (XML)-based description language. This language was submitted to the World Wide Web Consortium (W3C) as the industry standard for describing web services. See more in WSDL 🡥.

Syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

webService [--handleError(Boolean)] --name(String) --contract(String) --operation(String) [--arguments(String)] [--timeout(TimeSpan)] (Boolean)=success (String)=value

Inputs parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Handle error handleError Optional Boolean Enable to handle errors automatically. If an error occurs, the command is ignored and the bot proceeds normally.
Web service name Required Text WSDL asset used to read web service contracts.
Contract contract Required Text Contract of the web service described in the WSDL asset. After you load the WSDL asset, click the Load button to display a list of possible contracts.
Operation operation Required Text Operation of the web service described in the WSDL asset. After you load the WSDL asset, click the Load button to display a list of possible operations.
Operation input parameters arguments Optional Text Operation input parameters of the web service described in the WSDL asset. After you load the WSDL asset, click the Load button to display a list of input parameters.
Timeout timeout Optional Time Span, Number, Text Maximum wait time for response. The default timeout is 5 seconds. It can also use the timeout defined by the Set Timeout (setTimeout) command.

Outputs parameters

Designer mode label Script mode name Accepted variable types Description
Success success Boolean Returns True if the command runs successfully. Otherwise, returns False.
Value value Text Returns the response of the web service request already interpreted.

Example

The following example uses a web service asset to get the capital of the United States.

import --name webService --type "WebService" --url "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL"
defVar --name requestSuccess --type Boolean
defVar --name requestOutput --type String
//--------------------------------About this script--------------------------------
// Description: Get the capital of the United States
// Last updated: 02/16/2023
//-----------------------------------------------------------------------------------
// Calls for operation CapitalCity of the DataFlex Web Service for Country information web service
webService --name "${asset.webService}" --contract CountryInfoServiceSoapType --operation CapitalCity --arguments "[{\"Index\":0,\"TypeName\":\"System.String\",\"Name\":\"sCountryISOCode\",\"Value\":\"US\"}]" --timeout "00:00:05" requestOutput=value requestSuccess=success
logMessage --message "${requestSuccess}\r\n${requestOutput}" --type "Info"
// The execution return:
// True
// Washington