Learning BizTalk Server 2000: Lesson 7
Igor Leybovich and Scott Woodgate
Microsoft Corporation
May 2001
Summary: The final installment in a series of 7 articles designed to show you how Microsoft BizTalk Server 2000 can help your business exchange a variety of documents with business partners, as well as integrate internal business processes and applications. In this lesson, you will learn how a supplier receives a PO sent by a buyer over the Internet, processes it using BizTalk Messaging Services and BizTalk Orchestration Services, generates the invoice, and sends it back. You will also see how the buyer receives the invoice and stores it, thus completing the buyer-supplier communications example. (7 printed pages)
NoteYou will need to install Microsoft® BizTalk™ Server 2000 in order to complete this lesson. Before you install Microsoft BizTalk Server, make sure you have read the Readme.htm and Installation Guide.htm documents, paying particular attention to the following important prerequisites:
- You must have a computer running Microsoft Windows® 2000 with Service Pack 1 or above (Professional or Server both work), including IIS and MSMQ services, and an account with administrative rights on that computer.
- You must have Microsoft SQL Server™ 7.0 with Service Pack 2 or above (you can install SQL Server Desktop Edition if you choose to run everything on a single workstation running Windows 2000 Professional) and password for the "sa" account. If you use SQL Server 2000, you must configure it for "mixed" security mode in the install wizards that is not the default.
- Microsoft Visio® 2000 SR1 Standard or above must be installed on the computer where you are installing BizTalk Server.
- In Internet Services Manager, turn off the Enable authoring option on the Server Extensions tab of the Default Web Site.
Also, in order to execute the scripts for these lessons, you need to install the MSMQ component of Windows 2000.
Contents
IntroductionWhat's in the Queue
Processing the Order
Closing the Loop
Introduction
In this lesson, we will learn how Contoso receives the PO sent by Northwind over the Internet, processes this order using BizTalk Messaging Services and BizTalk Orchestration Services, generates the invoice, and sends it back to Northwind. Finally, we will review how Northwind receives the invoice and stores it, thus completing our example of the buyer-supplier communications.
Figure 1 shows the remaining parts of the scenario.

Figure 1. Buyer-supplier communications diagram
Let’s take a closer look at what happens in each individual step.
What’s in the Queue?
Lesson 6 ended when a PO document received by an ASP script on Contoso’s side was delivered to a message queue. We also learned about configuring a Message Queuing receive function, which monitors the message queue for any incoming messages and delivers them to BizTalk Orchestration Services. We chose to store incoming POs on a message queue, rather than storing them in files, because message queue offers an additional level of reliability by supporting transactions, a feature not found in a file system.
After the Message Queuing receive function takes the document off the queue, it submits the document to the channel, which in turn delivers it to the messaging port we created for Contoso’s business process. This port is configured to transport the document to an XLANG schedule, indicating that it will start an XLANG schedule to run Contoso’s business process in a manner similar to the Requisition document that was submitted to Northwind’s XLANG schedule in Lesson 4.
Processing the Order
The actual work that has to be completed to process a real PO will of course vary from one company to the next. To simplify our scenario, we defined a single Action shape within Contoso’s XLANG schedule drawing, which represented all of the actions that would be normally performed by a real-world supplier, such as checking inventory levels, communicating shipping instructions to the warehouse, and so on.
The implementation for the Action shape is a simple Script Component that displays a message box, which advises the user of a PO that is being processed. Here again, we used Script Component Wizard to assist us in the creation of this component.
Of course, in a production system, no message boxes should ever be displayed by any BizTalk Orchestration Services components, for the simple reason that there will not be a user currently logged on at the server to observe and acknowledge these messages. Until a user dismisses the message box, the schedule will not continue to run, potentially causing undesirable effects. A more appropriate means of communication is by sending e-mail messages, or by writing Windows Event Log entries that could in turn trigger other actions.
The BizTalk Orchestration process for Contoso is represented in Figure 2.

Figure 2. Business process for Contoso in BizTalk Orchestration Designer
Once again, in this XLANG schedule drawing, we utilized the XML Communication Wizard to extract individual values of fields, in this case PONumber and Generated fields, from the PO document and pass them to the Script Component as parameters without having to write any code. This is similar to the way we extracted the value of the RequisitionTotal field from the Requisition document in Lesson 4.
On the Data page of the XLANG schedule drawing, we connected these fields to input parameters of the DoWork method of the Script component. As you can see in Figure 3, the entire PO is not passed to the component, just the two individual fields that we extracted.

Figure 3. Fields from the PO document passed to Windows Script Component
Finally, after the user clicks OK on the message box presented by the Script Component, the XLANG schedule sends the PO back to BizTalk Messaging Services, where it is transformed into an invoice by using another map, and then sent to Northwind by using the HTTP transport—the same transport Northwind used to send POs to Contoso.
Once an ASP script on Northwind’s side receives the invoice document, it stores the invoice as a file for further processing. In a real-world scenario, such processing could include matching the invoice with the original requisition and PO, updating internal systems with invoice information, and so on.
Closing the Loop
Congratulations! Over the course of these 7 lessons you have been involved in the creation of a fully functional, albeit simple, integration scenario between a buyer and a supplier. Let’s test our final application.
Before we begin, we must execute one last script, L7Post.vbs, located in C:\LearnBizTalk\Scripts\ directory. This script will re-enable the Message Queuing receive function we temporarily suspended in Lesson 6 so that we could see the messages posted to the queue.
Start by copying the requisition document, ReqToApprove.xml, from the C:\LearnBizTalk\Documents directory and, as we did earlier, pasting in into the C:\LearnBizTalk\Pickup directory.
Let’s outline the complete flow for this scenario:
- The File Receive function at Northwind reads the file ‘ReqToApprove.xml’ that was placed in a Pickup directory and sends it to the Northwind’s BizTalk Orchestration Services process by using BizTalk Messaging Services.
- The XLANG schedule extracts the value of the RequisitionTotal field, and because it is less than $1,000, it approves the requisition by sending it back to BizTalk Messaging Services.
- BizTalk Messaging Services receives the requisition from BizTalk Orchestration Services and uses a map to create a PO document. This document is then transmitted to Contoso using the industry standard HTTP protocol.
- An ASP script on Contoso’s side receives the transmission, extracts the document, and posts it as a message to a private message queue.
- A Message Queuing receive function finds a new document on the queue, retrieves it, and uses BizTalk Messaging Services to send it to BizTalk Orchestration Services for processing.
- The XLANG schedule extracts the values of PONumber and Generated fields and invokes a method on a Script Component, which simply alerts the user of the arrival of the PO by displaying a message box.
- The XLANG schedule sends the PO back to the BizTalk Messaging Services for invoice generation.
- BizTalk Messaging Services applies a map to turn the PO into an invoice and transmits it to Northwind by using the HTTP protocol.
- An ASP script at Northwind accepts the transmission, extracts the document and saves it as the file C:\LearnBizTalk\Output\ContosoInvoice.xml.
- This completes the process of integrating these two businesses.
Figure 4 represents the complete process by showing the two XLANG schedules, BizTalk Messaging Services, Receive Functions, ASP pages and queues and how they all interact:

Figure 4. End-to-end buyer/supplier transaction process
If you now open the C:\LearnBizTalk\Output directory, you will find a file named ContosoInvoice.xml containing the invoice that Northwind received from Contoso and stored in this file.
To undo the configuration changes made to your BizTalk Server installation by the scripts you ran during these lessons, execute Cleanup.vbs script located in C:\LearnBizTalk\Scripts\ directory. After the script completes, which will be indicated by a message box, you can safely remove the C:\LearnBizTalk directory and all the files it contains.
We hope these lessons have helped you better understand Microsoft BizTalk Server and shown you how BizTalk Server can significantly reduce the amount of work required to integrate businesses and business processes. You can learn more about the product on the Web at http://www.microsoft.com/biztalk, where you will find technical product information, white papers, training and events, and third-party offerings.
Also, use the BizTalk Server Tutorial found in the BizTalk Server documentation. The tutorial works through a more complex scenario than the one we presented in these lessons, and is a useful next step.