What you want to see on DotNetFunda.com ?
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 2247 |  Welcome, Guest!   Register  Login
Home > Articles > WWF > Workflow Foundation 4.0 - WCF Integration

Workflow Foundation 4.0 - WCF Integration

2 vote(s)
Rating: 5 out of 5
Article posted by Ambily.raj on 1/6/2011 | Views: 9418 | Category: WWF | Level: Intermediate | Points: 250 red flag


Workflow Foundation 4.0 is integrated with WCF and WPF. WF 4.0 uses WPF for activity designers and gives a very good support for custom activity designers with full WPF functionality. In this article we will look into the WCF integration to WF4.0.

 

WCF Integration

When we create a new project, under the workflow project templates, we have the option to select the WCF Workflow Service Application.



 
Once, we create a WCF Workflow Service application, it will create a default WCF integrated workflow. Note that the extension of our new workflow file is not .xaml, it is .xamlx.

The default WCF workflow will look like


Custom WCF workflow

Now, let us add our own custom FlowChart workflow to the WCF workflow.

  1. Drag and drop a receive activity
  2. Specify the OperationName, which will act as the WCF operation or method name.
  3. Set the CanCreateInstance property of the Receive activity. For running the workflow as WCF service, the current operation should be marked as CanCreateInstance=true.

        

    4. Click on the Define clause against the Content. The Content Definition window will open. Define your method    parameters here. In our sample, I defined a variable called Name, which I am passing to the operation GetMessage.

 

5. Now right click on the Receive activity and select Create SendReply option.

 
This will create the corresponding SendReply activity. Also, workflow will add a new variable for correlating both Receive and Send activities and will link both the activities. SendReply will act as the method which sends the result to the caller.

6. Again, click on the Define clause next to the Content of SendReply activity and define the result. Here I specified a message concatenating my input Name. 


 

7. Added one Assign activity in between the Receive and Send to manipulate our data. Now, our Custom workflow is ready.

 

 

 

8. Let us verify it using the WCF Test client.
Here I passed the value Susan to Name parameter and observed the result as "Hello Mr/Ms. Susan". “Mr/Ms.” Clause is added to the Name by the Assign activity and the Hello is added by the Send activity.

 

 

Host Application

Now, let us see, how we can use the workflow in a host application. Add the WCF workflow reference as the service reference to the host application. We can create the service client object and call the operation just like any other WCF service.

 

static void Main(string[] args)

        {

            ServiceReference1.Service1Client obj = new ServiceReference1.Service1Client();

            string name="Susan";

            obj.GetMessage(ref name);

            Console.WriteLine(name);

 

            Console.Read();

        }

Result

Also, just like any other WCF service, we can browse the WCF workflow in browser.

Conclusion

Here, we discussed about the WCF integration with workflow foundation 4.0, how we can test a WCF workflow using WCF Test client and how we can call the WCF workflow from a host application.

 

If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Page copy protected against web site content infringement by Copyscape
Found interesting? Add this to:



Please Sign In to vote for this post.

About Ambily KK

Experience:9 year(s)
Home page:http://ambilykk.com/
Member since:Tuesday, May 18, 2010
Level:Silver
Status: [Member] [Microsoft_MVP] [MVP]
Biography:I have over 9 years of experience working on Microsoft Technologies. I am carrying the passion on Microsoft technologies specifically on web technologies such as ASP .Net and Ajax. My interests also include Office Open XML, Azure, Visual Studio 2010. Technology adoption and learning is my key strength and technology sharing is my passion.
 Responses
Posted by: Karthikanbarasan | Posted on: 09 Jan 2011 11:17:45 PM | Points: 25

Hi Ambily,

Thanks for this wonderful article... can you help me on how to get started with WWF concepts since im new to this...

Thanks in advance

Posted by: Ambily.raj | Posted on: 10 Jan 2011 01:36:10 AM | Points: 25


You can refer the WF4.0 introduction Lessons from http://channel9.msdn.com/learn/courses/VS2010/WCFWF/IntroToWF/

Thanks
Ambily

Posted by: Karthikanbarasan | Posted on: 10 Jan 2011 04:08:10 AM | Points: 25

Thanks a lot

>> Write Response - Respond to this post and get points
Related Posts

Workflow Foundation 4.0 is introduced a significant amount of changes from the previous versions of the technology. We already discussed about various features of Workflow, data model and persistence. In this article we will discuss more about the host application, how we can invoke a workflow and about the various workflow application actions which we can handle in host application.

This is a nice talk between Mr. RC and Mr. Shiv about state machine work flow. RC starts talking about an order project and they end up in a nice discussion which gives us step by step approach of how to execute a state machine work flow. This article was written in a straight half & hour session so please excuse for my English as it’s my second language and for any spelling mistakes….so guys enjoy State machines.

Workflow Foundation 4.0 is introduced a significant amount of change from the previous versions of the technology. In WF4.0, we are using Extensions for communication between the host and workflow, the workflow and its child activities and between child activities. There are two types of extensions in WF4.0, in this article we will look into the normal extensions.

Workflow Foundation 4.0 has very good support for custom activity development. We can have our own custom activity with very good look and feel. When you define a custom activity, one of the main requirements is how to manage the associated properties in the property grid.

Workflow Foundation 4.0 is introduced a significant amount of change from the previous versions of the technology. This article will be the first in a series of articles. In this article I will be discussing about the introduction to Custom Activity Development. In next articles, I will be concentrating more on the different aspects of Custom Activity Development.

More ...
About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/25/2013 8:33:56 PM