O'Reilly logo

Microsoft Windows Workflow Foundation 4.0 Cookbook by Andrew Zhu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Receiving and replying to a WCF message in code workflow

In this task, we will create a code workflow with Receive and SendReply activities, and will run the workflow as a WCF service. This workflow will accept two integer numbers and return the addition sum to the caller. This workflow is hosted in a console application rather than IIS. We will use WCF Test Client to test the service.

How to do it...

  1. Create a workflow Console Application project:

    Create a new Workflow Console Application named ReceiveAndReplyInCode.

  2. Create the workflow in code:

    Add a new class file to the project and name it ReceiveAndReplyWorkflow.cs. Fill the file with the following code:

    using System; using System.ServiceModel.Activities; using System.Activities; using System.ServiceModel; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required