Web Services API: WorkflowContext specifications and usage


#1

The WorkflowGen Web Services API uses WorkflowContext data structure in important web methods such as:

  • CompleteActivityInstance

  • GetActivityInstanceContext

  • StartProcess

WorkflowContext is an XML data structure used to exchange parameters with WorkflowGen. The XML data structure is based on the ADO.NET Dataset object (serialized in XML) or the ADO Recordset (serialized in XML). This means that the structure is similar to database tables and records.

This article will use the ADO.NET Dataset format for the WorkflowContext. Here’s an example of a WorkflowContext:

<NewDataSet>
    <parameter>
        <name>COMPANY</name>
        <dataType>TEXT</dataType>
        <direction>OUT</direction>
        <textValue>My company</textValue>
    </parameter>
    <parameter>
        <name>AMOUNT</name>
        <dataType>NUMERIC</dataType>
        <direction>OUT</direction>
        <numericValue>1000</numericValue>
    </parameter>
    <parameter>
        <name>APPROVAL_DATE</name>
        <dataType>DATETIME</dataType>
        <direction>OUT</direction>
        <dateTimeValue>2013-11-18T16:11:51-05:00</dateTimeValue>
    </parameter>
    <parameter>
        <name>ATTACHMENT</name>
        <dataType>FILE</dataType>
        <direction>OUT</direction>
        <fileName>report.xls</fileName>
        <fileDescription>My report</fileDescription>
        <fileSize>202345</fileSize>
        <fileContentType>application/vnd.ms-excel</fileContentType>
        <fileDateLastModified>2013-10-15T16:11:51-05:00</fileDateLastModified>
        <fileOriginalPath>C:\myfolder\report.xls</fileOriginalPath>
        <filePath>C:\myfolder\report.xls</filePath>
    </parameter>
</NewDataSet>

<NewDataSet> node

This is a Dataset object that contains a set of parameters (parameter nodes) and one session information (session node).

<Parameter> node

The Parameter node contains information about the parameter to exchange with WorkflowGen web method:

  • <name> node: The name of the parameter defined in the Workflow Action.

  • <dataType> node: This node can have one of the following values: TEXT, NUMERIC, DATETIME, FILE.

  • <direction> node: This node can have one of the following values: IN, OUT, or INOUT.

  • <textValue> node: The text value of the parameter.

  • <numericValue> node: The numeric value of the parameter.

  • <dateTimeValue> node: The datetime value of the parameter. The date format is xsd:dateTime. Note that Datetime values are stored in GMT.

  • <fileName> node: The file name.

  • <fileDescription> node: The file description.

  • <fileSize> node: The file size in bytes.

  • <fileDateLastModified> node: The date of the last modification of the file. The date format is xsd:dateTime.

  • <fileContentType> node: The file MIME type.

  • <fileOriginalPath> node: The original path of the file (for information only).

  • <filePath> node: The file path. WorkflowGen uses this path to retrieve the file.

WorkflowContext creation with WorkflowGen.My

To simplify WorkflowContext creation and modification you can use WorkflowGen.My and its WorkflowGen.My.Data.ContextParameters class. Here’s an example in C#:

WorkflowGen.My.Data.ContextParameters myWorkflowContextParameters = new WorkflowGen.My.Data.ContextParameters();

WorkflowGen.My.Data.ContextParameter contextParamApproval = new WorkflowGen.My.Data.ContextParameter();

contextParamApproval.Name = "DECISION";

contextParamApproval.Direction = WorkflowGen.My.Data.ContextParameter.Directions.Out;

contextParamApproval.Type = typeof(string);

contextParamApproval.Value = "YES";

myWorkflowContextParameters.Add(contextParamApproval);

myWorkflowContextParameters.Update();

string workflowContext = myWorkflowContextParameters.GetXml();

How to launch a new request with context parameters from an external application via the web service API using SOAP
How to launch a new request with context parameters from an external application via a URL
Web Services API
Workflow Application: Assembly: Use an assembly method with a workflow context parameter for more flexibility