Automating Web Service Execution

by marjo martinez, in Tech Talk, posted 3/31/09

Web Service - Overview
A Web service is defined as a set of technologies that provide platform-independent standards used for exchanging data between applications over a network, such as the Internet. Businesses can dynamically mix and match Web services to perform complex transactions with minimal programming. For instance, Web services allow buyers and sellers all over the world to discover each other, connect dynamically, and execute transactions in real time with minimal human interaction.

Web Services are typically Web applications that can be accessed over the Internet by using a web browser (or other local client) and executed on a remote server hosting the requested services. Web services can perform functions that can be anything ranging from single requests or standard operations to elaborate business processes.  Web services can essentially be any type of service, for example, weather reports, stock quotes, credit checks, travel advisories, or airline travel reservation processes. Each of these self-contained business services is an independent application that can easily integrate with other services, from the same or different organizations, to create a complete business process. The outcome of a well designed business process can enormously increase effectiveness for the customer and efficiency for the company.

NOTE:  For a sample task showcasing the Web Service in action, go here.


Standard Web Service Elements
Web services are generally comprised of a few important elements:

SOAP (Simple Object Access Protocol): SOAP is the standard protocol for accessing a Web service. It was designed to allow a means to communicate between applications over HTTP, which is considered superior to other native protocols because HTTP is supported by all Internet browsers and servers. Additionally, because SOAP is based on XML, it provides a way to communicate between applications running on different operating systems, with different technologies and programming languages. 

WSDL (Web Services Description Language):
WSDL is the standard format for describing a Web service. It is an XML-based language that specifies the location of the service and the operations (or methods) in which the service performs. It provides a simple way for service providers to describe the basic format of requests to their systems regardless of the underlying protocol or encoding.

WSDL is often used in combination with SOAP and XML Schema to provide web services over the Internet. A WSDL document is simply a set of definitions. A client program connecting to a web service can read the WSDL to determine what functions are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema. The client can then use SOAP to actually call one of the functions listed in the WSDL.

A WSDL file typically contains XML schema describing everything involved in calling a Web service.  

  • The service URL and namespace
  • The type of web service (probably function calls using SOAP, although as I mentioned, WSDL is flexible enough to describe a wide variety of web services)
  • The list of available functions
  • The arguments for each function
  • The datatype of each argument
  • The return values of each function, and the datatype of each return value

Execute Web Service Action
The ‘Execute Web Service’ action provides an automated means of calling a Web service method by way of a WSDL document or URI. This action supports variables, static values and standard parameter types (such as strings and numbers) as well as support for structure information. Data can be returned into a corresponding structure or a specified AutoMate variable.

NOTE:  Because Web Services use XML as its standard format, some knowledge of XML schema, XML namespace, function calls and arguments may be required in order to properly utilize the ‘Execute Web Service’ action.

During runtime, the ‘Execute Web Service’ action will query for a list of methods and their associated parameters, allow one or more methods to be called and the necessary parameters to be provided for a valid method call to be placed to the Web service.  This may require the use of one or more structures as parameters.  If structures are required, the user must initially create them during design time using the ‘Define Type’ and ‘Create Object’ actions and place them onto the underlying action. Structures are stored into memory during execution. After the method call is executed, the in-memory structures are automatically discarded. Upon completion of the Web service call, the returned data is placed into the AutoMate variable specified during design time. This can be a standard variable, array or structure.

Most methods require one or more parameters for successful completion of a method call. These parameters and their types are contained in the WSDL used to define the method.  Such information can be entered in the properties of the ‘Execute Web Service’ action, typically under the General and Parameters tab.

The ‘Execute Web Service’ action’s General tab (shown below) contain sections to enter a WSDL location, select one or more method names, indicate which variable to populate the returned data as well a section to create a structure (if needed).

The text box labeled WSDL URI specifies the location of the WSDL document or URI (Uniform Resource Identifier). This option accepts either a WSDL URL or the path and filename of a WSDL file. The folder icon to the right of this parameter opens a standard Explorer dialog which can be used to navigate to, and select a WSDL file or the file or URL information can simply be entered manually in the provided text box. The information entered is saved to memory so when this action is used in future tasks, clicking the down arrow located inside the text box will display a dropdown of all WSDL information previously entered.  

After specifying a WSDL location, clicking the Go button will attempt to query available WSDL methods (also known as operations) associated with the specified WSDL URL or file. Upon a successful query, all discovered methods will be populated into the Method field. Clicking the down arrow corresponding to this field will display a full list of queried method names in which to select from. 

For example, the WSDL URI information entered in the General tab illustrated above is:

This points to a WSDL URL which returns detailed real-time stock quote information. After entering this URL, clicking GO populates the Method field with a single method named GetQuota.

The text box labeled Populate variable with return value specifies the name of an existing variable to be populated with the value returned by the selected method. The variable must be created in a previous step using the ‘Create Variable’ action. Clicking the down arrow inside this text box will display the list of available variables. In the example above, the variable which will be used to populate the returned data is named returnedData.

The option labeled Create structure with returned user defined object's properties specifies the name of the structure created by the user. A Web Service call may require the use of one or more structures as parameters. If such structures are required, as mentioned previously, the user must initially create them in prior steps during design time using the ‘Define Type’ and ‘Create Object’ action. The ‘Define Type’ action defines a custom object type or types defined in a Web service. The ‘Create Object’ action creates an Automate Object from defined custom type(s) defined by the ‘Define Type’ action. The structure contents can then be defined in this parameter with the returned user defined object’s properties. Structures can be saved to an AutoMate variable which can be specified in this parameter.

NOTE: The selected structures must be defined in the same WSDL as the method call. 

The Arguments tab (shown below) provides components to add, remove or modify necessary parameters related to the method call selected in the General tab.

If clicking the Go button accomplished a successful query of the WSDL document/URI and one or more methods were selected from the Method field, the Type column of the Arguments tab becomes pre-populated with any corresponding parameter types in the order in which they were selected. This allows the user to simply enter the necessary parameter values under the Value column.

Parameter types / values can be entered manually by clicking the Add button. To remove existing types, select it from the list and click the Remove button. The order of each type can be rearranged by selecting the desired type and clicking the Move Up or Move Down button.

As for the example illustrated above, selecting the method named GetQuota pre-populates the Type column with the String parameter type and the Value column with the phrase Please insert (symbol) here. The user simply needs to enter an appropriate stock symbol in the Value column then click OK to save the settings and close the properties dialog. 

For instance, if Google’s stock symbol (Goog) was entered in the Value column and a ‘Message Box’ step was created following the ‘Execute Web Service’ step to display the returned data, during runtime, a message similar to the one shown below will appear.   

Of course, the data is returned in structured format, but with the use of a few ‘Replace Text’ actions, actions, the data can be cleaned out and returned as shown below.

The goal for most enterprises is to simplify the integration of business and application processes across technological and corporate domains. The growth of Web service technologies has proven that Web services can reliably exchange data between different platforms, thus, allowing applications to connect and work together in an increasingly dynamic way. AutoMate’s ‘Execute Web Service’ action allows companies to further leverage the power and benefits of the Web Services Architecture through its ability to perform automated Web service executions, thus, allowing a more rapid approach to completing business transactions and processes.