Running a Workflow from an External Program

Workflows that have been registered as Web Services may be run from an external program that provides a Web Services client. Workflows run in this manner are executed asynchronously. The external program invokes the workflow using the workflow’s Web Service definition, and control then is immediately returned to the external program while the workflow is running. The external program must poll the workflow periodically in order to monitor its execution status and obtain any results that are returned when the workflow has completed.

The WSDL file created for a workflow that has been registered as a Web Service provides two operations, named StartWorkflow() and EndWorkflow().

StartWorkflow()

The StartWorkflow() operation starts the workflow identified in the WSDL file. The inputs for the operation are the input parameters that were set for the workflow by the Register Workflow as Web Service Wizard. The result of the operation contains the following items:

token

A unique identifier for the workflow. This identifier is used in calls to the EndWorkflow() operation.

interval

The recommended polling interval after which the workflow’s status should be checked, in seconds. This may vary dynamically between calls.

EndWorkflow()

The EndWorkflow() operation obtains the execution status for a workflow. The input for the operation is a workflow token returned by the StartWorkflow() operation. The result of the operation contains the following items:

status

The execution status for the workflow. This may be set to one of the following:

Status Description
QUEUED The workflow has been queued because the limit for the number of workflows that may run concurrently has been reached. If you have LiveCompare Administrator privileges, this limit may be set using the MaxConcurrentProcesses configuration setting. The workflow will run when it reaches the front of the queue and the number of running workflows drops below the MaxConcurrentProcesses limit.
RUNNING The workflow is running.
COMPLETED The workflow has run to completion.
FAILED The workflow started, but an error occurred while it was running.
UNRECOGNIZED_TOKEN The token used by the EndWorkflow() operation is no longer valid. A token becomes invalid after a call to EndWorkflow() for the token returns a status of either COMPLETED or FAILED.

message

If the workflow’s execution status is FAILED, ‘message’ contains a textual description of the error that occurred.

interval

The recommended polling interval after which the workflow’s status should be checked, in seconds. This may vary dynamically between calls.

workflowResult

If the workflow’s execution status is COMPLETED, ‘workflowResult’ contains the result of the workflow. This is the value of the output parameter that was set for the workflow by the Register Workflow as Web Service Wizard.

Adder Example