The main purpose of a Web services client is to run workflows across a network.

You must have implemented Web service operations in the client to find workflows in the Orchestrator server.


(Optional) Check the workflow user permissions by calling the hasRights operation.

You can verify if a user has rights to read, run, or edit a particular workflow using the hasRights operation. This operation is not mandatory, but checking user rights before you run a workflow can help prevent exceptions.

String workflowId = "1880808080808080808080808080808087808080011713796199469943be4c882";
Boolean rights = vsoWebControl.hasRights(workflowId, username, password, 'x');

The preceding code example calls the hasRights operation to discover whether the user has the right to run the workflow identified by workflowId.

If the user has the right to run the workflow, hasRights returns true. Otherwise, hasRights returns false.


Set the workflow attributes in a WorkflowTokenAttribute object.

The Web services client passes WorkflowTokenAttributes arrays to a WorkflowToken object, which runs the workflow.

WorkflowTokenAttribute[] attributes = new WorkflowTokenAttribute[1];
WorkflowTokenAttribute attribute = new WorkflowTokenAttribute();
attributes[0] = attribute;

The preceding example creates a WorkflowTokenAttribute object, then populates it with the following information:

The name of the attribute, in this case, vm.

The type of attribute, as discovered in a FinderResult object defined elsewhere in the code.

The attribute value, which in this case is a dunesUri string, signifying that the value specifies an object accessed through a plug-in.


Run the workflow by calling the executeWorkflow operation.

To run a workflow, you pass the workflow attributes to the executeWorkflow operation in the form of a WorkflowTokenAttribute array.

Running a workflow creates a WorkflowToken object, which represents the instance of the workflow that runs with the specific input parameters that it receives when it starts.

WorkflowToken token = vsoWebControl.executeWorkflow(workflowId, username, password, attributes);

In the preceding example, the attributes property is the array of WorkflowTokenAttribute objects created in Step 2.

Sometimes, workflows require input parameters during their run. In these cases, you can provide attributes through a user interaction while the workflow is running. You can pass attributes to the workflow during its run using the answerWorkflowInput operation.

You implemented operations in the Web service client that check user permissions, pass attributes to a workflow, and run the workflow.

Implement operations in the Web services client to interact with workflows while they run.