workflow and web apps
How do you go about utilizing WWF in a web application? I'm currently looking into building a workflow system for publishing web pages in a cms. I've got a basic workflow built and have been testing it using a console application. I need to port this workflow to the web application where users would interact with it using webforms instead of a console app. I'm a little confused on how this would be done in a stateless environment.
The workflow is the usual review process... a reviewer receives a notification via email that a page needs to be approved. They log into the web app and do their review and either approve or reject the page. If approved, it goes to the next reviewer in the list, if rejected the workflow is terminated and the initiator is notified.
Any help would be appreciated.
Thanks,
Phillip
The first thing one needs for any workflow to execute, is a host. The host can be easily programmed within the scope of a page by using the System.Workflow.Runtime. A State Machine Workflow would then make sense and every command (button) would become an event with every mode the page goes through as a state.
If the host concept needs to extend further from the application perspective, I would imagine we would probably use the Session as the host with persisitence across page round trips. It would mean that each post back of a page would be an event for the State Machine and each page a State. This is pure theory and concept and does not constitute an implementation.
I think dcumg is having a very good point. Continuing his observation I would add that the only apparent benefit in this case would be to have a view (integrated designer) of the whole process and the current state highlighted. Well, does this help? Is the view of the state machine clear enough for humans? Not like a sequence workflow could be, for sure. Besides, the most important information is missing from this kind of views: how many time the workflow cycled trough states to get to the current one? And how many steps are required to reach to the end point?
Looking at your requirements again, and assuming that you have already built a sequential workflow, but as a console application, probably all you need to do is take the same workflow and implement it as a web service. The web service acts as the host and as Kamran pointed you could provide persistence service to persist the state in may be a SQL database. That way a ASP.NET web page can post the approval/denial events to the workflow directly via a web method call.
Niros wrote: |
| I think dcumg is having a very good point. Continuing his observation I would add that the only apparent benefit in this case would be to have a view (integrated designer) of the whole process and the current state highlighted. Well, does this help? Is the view of the state machine clear enough for humans? Not like a sequence workflow could be, for sure. Besides, the most important information is missing from this kind of views: how many time the workflow cycled trough states to get to the current one? And how many steps are required to reach to the end point? |
|
This is a bit off-topic from the original thread, but a tracking service can actually capture the events (called Track points) for the execution of an activity. So in the case where a state activity executes numerous times, this information can be captured by the tracking service. There's actually an example application in the SDK that shows how the SQL Tracking Service and database could be used with the Workflow Design control to show the visual execution of a workflow. This is just an example and not part of the core technology, but it can give you some ideas of what is possible. The sample is called Workflow Monitor and the information in the documentation is located here.
James Conard
Architect Evangelist - Windows Workflow Foundation
http://www.WindowsWorkflow.net
http://blogs.msdn.com/jamescon