Finally I made it to free up some time and create a released version of the WCF Activities I have been working on for some time now. This version is fully tested and already used in multiple projects I am working on including the very demanding ones that run thousands of workflows a day!

First of all I want to thank Martijn Beenes who has been so kind to create a Setup project for me in WIX, so I can hand you a nice installer in stead of a build it yourself version. The setup will also install the sources on your machine so you can make changes if you like J

So what is in the release? Well bottom line a set of Workflow activities you can use to implement service operations using Windows Communication Foundation (WCF). The project provides a WCFInput activity where you can choose an interface and a method you want to implement in a workflow as a WCF service. You can specify certain properties on the method like IsOneWay, AsyncPattern, Action, ProtectionLevel.  The input activity will reflect on the method you select from the interface and then will generate dynamic parameters that reflect the method signature. All these parameters can be bound to the workflow so you can work there to provide an implementation of the service operation. To communicate data back to the calling client there is a WCFOutput activity. If you drag that activity to the workflow design, you have the option to select a corresponding input activity it will correlate to to send output. There you can also bind to the return value of the WCF operation. This is where you communicate the result back.

The implementation detects the type of scheduler set for the workflow and if it is the manual workflow scheduler it will asynchronously return after the WCFOutput is done. It will queue the workflow for further execution with a thread pool, so the workflow continues execution after the call is done. This provides a great mechanism to trigger multi step workflows, utilizing the power of the request thread for the handling of the WCF call and the workflow in between the Input and output activity and continuing execution after the call is done. There you can do any background processing until the workflow becomes idle again.

The WCFInput activity also adds two additional properties to the containing root workflow to set the Service namespace and the Service name. It will generate the implementation of the service calls you model in the workflow as a new class that contains the WCF attributes to expose it as a service. The class generated that implements the contract for a workflow has the naming pattern <workflowtypeName>_wcfimpl. This name you use when configuring the service for hosting in a host you like. At codeplex I provided a step-by-step guide how you can use the activities and how you can configure e.g. a web application to host your service using a .svc file.

Last thing to note is that the activities support the correlation of a subsequent call on the workflow by sending a message header when making the subsequent call. You can also find a tutorial on codeplex as to help you get started with these activities. The guide and tutorial will give you all information needed to use the activities in your project.

I hope you will enjoy them, and please if you feel something is not working correctly or you would like to see additional features add them to the issue tracker on codeplex and I will see if I can add them or fix them a.s.a.p.

Enjoy,
Marcel

CTO at Xpirit, Microsoft Regional Director, Visual studio ALM MVP, Speaker, Pluralsight Author and IT Architect Consultant