Workflow + Services: WWF & WCF
Last week I gave a webcast on Workflow & Services. The official title was "Workflow, Messaging, and Services: Developing Distributed Applications with Workflows, " although I focused most of the presentation on how youl could use Windows Workflow Foundation with Windows Communication Foundation (aka "Indigo"). I showed some prototype activities for WCF that allow you to send and receive messages using WCF directly form within a workflow. These prototypes are not currently available for download and it's unlikely they will be included with the first version of Windows Workflow Foundation. The chalenge is that WWF actually releases in Q2/Q3 of 2006, before WCF and the rest of WinFx. However, the webcast and demos of the WCF activities should give you a good idea of what is possible and the type of scenarios the two technologies will enable.
So what should you do if you want to get started with WWF & WCF now? In general there are three primary ways to use WWF with WCF.
- Create generic activities - The WCF activities I demonstrated are based on the same activity component model that you can use to build custom activities. So you could absolutely build your own Send/Receive message activities - and I suspect someone already doing just that in the community. I refer to these as "generic" activities because they are generic/configurable for use with any services.
- Develop service-specific activities - If you only need to consume services, then you could rather easily create activities that are specific to the services you're using. In the Execute method for the activity implementation, just create a WCF Channel or WCF service proxy and invoke the service synchronously. This solution will work fine until you try to receive service calls into your workflow or try to support asynchronous messaging.
- Use WCF on top of WWF Local Services - Another option is to just wrap local communictions in WWF with remote communications using WCF. In this case you simply layer on WCF. I also just posted an Expense Reporting application on the WindowsWorkflow.net site (here) that demonstrates how to do this. With this scenario you can also support both receiving service calls into a workflow, by simply rasing events into the workflow.