Write a WindowsWorkflow

Build 1501 on 14/Nov/2017  This topic last edited on: 26/Aug/2014, at 11:56

The XML file of a WindowsWorkflow contains the data, options and activities needed to the WindowsWorkflow execution.

In GN4 the WindowsWorkflow XML files have the name with the 'wf_' prefix.

To review existing WindowsWorkflows, follow the instructions in WindowsWorkflows in standard configuration.

WindowsWorkflow structure

All the WindowsWorkflow XML files are structured in the same way:

workflow2

The WindowsWorkflow node can be SequentialWorkflow or NavigatorWorkflow.

Besides the WindowsWorkflow itself and its activities, the WindowsWorkflow XML file can contain some options (XmlTransformOptions, XmlImportOptions, XmlExportOptions) and other objects needed for the WindowsWorkflow execution (ObjectUI, SearchConditions, etc...).

The WindowsWorkflow options are the serialized XML of GN4 objects that are read and created dynamically at runtime.

In other words, they are pieces of XML that the WindowsWorkflow reads during its execution.

However, a well-formed XML file must have only one root node: this is the reason why there is a 'root node' (<wfres:workFlow>) other than the 'workflow node' (<SequentialWorkfow>).

Sequential WindowsWorkflow structure

An empty SequentialWorkflow XML file looks like this example:

<?xml version="1.0"?>

-<wfres:workFlow xmlns:wfres="http://www.teradp.com/schemas/GN4/1/WFRes.xsd"> 

<!-- Tera Digital Publishing -->

 

<!-- Sequential workflow -->

 <SequentialWorkflow 

         xmlns:coll="clr-namespace:System.Collections;assembly=mscorlib" 

         xmlns:sys="clr-namespace:System;assembly=mscorlib" 

         xmlns:wf="http://schemas.microsoft.com/winfx/2006/xaml/workflow" 

         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 

         xmlns:common="http://www.teradp.com/schemas/GN4/1/Common" 

         xmlns:gn4wf="http://www.teradp.com/schemas/GN4/1/Workflow" 

         xmlns="http://www.teradp.com/schemas/GN4/1/Workflow/Activity" 

         x:Name="mainWorkflow"> 

</SequentialWorkflow> 

 <!-- workflow resources - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

 

 <!-- add options here... -->

 </wfres:workFlow>

About XML namespaces

The main namespace is http://www.teradp.com/schemas/GN4/1/Workflow/Activity, so every XML element without a prefix (and without its own namespace definition) belongs to this main namespace.

There are then some Microsoft namespaces for standard XAML elements: http://schemas.microsoft.com/winfx/2006/xaml and http://schemas.microsoft.com/winfx/2006/xaml/workflow.

The namespaces for standard .NET objects (like String, Integer, ArrayList, etc... defined in System and System.Collections .NET assemblies): clr-namespace:System;assembly=mscorlib and clr-namespace:System.Collections;assembly=mscorlib.

There is a namespace for the GN4 objects defined in Common.dll (such as Options of Parse activity and Step of TransformData activity): http://www.teradp.com/schemas/GN4/1/Common and and the ones for the other objects used into the GN4 WindowsWorkflows (like Transition, XPathCondition, etc...): http://www.teradp.com/schemas/GN4/1/Workflow and http://www.teradp.com/schemas/GN4/1/WFRes.xsd.

Finally, the WindowsWorkflow Options have their own namespaces.

Into this empty WindowsWorkflow you can add the activities in the needed order.