WF4 calling WCF Service

1k views Asked by At

I'm having a problem trying to get a workflow (WF4) to call a long running WCF service and then resume processing when the WCF service completes. The diagram below gives a rough outline of what I'm trying to achieve. If you could point me at any samples that demonstrate this scenario (or something very similar) it would be greatly appreciated. For info, I've seen plenty WF to WF examples that didn't really help.

enter image description here

1

There are 1 answers

6
tom redfern On

Have you considered correlation? Is this handled for you by WF4? in WF3 this was not offered out of the box. It meant that if you sent a request out of a long running service WF3 would have no idea which instance of the workflow to route response messages to.

Without correlation the callback from WCF will not be routed to the "waiting" workflow instance.

UPDATE

Are you writing the correlation token into the callback message?

UPDATE

Sorry I don't have examples as I am not a WF4 user. I had to implement correlation into WF3 because it did not offer the feature. To do this I created a look up service which mapped correlation values to workflow instance guids, and inbound calls could then target specific instances via the wsHttpContextBinding.

But WF4 enables you to initialize and follow correlation on every send and receive-based activity. You can read about this here:

http://blogs.msdn.com/b/endpoint/archive/2010/01/04/what-s-a-correlation-and-why-do-i-want-to-initialize-it.aspx

http://msdn.microsoft.com/en-us/library/ee358755(VS.100).aspx