Monday, June 26, 2006
Microsoft DevDays 2006: WF Demo
I have just completed my two presentations at Microsoft DevDays 2006 in Sofia, Bulgaria. I presented SQL Server 2005 Security for Developers and a case study about Windows Workflow Foundation (WF) implementation for one of our major clients. I got quite positive feedback from the audience and some very interesting questions. I am looking forward to see the results from the feedback and the ranks of the lectors. I am definitely in the top 5 of all 30+ lectors, that’s for sure.
As promised, I am publishing all the source code for the case study that I have demoed. The prerequisites are the following:
- Windows Server 2003 SP1 or Windows XP SP2;
- Windows SharePoint Services with Service Pack 2 from here;
- .NET Framework 2.0 and Visual Studio 2005;
- Windows Workflow Foundation Runtime Components Beta 2.2 and Visual Studio 2005 Extensions for Windows Workflow Foundation Beta 2.2 from here;
- Microsoft SQL Server 2005 Developer or Express edition;
- DebugView utility from here.
The solution contains the following projects:
- Demo.Common.Sts is a SharePoint document library event handler that handles the inserts and updates of the holiday request documents in STS;
- Demo.Web.Services contains a single web service that is called by the SharePoint event handler when an insert or an update of a document occurs. It also manages the WF runtime and creates holiday request workflow instances;
- Demo.Workflow contains the holiday request WF workflow as well as the ITalkToWorkflow interface definition and implementation. The interface demonstrates the communication between the host and the WF runtime engine.
The steps to make the demo running are the following:
- Install SharePoint Services and upgrade the default STS site to ASP.NET 2.0 following the steps described in the Microsoft Support article;
- Open the solution and build it. Deploy the Demo.Common.Sts.dll assembly in the GAC;
- Open the SharePoint Central Administration tool by selecting Start->Administrative Tools->SharePoint Central Administration;
- Navigate to Virtual Server Configuration->Configure virtual server settings;
- Click on the web site that runs STS (Default Web Site if the default web site is extended by STS);
- Navigate to Virtual Server Management->Virtual server general settings;
- Make sure that the Event Handlers radio button is On;
- Open the STS team site, then go to Documents
- Create a new document library by selecting “Create Document Library”, then choosing “Document Library”;
- Specify the document library name and description;
- Press the Create button to create the library.
- Navigate to the new document library in STS and configure the Demo.Common.Site assembly as the event handler for it;
- When in the document library, choose Modify settings and columns;
- Go to General Settings->Change advanced settings;
- Specify the assembly name “Demo.Common.Sts, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=a9e51c9431eb593f”. Make sure that the full name of the assembly is correct;
- Specify the class name of the document event handler, which is Demo.Common.Sts. GenericDocEventSync;
- Update the settings by pressing OK.
- Modify the default document library template and update it with the InfoPath template from the solution directory;
- Configure the web.config of the Demo.Web.Services project and make sure that the connection string points to an existing SQL Server instance;
- Create a new database and name it WF_Persistence;
- Run the two scripts SqlPersistenceService_Schema.sql and SqlPersistenceService_Logic.sql from the WF installation directory, which by default is “C:\WINDOWS\WinFX\v3.0\Windows Workflow Foundation\SQL\EN”. This will enable the SqlWorkflowPersistenceService tracking service provider to dehydrate (persist) and hydrate WF instances in the WF_Persistence database;
To run the demo:
- Navigate to the document library in STS and press Fill Out This Form;
- InfoPath will be opened and the HolidayRequest form will be loaded;
- Fill out the form, leaving the Status field as New;
- Save the form, giving it an informational name;
- Refresh the document library in the browser and you will be able to see the new document;
- Monitor the execution of the event handler and the web service by using DebugView utility;
- Once the document is received by the WF runtime engine, it will be persisted, waiting for the manager’s answer;
- Check-out the document and edit it in InfoPath;
- Change the status from New to Rejected (or Approved);
- Save the document and then Check-in;
- Monitor the execution of the workflow, as it will go alive for a moment, it will receive the answer of the manager and will complete its execution.
Feel free to comment or ask questions with respect to the workflow demo and good luck.
Hope this helps,
- Nikola.
While I followed the installation steps I get this error at the end of step 5(after click Ok to set the event handler of the document library):
Could not report event for "DemoHolidayDoc" in "Demo.Holiday.Doc" because loading event handler assembly "Demo.Common.Sts, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=a9e51c9431eb593f" failed. File or assembly name Demo.Common.Sts, or one of its dependencies, was not found.
"Demo.Holiday.Doc" is the name of the document library in my sharePoint site.
Demo.Common.Sts is in "c:\windows\assembly\".
What am I missing?
Regards,
Georgi.
Try using the Fuslogvw.exe tool from the .NET framework and check which assembly bindings fail. It will probably give you ideas of what might be wrong with your setup/configuration.
Hope this helps,
- Nikola
<< Home


