An Examination of the Sample Workflow

SampleClientBig.jpg

The IWebWF framework includes a Sample workflow and a web based client to call it's methods.

WoorkflowStatus.jpg

The workflow will also show in a status screen that displays idled workflows that are persisted.

SolutionExplorer.jpg

The Solution Explorer displays the three projects that make up the IWebWF
Solution:
  • IWebWF (website) - This is the project that is included in the install version of IWebWF. This project contains the output from the IWebCore and the SampleWorkflow project.
  • IWebCore - This project contains classes and methods that allow access to the IWebWF General Settings. This class can be referenced by workflow projects (it is referenced by the SampleWorkflow project) to allow access to Email methods and user accounts.
  • SampleWorkflow - This is the sample windows workflow project

SampleWorkflow_small.jpg

The SampleWorkflow project is composed of two main files:
  • ISampleRequest.cs - This is an interface that defines the web methods that are exposed by the workflow.
  • Workflow.cs - This class contains the workflow design and layout and the associated code.

ISampleRequest.cs

This class contains the following code:

    public interface ISampleRequest
    {
        Guid StartWorkflow(string UserName, string Password);

        bool ChangeStatus(string UserName, string Password, string NewStatus);

        String GetStatus(string UserName, string Password);

        void StopWorkflow(string UserName, string Password);
    }

This simply defines the web methods that will be exposed by the workflow.

These methods will be implemented by code in the Workflow.cs file.

Workflow design

The Workflow.cs contains the following workflow design:

worflowdesign.jpg

Hosting the workflow / The Sample Client / Security

iwebwebsitehosting.jpg

The sample workflow is compiled into SampleWorkflow.dll. It is placed in the bin folder of the IWebWF website.

The SampleWorkflow.asmx file is placed in the Webservice directory. This file is used as the entry point to call the SampleWorkflow.

sampleclientsmall2.jpg

The sample client uses web services to call the SampleWorkflow that is being hosted in the website.

The sample client does not require a password, but the password of the currently logged in user is passed to the StartWorkflow method.

        protected void btnCreateSampleRequest_Click(object sender, EventArgs e)
        {
            // Reference to the web service
            Workflow_WebService SampleClient = new Workflow_WebService();
            // Enable cookies
            SampleClient.CookieContainer = new System.Net.CookieContainer();
            // Set the address to the web service
            SampleClient.Url = txtWebserviceURL.Text.Trim();
            // Call the method to start the workflow
            Guid WorkflowInstanceID = SampleClient.StartWorkflow(UserName, Password);
            // Get the WorkflowInstanceID
            txtCurrentWorkflowID.Text = WorkflowInstanceID.ToString();

            lblWorkflowStarted.Visible = true;
        }

In the SampleWorkflow, the CheckAuthentication method is called by the StartWorkflowActivity activity:

        private void CheckAuthentication(object sender, ConditionalEventArgs e)
        {
            e.Result = (IsAuthenticated(UserName, Password));
        }

This code calls the IsAuthenticated method that uses methods in the IWebCore project to authenticate the user.

Last edited Oct 19, 2008 at 12:39 PM by adefwebserver, version 8

Comments

No comments yet.