workflows just making my life easier in developing applications, i have found a good explanation of why workflow? on why workflow. WCF provide us a new option to use workflow foundation, we can expose our application logic through workflows as webservice.One of the best advantage of work flows is that it can handle asynchronous coordination in application with long running business process.
To create a workflow service project
- Start Visual Studio 2010.
- Click the File menu, select New, and then Project to display the New Project Dialog. Select Workflow from the list of installed templates and WCF Workflow Service Application from the list of project types. Name the project MyWFService and use the default location as shown in the following illustration.
when you OK you project dialog, you will find the mentioned files in the solution explorer. change name Service1.xamlx to your appropriate name.
When the project is created, the Service1.xamlx file is opened in the designer as shown in the following illustration.
As we know there are two type of workflow, Sequential Workflows and State Machine Workflows,. Well delete it by right click it. we create our own by drag our own request and response shape. BizTalk has same workflow mechanism but here in WWF 4.0 the shapes are categorical and with bit different options.
To implement the workflow serviceSelect the Toolbox tab on the left side of the screen to display the toolbox and click the pushpin to keep the window open.
Drag and drop a ReceiveAndSendReply template to the workflow designer. This creates a Sequence activity with a Receive activity followed by a SendReplyactivity as shown in the following illustration.
In the Receive activity type Calculate_Addition the textbox labeled OperationName. This defines the name of the operation the service implements.
Now we need to make check to initiate a new instance of serivce on receive shape.
With the Receive activity selected, open the pr
Right click on the receive shape and click Properties Window scroll down until you see CanCreateInstance and click the checkbox as shown in the following illustration. This setting enables the workflow service host to create a new instance of the service (if needed) when a message is received.
Now we need to create the input parameters for our input message and the output message which is also a very simple way to do. Just click on the content text box below the operation name in the receive shape.