Microsoft® .NET Workflow Service

Overview

This document describes the APIs in the Microsoft.Workflow.Activities namespace, which contains the cloud-based workflow activities and the workflow client side APIs.

The Workflow Service hosts Windows Workflow Foundation (WF) 3.5 workflows. If you are not familiar with WF, we strongly suggest reading the MSDN WF overview.

Microsoft.Workflow.Activities

This is the main namespace for the Workflow SDK. It has the following main components:

Cloud-based Workflow Activities

The cloud-based workflows activities in the SDK can be used to author cloud-based workflows. The following are the activities found in Microsoft.Workflow.Activities:

  • CloudDelay: This activity provides the logic to establish a timer and wait asynchronously for the timer expiration.

    Properties

    • Timeout: the duration of the delay in the format supported by TimeSpan.Parse.

  • CloudHttpReceive: This activity receives an HTTP request at the URI http://workflow.windows.net/workflowsHttp/<UserName>/workflows/<WorkflowTypeName>/instances/ <InstanceId>/<ActivityName> and returns a response. The HTTP listener uses Access Control Service and the operation name "Send".

    Properties

    • Response: the HTTP content to return in response to the HTTP request.

    • StatusCode: the HTTP status code to return in response to the HTTP request.

    • Request: the content of the received HTTP request. This property is set by the activity when a request is received.

  • CloudHttpSend: This activity sends an HTTP request and returns the response.

    Properties

    • Method: the HTTP method.

    • Request: the request body content. This property is ignored if the method is GET.

    • RequestContentType: the request content type. This property is ignored if the method is GET.

    • StatusCode: the activity sets this value to the returned HTTP status code.

    • Response: the activity sets this value to the returned HTTP content.

    • URL: the URL for sending the HTTP request.

  • CloudServiceBusSend: This activity sends a message to the Service Bus and returns a response if appropriate.

    Properties

    • Action: the Action SOAP header for the Service Bus message.

    • Body: the XML content to include within the SOAP Body of the message.

    • ConnectionMode: the connection mode to connect to the Service Bus. The connection mode can be either Multicast or Tcp.

    • Response: the activity sets this value to the returned SOAP response body, if any.

    • URL: the URL to which to send the Service Bus message.

  • CloudXPathRead: This activity reads the result of executing an XPath expression on an XML string.

    Properties

    • InXml: the input XML to read a value from.

    • InXPathExpression: the XPath expression to be used in querying the InXml property.

    • OutReadValue: the result of executing the XPath expression.

  • CloudXPathUpdate: This activity updates an XML element's value in an XML string based on an XPath expression.

    Properties

    • InXml: the input XML to update a value in.

    • InXPathExpression: The XPath expression to be used in updating the InXml property.

    • InNewValue: the value to be used in updating the location in the InXml property retrieved by the InXPathExpression property.

    • OutXml: the output XML.

Workflow Client-Side APIs

The workflow client-side APIs enable you to create and manage workflow types and instances. The APIs are built on top of the workflow SOAP Web Services at http://workflow.windows.net/workflows/wsdl.

WorkflowClient Class

public class WorkflowClient : ClientBase<IWorkflow>
{
   // Constructors
   public WorkflowClient() ;
   public WorkflowClient(string endpointConfigurationName) ;
   
   // Properties
   public TransportClientCredentials Credentials { get ; set ; }
   public TransportClientCredentialType CredentialType { get ; set ; }
   
   // Methods
   // Aborts workflow instance with <id> instance Id
   public void AbortWorkflowInstance(string userName, string typeName, string id);
   
   // Creates an instance of workflow type <typeName> using <tgt> authorization token and gives it <instanceName> name
   public string CreateNamedWorkflowInstance( string userName, string typeName, string instanceName, string tgt);
   
   // Creates an instance of workflow type <typeName> using <tgt> authorization token
   public string CreateWorkflowInstance(string userName, string typeName,  string tgt);
   
   // Creates a workflow type <typeName> from the workflow definition <xoml>, and the workflow rules definition <rules>
   public void CreateWorkflowType(string userName, string typeName, string xoml, string rules);
   
   // Deletes the workflow instance of type <typeName> and Id <id>
   public void DeleteWorkflowInstance(string userName, string typeName, string id);
   
   // Deletes the workflow type <typeName>
   public void DeleteWorkflowType(string userName, string typeName);
   
   // Retrieves workflow instance info for all workflows that belong to the user <userName>
   public WorkflowInstanceInfo[] GetAllWorkflowInstanceInfo(string userName);
   
   // Retrieves workflow instance info for all workflow of <typeName> type that belong to the user <userName>
   public   WorkflowInstanceInfo [] GetAllWorkflowInstanceInfoByType(string userName, string typeName);
   
   // Retrieves all workflow instances that belong to the user <userName> and of type <typeName>
   public string[] GetAllWorkflowInstances(string userName, string typeName);
   
   // Retrieves workflow  instance info for all workflows that belong to the user <userName> and of type  <typeName> and ID <id>
   public WorkflowInstanceInfo GetWorkflowInstanceInfo(string userName, string typeName, string id);
   
   // Retrieves workflow  instance that belong to the user <userName> and of type <typeName> and have a status <status>
   public string[] GetWorkflowInstances(string userName, string typeName, System.Workflow.Runtime.WorkflowStatus status);
   
   // Retrieves workflow type XOML definition for workflow types that belong to the user <userName> and of type <typeName>
   public WorkflowTypeDescription GetWorkflowType(string userName, string typeName);
   
   // Retrieves workflow type names for all workflow types that belong to the user <userName>
   public string[] GetWorkflowTypeNames(string userName);
   
   // Opens WorkflowClient
   public void Open();
   
   // Resumes workflow instance with ID <id>
   public void ResumeWorkflowInstance(string userName, string typeName, string id);
   
   // starts workflow instance with ID <id> 
   public void StartWorkflowInstance(string userName, string typeName, string id);
   
   // suspends workflow instance with ID <id> and takes a <reason> suspend reason
   public void SuspendWorkflowInstance(string userName, string typeName, string id, string reason);
   
   // terminates workflow instance with ID <id> and takes a <reason> terminate reason
   public void TerminateWorkflowInstance(string userName, string typeName, string id, string reason);
   
   // Updates workflow type and rules definition with new workflow type <xoml> and workflow rules <rules>
   public void UpdateWorkflowType(string userName, string typeName, string xoml, string rules);
}

WorkflowClientConfig

public class WorkflowClientConfig
{
   // Constructors
   public WorkflowClientConfig() ;
   
   // Properties
   public static int DefaultMaxReceivedMessageSize { get ; set; }
   public static int DefaultMaxStringContentLength { get ; set; }
   public static int DefaultReceiveTimeout { get ; set; }
   public static int DefaultSendTimeout { get ; set; }
   public static Uri HttpUri { get ; set; }
   public static string  StsCertificate { get ; }   
   public static bool StsEnabled { get ; set; }
   public static string  StsHostName { get ; }   
   public static string  WorkflowCertificate { get ; }   
   public static string  WorkflowHostName { get ; set; }
   public static TraceSwitch WorkflowTrace { get ; }
   public static Uri WorkflowUri { get ; set; }
}

WorkflowClientCredentials

WorkflowClientCredentials is the WCF ClientCredentials used by the WorkflowClient to authenticate. Writing directly to the workflow SOAP Web Services APIs exposed at http://workflow.windows.net/workflows/wsdl would require the use of the WorkflowClientCredentials.

public class WorkflowClientCredentials : ClientCredentials
{
   // Constructors
   public WorkflowClientCredentials() ;
   public WorkflowClientCredentials(WorkflowClientCredentials other) ;
   
   // Methods
   protected override ClientCredentials CloneCore();
   public override System.IdentityModel.Selectors.SecurityTokenManager CreateSecurityTokenManager();
}

WorkflowFault

public class WorkflowFault
{
   // Constructors
   public WorkflowFault (System.Workflow.ComponentModel.Compiler.WorkflowValidationFailedException e)
   
   // Properties
   public string [] Error { get ; set; }
}

WorkflowInstanceInfo

WorkflowInstanceInfo holds information about workflow instances on the system.

public class WorkflowInstanceInfo
{
   // Properties
   public DateTime DateCreated { get ; }
   public string Details { get ; }
   public string InstanceId { get ; }
   public string InstanceName { get ; }
   public DateTime LastModified { get ; }
   public string RunningAs { get ; }
   public System.Workflow.Runtime.WorkflowStatus Status { get ; }
   public string TypeName { get ; }
   public string UserId { get ; }
}

WorkflowTypeDescription

WorkflowTypeDescription holds information about workflow types on the system.

public class WorkflowInstanceInfo
{
   // Constructors
   public WorkflowTypeDescription (string typeName, string xoml); 
   public WorkflowTypeDescription (string typeName, string xoml, string rules);
   
   // Properties  
   public string Rules { get ; }
   public string TypeName { get ; }
   public string Xoml { get ; }
}
Page view tracker