Search

Search:

Namespace:

Search Result
.
        Dim state As New SendSomeDataState(WorkflowEnvironment.WorkflowInstanceId, theData)
.
  id = this.WorkflowInstanceId;
.

Most of the time there isn't much of a problem when developing custom activities and workflow persistence. After all when an external system send a message, the service retrieves this, extracts the WorkflowInstanceId and queue name and signals the workflow. Everything's works just fine and if the workflow runtime restarts the message received will cause the workflow to be reloaded.

.

TimerEventSubscription item = new TimerEventSubscription(WorkflowInstanceId, DateTime.UtcNow);

.
        Dim state As New SendSomeDataState(WorkflowEnvironment.WorkflowInstanceId, theData)
.
  id = this.WorkflowInstanceId;
.

So what gives? Well the WCF service needs to know which workflow the request needs to be routed to and uses the WorkflowInstanceId to do so. When you create a proxu and do the first call this WorkflowInstanceId is automatically added and resent with the next request. So we need to retrieve this WorkflowInstanceId and, when we create the second proxy object, add it again. Doing so turns out to be pretty simple and only takes a few extra lines of code:

.
        Guid instanceId = WorkflowEnvironment.WorkflowInstanceId;
.
        Guid instanceId = WorkflowEnvironment.WorkflowInstanceId;
.

Most often used from an external service called from an CallExternalMethodActivity. It provides access to the calling WorkflowInstanceId and WorkBatch.

.

Well that is because the workflow engine adds a cookie named WF_WorkflowInstanceId to the response used to connect the second call to the same workflow. Alright the solution is simple; add the following to the web service before the first call: