Developer documentation

SOAP interface

Main entry point

The main entry point is:

class vmw.vco.client.Client[source]

Implementation of a vCO webservice client. API Calls implemented:

  • echo
  • echoWorkflow
  • answerWorkflowInput
  • cancelWorkflow
  • executeWorkflow
  • find
  • findForId
  • findRelation
  • hasChildrenInRelation
  • getAllPlugins
  • getAllWorkflows
  • getWorkflowForId
  • getWorkflowsWithName
  • getWorkflowTokenForId
  • getWorkflowTokenResult
  • getWorkflowTokenStatus
  • simpleExecuteWorkflow
  • hasRights
  • sendCustomEvent
__init__(self, url, username, password, async=False, **kw)[source]

Build a client for target vCO server.

Parameters:
  • url (string) – full URL for the target vCO SOAP service
  • username (string) – user name
  • password (string) – password for the user
  • async (bool) – whether to use asynchronous bindings
  • kw (dict) – keyword arguments passed to underlying Binding object
answerWorkflowInput(token, inputs={})[source]

Provide answer for the user interaction the token is waiting on.

Parameters:
cancelWorkflow(token)[source]

Cancel specified workflow token.

Parameters:
echo(msg)[source]

Test method. Echo back provided message.

Parameters:
  • msg (string) – Message to echo.
echoWorkflow(wf)[source]

Test method. Echo back provided workflow.

Parameters:
executeWorkflow(wf, inputs={})[source]

Run a workflow with specified set of inputs.

Parameters:
find(type, query='')[source]

Find objects of a given type, that match a plug-in dependant query.

findForId(type, id)[source]

Find specific object, from it’s type and unique id.

findRelation(type, id, relation)[source]

Find children of specific object (defined by its type and unique id), according to specified relation.

getAllPlugins()[source]

Retrieve all plugins installed in the server.

Return type:list of vmw.vco.client.Plugin
getAllWorkflows()[source]

Retrieve all workflows installed in the server.

Return type:list of vmw.vco.client.Workflow
getWorkflowForId(id)[source]

Retrieve workflow with specified id.

Parameters:
getWorkflowTokenForId(token_id)[source]

Retrieve a workflow token from its id.

Parameters:
  • token_id (string) – token id
getWorkflowTokenResult(token)[source]

Get result for workflow token. Only applies when the workflow execution is completed.

Parameters:
getWorkflowTokenStatus(tokens)[source]

Get status for specified list of workflow tokens. Returns a list of status in the same order.

getWorkflowsWithName(name)[source]

Retrieve all workflows with specified name (might be in different categories).

Parameters:
  • name (string) – Workflow name
hasChildrenInRelation(type, id, relation)[source]

Check if specified object (defined by its type and unique id) has any children according to specified relation.

hasRights(task, right)[source]

Check if current user has rights over the specified task.

sendCustomEvent(event, props)[source]

Send a custom event with specified properties.

Parameters:
  • event (string) – event to send
  • props (dict) – properties of the event
simpleExecuteWorkflow(wf, encoded_input)[source]

deprecated

Alternate way of executing a workflow. This will encode inputs in an unsafe way, please don’t use.

Parameters:

Helper objects

A collection of helpers is also provided, that make use of the API more object-oriented:

class vmw.vco.client.Plugin[source]
description

Plugin description

name

Plugin name

version

Plugin version

class vmw.vco.client.Workflow[source]
attributes

Workflow attributes. list of vmw.vco.client.WorkflowAttribute

description

Workflow description

execute(inputs={})[source]

Execute this workflow with provided input parameters.

Parameters:
  • inputs (dict) – input parameters
id

Workflow id

inParameters

Workflow input parameters. list of vmw.vco.client.WorkflowAttribute

name

Workflow name

outParameters

Workflow output parameters. list of vmw.vco.client.WorkflowAttribute

class vmw.vco.client.WorkflowAttribute[source]
name

Attribute name

type

Attribute type

class vmw.vco.client.WorkflowToken[source]
globalState

WorkflowToken state

id

WorkflowToken id

title

WorkflowToken title

workflowId

Related Workflow id

class vmw.vco.client.FinderResult[source]
id

FinderResult id

properties

FinderResult properties (dict)

uri

FinderResult uri

Using objects

A surprisingly challenging part in using vCO SOAP API is to provide workflows with proper input parameters. For that it’s necessary to generate valid representations of all types that can be used as input. For immediate values, it’s rather easy (and worst case, vmw.vco.client.TypedValue can be used to wrap anything).

class vmw.vco.client.TypedValue[source]
__init__(self, type, value)[source]

Build a typed value

Parameters:
  • type – type of the value
  • value – string representation of the value

For objects, it’s more complicated, as they can come from different places (workflow output, finder result, other component that’s specific to your application’s logic).

The rule in vmw.vco is that a valid input is something that implements the interface vmw.vco.interfaces.ITypedValue. This include of course vmw.vco.components.TypedValue, but also everything that has an adapter registered for that interface.

In particular, the adapters from vmw.vco.adapters are loaded by default.

class vmw.vco.adapters.BoolValue(original)[source]

Adapter from bool to ITypedValue.

class vmw.vco.adapters.IntValue(original)[source]

Adapter from int to ITypedValue.

class vmw.vco.adapters.StringValue(original)[source]

Adapter from string to ITypedValue.

vmw.vco.adapters.adapter(ifrom, ito)[source]

Decorator to help registering a new adapter.

Parameters:
  • ifrom – interface or class to adapt
  • ito – interface to expose

So, if you have some custom objects that could be transformed into an input value, just register an adapter for it, and pass it !

Table Of Contents

Previous topic

SOAP client usage

This Page