Web Service

Web Service is a method of communication between two electronic devices or software instances. Web Service is defined as a data exchange standard. It uses XML format to tag the data, SOAP protocol is used to transfer the data, and WSDL language is used to describe the available services.

Important

If you connect to your local SQL database with Web Client, start the Execute SQL Statement action name with the "LOCAL_" prefix.

This action connects to a remote Web service and executes the methods on it. Methods can be described as actions that are published on the Web Service. The action sends inbound values to the selected method in the remote Web service, collects the result and saves it in selected variables.

After importing the WSDL and adding a reference to the Web Service, its methods are listed in the Method combo box.

Note

You can transfer simple types over the Web Service, such as string, integer, boolean, but not the complex types. The WSDL must contain single binding only.

You plan to print product labels. Your trigger would receive only a segment of the required data. E.g. the trigger receives the value for Product ID and Description variables, but not the Price. The price information is available in a separate database, which is accessible over Web service call. Web service defines the function using a WSDL definition. For example, function input is Product ID and its output is Price. The Web Service action sends Product ID to the Web service. It executes and makes an internal look up in its database and provide the matching Price as the result. The action saves the result in a variable, which can be used on the label.

About group identifies the selected action.

  • Name: allows you to define a custom action name. This makes actions easily recognizable on the solution's list of actions. By default, the action name is taken from its type.
  • Description: custom information about the action. Enter a description to explain the purpose and role of action in a solution.
  • Action type: read-only information about the selected action type.

Web Service Definition group includes the following settings:

Note

This action supports Internet Protocol version 6 (IPv6).

  • WSDL: location of WSDL definition.

    WSDL is usually provided by the Web service. Typically, you would enter the link to WSDL and click Import to read the definition. If facing troubles while retrieving the WSDL from online resource, save the WSDL to a file and enter the path with file name to load the methods from it. automatically detects if the remote Web Service uses a document or RPC syntax, and whether it communicates appropriately or not.

  • Address: address at which the Web Service is published.

    Initially, this information is retrieved from the WSDL, but can be updated before the action is executed. This is helpful for split development / test / production environments, where the same list of actions is used, but with different names of servers on which the Web Services run.

    Fixed content, mix of fixed and variable content, or variable content alone are permitted. To enter variable content, click the button with arrow to the right hand side of data area and insert variable from the list. For more information, see section Combining Values in an Object in Loftware user guide.

  • Method: methods (functions) that are available for the selected Web service. The list is automatically populated by the WSDL definition.

  • Parameters: input and output variables for the selected method (function).

    Inbound parameters expect an input. For testing and troubleshooting reasons, you can enter a fixed value and see the preview result on-screen. Typically, you would select a variable for inbound parameter. Value of that variable will be used as input parameter. The outbound parameter provides the result from the function. You must select the variable that will store the result.

  • Timeout: timeout after which the connection to a server is established.

Note

Web Service action is executed on Web Printing Server and not on the Web Printing Client.

If you use Web Service action in Loftware Loftware Web Client and you want to execute locally (bypassing the Web Printing Server), add the prefix "LOCAL_" to your action name.

_LOCAL_03.png

Authentication enables basic user authentication. This option defines user credentials that are necessary to establish an outbound call to a remote web service.

  • Enable basic authentication: enables defining the Username and Password that can be entered manually or defined by variable values. Select Data sources to select or create the variables.

  • Show password: uncovers the masked Username and Password characters.

    Details about security concerns, are available in section Securing Access to your Triggers in Loftware Automation user guide.

Data Preview field allows you to perform a test Web service execution.

  • Execute button executes a Web service call.

    It sends values of inbound parameters to the Web service and provides the result in the outbound parameter. Use this functionality to test the execution of a Web service. You can enter values for inbound parameters and see the result on-screen. When satisfied with execution, replace the entered fixed value for inbound parameter with a variable from the list.

Action Execution and Error Handling

Each action can be set as a conditional action. Conditional actions only run when the defined conditions allow them to be run. To define these conditions, click Show execution and error handling options.

Execution options are:

  • Enabled: specifies if the action is enabled or disabled. Only enabled actions will execute. This functionality may be used while testing a form.
  • Condition: defines one-line programming expression that must provide a Boolean value (true or false). When the result of the expression is true, the action will execute. Condition offers a way to avoid executing actions every time.

Error handling options are:

  • Ignore failure: specifies whether an error should be ignored. If enabled, the execution of actions continues even if the current action fails.

    Note

    Nested actions that depend on the current action do not execute in case of a failure. The execution of actions continues with the next action on the same level as the current action. The error is logged but does not break the execution of the action.

  • Example

    At the end of printing, you might want to send the status update to an external application using the HTTP Request action. If the printing action fails, action processing stops. In order to execute the reporting even after the failed print action, the Print Label action must have the option Ignore failure enabled.

  • Save error to variable: allows you to select or create a variable to save the error to. The same cause of the error is also saved to internal variables ActionLastErrorId and ActionLastErrorDesc.