Create a WorkflowService which uses HTTP instead of SOAP activation
| Priority || Description || Notes |
| 0 || Receive HTTP Messages and deliver them to workflow activities || The HttpReceive activity supports request/response with HTTP messaging |
| 0 || Support URI Templates || The HttpReceive activity uses the UriTemplate class to provide support for template matching and argument binding |
| 0 || Support All HTTP Verbs (and custom verbs) || The HttpReceive activity supports standard verbs in the drop down list, or type your own custom verb|
| 0 || 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. |
| 0 || 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 HttpWorkflowServiceRoute |
| 0 || Support Persistence and Correlation || Supports any InstanceStore and Correlation via cookies (now) and content based correlation (soon) |
| 0 || Support Durable Timers || (not supported yet) |
| 0 || Make it simple for WF developers to correctly report errors via HTTP || Exception Handling and HTTP Workflow Services |
| 1 || 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
More HttpReceive Designer
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
- The 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