index > Windows Workflow Foundation > Implement custom correlation with Workflow published as Web Servi...

Implement custom correlation with Workflow published as Web Servi...

Hi

I know that workflows published as Webservices use the asp.net session as default correlation for the workflow instances. This is OK but not what I need (I Think at least)

I have a WinForm GUI that needs to call this Workflow Web Service with delayed intervals like Create Booking, Confirm booking.

So I need to make sure that I call the right workflow instance on the Workflow Webservice when the based on eg. a dropdown box with workflow instaces.

So how do I do this Custom correlation on web services. http://msdn.microsoft.com/msdnmag/issues/06/04/CuttingEdge/default.aspx talks about a HTTP Module takes care of the Session => Workflow instance mapping. Do i need to make such a HTTP module my self?

If yes, how do I do that?, and if no, where should I look then?

Regards
Anders Jacobsen

anderskj1

Ok. I have looked a little further and can see that WWF by default adds a HttpModule called WorkflowWebHostingModule.

I have looked at this with Reflector and can see it extracts the wf instance id from the cookie and add it like this:

HttpContext.Current.Items.Add("__WorkflowInstanceId__", new Guid(cookie1.Value));

Would it be correct to implement my own HttpModule and replace it with the default WorkflowWebHostingModule?

My new idea is to add the workflow instance id in the SOAP Header in the web service request and do something like this on every request

private void OnAcquireRequestState(object sender, EventArgs e)
{
string guidid = MyCustomMethodThatCanExtractMyWorkflowIdFromSoapheader();

HttpContext.Current.Items.Add("__WorkflowInstanceId__", new Guid(guidid));
}

Is this all wrong? If not. How do I extract that Workflow id in the HttpModule? Can I access it there?

Looking forward to hear from you guys.

Thanks
Anders

anderskj1

I'm not in a place to say that it is supported, but it works. :)

I've done similar things using data from the message body itself and placed the id in that context item.

Matt




See What You Can Learn -- http://www.pluralsight.com/courses/IntroducingWF.aspx
Matt Milner - Pluralsight
reply 3

You can use google to search for other answers

 

More Articles

• Validate control entrys like TextBox.Text in a Rulset
• UnloadOnIdle no longer works in Web.Config.
• BUG?: Office Tools in Workflow Activity
• Problems with WaitForxxx activities
• Changing which workflow items are available when modifying at run...
• Questions on workflow types
• Compilation Failed error...very generic...
• Newbie: Transistion lines not displayed in Designer & Layout
• How to determine state of state workflow?
• Problems with the rules expressions binding when using the GUI.
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Create new condition rule from the desig
• Jon, quick question on Workflow Designer
• Replicator Nested inside While Loop
• output parameters on a workflow hosted o
• Accessing Database from Property designers
• Beta 2.2 Error loading workflow
• MSI : How to store the value returned by
• WF Beta 2 and February WinFX CTP Compati
• StateMachine receiving events too fast?
• WinFx Installtion problem
• State Machine Exception Handling
• Activity custom drawing does not work
• Accessing properties of the Host from wi
• Hosting of a Workflow in WCF
• About the SqlStatePersistenceService?

Hot Articles

• Designer customization
• detecting workflow runtime running in an
• HUman Interaction Sample
• "The proper type library could not
• Hosting Workflow Runtime
• Uninstalling WWF Runtime Components Beta
• Problem in Statemachine
• Deriving Workflow classes...
• Workflow Runtime and Pooling
• Beta2: String-Properties in Custom Activ
• WF instance persistence
• workflowWebRequestContext.current is n
• How to persist a workflow
• lab01 task02 unable to locate ExpenseLoc
• Beta 2 Installation Problems (Package Lo

Recommend Articles

• why are all the designers internal sealed?
• Beta 2 SDK Samples - HelpDesk Web App
• Create WorkFlow Through XML
• Can not debug project after installing f
• User Interface to change rules
• Is it similar to BPEL engine?
• Inheriting from SequentialWorkflow
• Binding an property of activity to a pro
• WF Deployment in SharePoint Portal 2007
• Activate on External Event
• Rasing an event on HandleExternalEvent a
• Request: Visual Designer walkthrough web
• support of login-based rss-feeds?
• Questions on workflow types
• add child activities to a Replicator Act