none
Difference between Workflow service and a regular WCF Service

    Question

  • What is the difference between WF4 service and WCF service?

    Can we implement the same scenerio in both services?

    Which one is the best?

     


    Saeed
    Wednesday, July 28, 2010 10:32 AM

Answers

  • Hi, Saeed

    WF4 application is actually a .net application. You can see WF4 service as a special WCF service. it is a WCF service that host a .net application(WF4 application).

    WF4 provide a WorkflowServiceHost to publish WF4 as a WCF service, inside the WorkflowServiceHost, this class actually uses WorkflowApplication class to run a workflow instance and then publish this Workflow as a wcf service by generating. WCF address endpoint,binding type and some contracts.  

    So, You can create your own Workflow service host to publish your own workflow as a service even a RESTful service. but it requires some additional coding.

    Regards
    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support. My Blog:http://xhinker.com
    Tuesday, August 03, 2010 9:31 AM

All replies

  • With WCF, we can create services that can accept leverage HTTP POST and simple accept an XElement as it's parameter. I'd like to do something similar with a workflow service so that I can use jQuery to post an xml infoset to a service, have it run through a bunch of rules and then return an xml infoset.

    With a WCF service, I can simply decorate the operation w/ WebInvoke and go on my merry way. Is it possible to use WebInvoke w/ a Workflow Service and if so, how should I go about?


    Blades Don't Need Reloading...
    Tuesday, July 27, 2010 5:03 PM
  • There are several differences between your average WCF Service and a Workflow Service. Here are a few of them:

    • Workflow services use Receive and Send activities as the basis for being a WCF service.
    • These activities generate their own ServiceContracts so you cannot use previous developed ServiceContracts within a Workflow Service. As a result, you cannot for instance build a REST-ful workflow service as you could with just a plain WCF service.
    • Workflow Services use a special WorkflowServiceHost that has additional functionality within it to handle message dispatching to a workflow's Receive and Send activites as well as several other workflow related features.
    • WCF Services use sessions to facilitate multi-call client/sever scenarios for a service where as Workflow rely's more heavly on message correlation. WF4 has rich support for buildling flexible correlation handlers for facilitating multi-call scenarios for a workflow instance.

    Hope these help.


    Blades Don't Need Reloading...
    Thursday, July 29, 2010 2:49 PM
  • Due to the inability for a workflow service to use previously developed ServiceContracts (or at least not by using WorkflowServiceHost as it sits today), I've discovered it's not really possible to build a REST-ful workflow service because the developer can't decorate an operation with WebInvoke. Bummer.
    Blades Don't Need Reloading...
    Thursday, July 29, 2010 2:51 PM
  • Hi, Saeed

    WF4 application is actually a .net application. You can see WF4 service as a special WCF service. it is a WCF service that host a .net application(WF4 application).

    WF4 provide a WorkflowServiceHost to publish WF4 as a WCF service, inside the WorkflowServiceHost, this class actually uses WorkflowApplication class to run a workflow instance and then publish this Workflow as a wcf service by generating. WCF address endpoint,binding type and some contracts.  

    So, You can create your own Workflow service host to publish your own workflow as a service even a RESTful service. but it requires some additional coding.

    Regards
    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support. My Blog:http://xhinker.com
    Tuesday, August 03, 2010 9:31 AM
  • Andrew,

    How would you create a RESTful service w/ a workflow service?

    - James


    Blades Don't Need Reloading...
    Tuesday, August 03, 2010 2:17 PM
  • Hi, James

    For WF4, this thread would add some value to this question:
    http://social.msdn.microsoft.com/Forums/en/wfprerelease/thread/7564e490-e429-4cee-95f4-a191aecae664

    For WF3/3.5
    Some one had already done that:
    http://weblogs.asp.net/cibrax/archive/2008/10/24/rest-and-workflow-services-play-well-together.aspx
    http://weblogs.asp.net/cibrax/archive/2008/10/30/rest-and-workflow-services-play-well-together-part-ii.aspx

    Regards


    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support. My Blog:http://xhinker.com
    Tuesday, August 03, 2010 2:30 PM
  • Nice! I've been looking for something just like that for WF4. Thanks!


    Blades Don't Need Reloading...
    Tuesday, August 03, 2010 2:44 PM