Create a WorkflowService which uses HTTP instead of SOAP activation
||Receive HTTP Messages and deliver them to workflow activities
HttpReceive activity supports request/response with HTTP messaging
||Support URI Templates
HttpReceive activity uses the
UriTemplate class to provide support for template matching and argument binding
||Support All HTTP Verbs (and custom verbs)
HttpReceive activity supports standard verbs in the drop down list, or type your own custom verb
||Allow a late bound decision about which XAML files to load
||The XAML file must be determined at the time the service host is opened for the host to know what UriTemplates can be matched.
||Support loading XAML files from sources other than the file system
||You can load from non-file streams if you want by loading an activity and passing it to the
||Support Persistence and Correlation
||Supports any InstanceStore and Correlation via cookies (now) and content based correlation (soon)
||Support Durable Timers
||(not supported yet)
||Make it simple for WF developers to correctly report errors via HTTP
||Exception Handling and HTTP Workflow Services
||Work with Windows Server AppFabric Monitoring
||not supported yet
Implement the service from the
WCF WebHttp REST Entity Service
with a workflow and pass all the same tests
Implement the service from the article
How to GET a Cup of Coffee
This is a screenshot of a prototype
The behavior of the HTTP Workflow Service is similar to the behavior of a WorkflowService.
- Workflow Author drops an
HttpReceive activity and configures the HTTP Method, UriTemplate
- Workflow Author drops activities on the body to deal with the request. They can access the Request and URI Template arguments for processing.
- Workflow Author assigns a response to the response argument. For simple cases just assign whatever object you want, it will become object content in the response message. For more complex cases, create a new HttpResponseMessage or HttpResponseMessage<T>
this allows you to add headers or other things to the response message.
- The host application creates an instance of an
HttpWorkflowServiceHost for a given base address and workflow definition
HttpWorkflowServiceHost then walks the activity tree of the workflow definition and builds a UriTemplateTable for all of the UriTemplates in the workflow
- The host application calls
HttpWorkflowServiceHost.Open to begin listening for requests
Runtime Request/Response handling
- WCF WebApi receives a message which is dispatched to an instance of
HttpWorkflowResource to process.
- HttpWorkflowResource matches the request to the receive activity using the URI template. If no match is found it returns a (404) Not Found error.
- HttpWorkflowResource correlates the message and loads a workflow instance or creates a new one and runs the workflow instance which will run until the
receive activity is idle with the given bookmark.
- HttpWorkflowResource resumes the bookmark
- HttpReceive gets the
IHttpWorkflowReceiveContext extension and schedules the Body ActivityFunc with the parameters. The body executes and returns.
- HttpWorkflowResource examines the response - if it is an HttpResponseMessage it returns it. Otherwise it wraps the response in a new HttpResponseMessage
and returns it. If response is null, the default behavior of WCF WebApi kicks in which is to return an empty response with a OK (200) status code.
class provides a means to create a route for requests to a virtual path to be handled by a workflow
protected void Application_Start(object sender, EventArgs e)
// Route requests to /api to the SampleResource.xaml workflow
new HttpWorkflowServiceRoute("api", Server.MapPath("~/XAML/SampleResource.xaml")));
// You can also get the activity from another source
new HttpWorkflowServiceRoute("test", GetActivityFromDatabase()));
Workflows are correlated by headers or content - see
Http Message Correlation