DOC

COMHOL06 - Workflow and Web Services

By Gail Perkins,2014-09-09 15:50
8 views 0
COMHOL06 - Workflow and Web Services

Hands-On Lab

    Lab Manual

    Lab 06 Workflows and Web Services

    Please do not remove this manual from the lab

     ;

    Information in this document, including URL and other Internet Web site references, is subject to change without notice. This document supports a preliminary release of software that may be changed substantially prior to final commercial release, and is the proprietary information of Microsoft Corporation.

    This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EITHER EXPRESS OR IMPLIED, AS TO THE INFORMATION IN THIS DOCUMENT.

    The entire risk of the use or the results from the use of this document remains with the user. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

    Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

    Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place or event is intended or should be inferred.

? 2005 Microsoft Corporation. All rights reserved.

Microsoft, MS-DOS, Windows, Windows NT, Windows Server, Visual C# and Visual Studio are either registered

    trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

    The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

     ;

Contents

    LAB 06: WORKFLOWS AND WEB SERVICES .................................................................................................. 1 Lab Objective .................................................................................................................................................. 1 Scenario ...................................................................................................................................................... 1 Exercise 1 Consuming Web Services ............................................................................................................ 3 Task 1 Setup the Visual Studio solution .................................................................................................... 3 Task 2 Add the workflow project ............................................................................................................... 4 Task 3 Add the workflow activities ............................................................................................................ 6 Task 4 Configure your host to use the ContosoWorkflows ....................................................................... 12 Task 5 Building and running the project .................................................................................................. 12 Exercise 2 Exposing workflows as web services ......................................................................................... 12 Task 1 Setting up the project .................................................................................................................. 13 Task 2 Adding the Fabrikam workflow project ......................................................................................... 13 Task 3 Authoring the Fabrikam workflow project ..................................................................................... 14 Task 4 Publishing the workflow as a web service .................................................................................... 16 Task 5 Accessing the published workflow ............................................................................................... 17 Task 6 Compiling and running the project ............................................................................................... 18 Lab Summary ................................................................................................................................................ 18 Appendix A Source code............................................................................................................................. 18 invokePOSubmissionWSFabrikam_Invoking.............................................................................................. 18

    Page i

Lab 06: Workflows and Web Services

    Windows Workflow Foundation is a workflow-based programming model that allows you to design solutions for your business processes. The Visual Studio 2005 Extensions for Windows Workflow Foundation provides visual programming tools integrated into Visual Studio 2005. A workflow is a network of activities and conditions that describe a complete business process. The workflow programming model encompasses automated information processing as well as tasks performed by people. In Visual Studio 2005, you can design workflows visually, by dragging activities from a toolbox onto a visual design area for the workflow. You can also create activities used in workflows by writing managed code, building upon integrated Windows Workflow Foundation templates.

    The Visual Studio 2005 designer for Windows Workflow Foundation is referred to as the Visual Studio workflow designer in the remainder of this document.

Estimated time to complete this lab: 60 minutes

    The project files for this lab are in the c:\Windows Workflow Foundation\Labs\Lab06 folder.

Lab Objective

    The objective of this lab is to demonstrate how to consume web services from workflows and how to expose workflows as web services. There are two exercises:

     Exercise 1: Consuming a web service from a workflow

    You will create a workflow to consume an existing web service in this exercise.

     Exercise 2: Exposing a workflow as a web service

    You will create a workflow to be exposed as a web service and your new workflow will replace

    one of the web services used in the previous exercise.

    Scenario

    Contoso, which makes its procurements from Fabrikam, has set up an internal system to accept and process Purchase Order (PO) requests and running workflows for this task. Contoso has a very simple policy to process the PO’s, if the PO total is more than $1,000 the PO is routed to Northwind, otherwise, the PO gets sent to Fabrikam to be fulfilled.

    PO has the following schema:

     PO Number

     PO Total

     Fulfiller correlation number (set by the fulfiller)

     PO history

    Page i

; History item (a new history item is added each time PO is modified or processed)

     Contact

     Status

     Time stamp

    ; PO Items

     PO Item

    o SKU

    o Amount

    o Price

    Following is the basic business process flow for the PO processing systems for two likely outcomes:

    EmployeeContoso systemFabrikam system

    Submit PO

    Process request

    Send POProcess request

    Send

    acknowledgement

    PO is accepted and will be fulfilled by Fabrikam or Northwind.

    Page 2

    EmployeeContoso systemFabrikam system

    Submit PO

    Process request

    Send PO

    Process requestSend reject

    PO is accepted, but fulfiller will not be able to fulfill it.

Exercise 1 Consuming Web Services

    In this exercise, we will develop the workflow for the heart of Contoso’s system which processes the submitted PO’s and consumes a web service that exposes Fabrikam’s or Northwind’s PO processing

    service.

    We will use the provided workflow host application and a web service that simulates the Fabrikam’s

    system.

    PO Provided

    processing Fabrikam

    workflow web service

    Exercise code

    Provided host

    application

Task 1 Setup the Visual Studio solution

    We will start with setting up the Visual Studio 2005 solution we will be using throughout the lab by

    copying the provided resources to the lab folder.

    Page 3

1. Open Windows Explorer and navigate to C:\Windows Workflow

    Foundation\Labs\Lab06\Resources

    2. Copy all of the contents of this folder, to C:\Windows Workflow Foundation\Labs\Lab06\

    3. Double click the Visual Studio solution file WebServices to open Visual Studio 2005. 4. Visual Studio 2005 opens with the solution and the following should be present in the Solution

    Explorer window:

    Fabrikam Web Service

    Northwind Web Service

    Helper project which

    contains the PO schema

     Workflow host application

    Important: The Web Services projects in the lab use the “ASP.NET Development Server”

    with the “Use Dynamic Ports” property set to “True” other than the default setting “False”

    and specific values are set for the “Port Number” properties of the projects. The environment

    this lab is run may be different on different computers, where this assumption may not be

    correct. If you observe inconsistent behavior with the web services please try changing the

    “Use Dynamic Ports” setting and/or the “Port Number” properties as a step of your

    troubleshooting process. The “Port Number” property values for the Web Service projects

    are set to the following values:

    “Port Number” property value for Fabrikam Web Service: 1582

    “Port Number” property value for Northwind Web Service: 2206