Learning BizTalk Server 2000: Lesson 2
Igor Leybovich and Scott Woodgate
Microsoft Corporation
May 2001
Summary: The second 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, we will configure BizTalk Server to perform all the necessary tasks in a sample business scenario, and discuss basic concepts and terminology. (9 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
IntroductionWhy Use BizTalk Messaging Services?
Configuring File Receive Functions
Configuring Messaging Ports and Channels
Defining Document Specifications
Running It
Introduction
We will now review individual steps of the scenario that we set up in Lesson 1. From time to time throughout the remaining lessons, we will ask you to execute additional script files. These files make adjustments to the BizTalk Server configuration that we originally created, so we can see the results of execution of individual steps rather than the complete process that we showed in Lesson 1.
To begin, run the script file L2Prep.vbs located in the C:\LearnBizTalk\Scripts directory. This alters the configuration of BizTalk Messaging Services, so instead of delivering the document to BizTalk Orchestration, it writes it as a file that we can examine.
Figure 1 provides you with a closer look at what happens during this phase.

Figure 1. Supplier and buyer business processes
Why Use BizTalk Messaging Services?
BizTalk Messaging Services provides a simple and efficient way to pass documents between internal applications, as well as between external business partners. BizTalk Messaging Services enable you define how your documents are received, processed, and delivered to their destinations, as well as providing such essential features as validating document structure, digital signatures, encryptions, and guaranteed delivery over unreliable transports.
Configuring File Receive Functions
Suppose we need a means to take a file that was created by an internal application and get it into BizTalk Messaging Services. File Receive functions fulfill this role. One advantage of working with an output file is that an internal business application that creates this file does not need to know anything about BizTalk Server. It simply creates a file containing the document somewhere on a file system, and BizTalk Server instantly picks it up. Indeed, if you can create output files and receive input files into your existing applications, you probably will be able to use them with BizTalk Server without a single modification.
Another important aspect of using File Receive functions is that it introduces an element of asynchronous execution to your design. Asynchronous, from Greek meaning "not at the same time," pertains to processes that proceed independently of each other. Being asynchronous is very important in a distributed environment, because it allows each part in the solution to stand by itself and not be affected by the temporary unavailability of another part, whether due to failure or scheduled maintenance. For example, if you experience a brief network failure, the overall application is not affected since the documents produced by your internal business applications would simply accumulate on the hard drive. Once the network is available again, BizTalk Server picks up and processes all the files it finds in the designated directory. You could also easily add more BizTalk Servers and configure them to process documents from the same directory, should you generate more documents than could be processed by one server with an acceptable speed.
To look at how we configured the File Receive function, open the BizTalk Server Administration application, expand BizTalk Server Group, expand Receive Functions, right-click ReceiveReq, and then click Properties. You can see that this function was configured as a File Receive function, and on the Services tab you can see where we identified the directory to poll for files and the file types to pick up, as shown in Figure 2.

Figure 2. A configured File Receive function
On the Advanced tab, we instructed BizTalk Server where to deliver the files it finds. On that tab, we also identified a channel, called Channel To Approval, to which the receive function will pass the documents. Channels, as well as related messaging ports, are new concepts. We will discuss them next.
File Receive functions are not the only way to submit documents to BizTalk Server. You can also receive documents from Message Queuing, through e-mail (SMTP), and from Web pages (HTTP/HTTPS), as well as from COM from within your own applications.
Configuring Messaging Ports and Channels
To deliver the document to a destination, you must define the destination in BizTalk Messaging Services. Destinations are known in BizTalk Messaging Services as messaging ports. A messaging port also contains a set of properties with which you can direct how documents are secured and transported to their destination, be it an internal application or an external business partner.
You can group messaging ports into distribution lists to send the same document to several different destinations, whether they are business partners or internal applications.
Let's take a look at the messaging port, which we called Req Approval Port, that we defined when you ran the setup script. This is a messaging port to an internal application that represents Northwind's business process for requisition approval. Open BizTalk Messaging Manager, click Messaging ports, and then click Search Now. In the right pane, double-click Req Approval Port to edit it. Click Next. The Destination Application dialog box shows that this document will be delivered to file, as shown in Figure 3.

Figure 3. The Messaging Port Properties dialog box
In Lesson 1, this messaging port delivered the message to an XLANG schedule within BizTalk Orchestration Services, which implements the approval process. (We will discuss BizTalk Orchestration Services in more detail in the next lesson.) We have deliberately changed this by running the script at the start of the lesson so you can see the output.
Instead of delivering a document to BizTalk Orchestration Services or a File, you can configure a messaging port to deliver documents using any of the supported protocols, which include HTTP(S), SMTP, Message Queuing, and custom application integration components (AICs).
You can also configure a messaging port with extra security features by optionally encrypting your document and/or adding a digital signature to it.
Now let's define a channel through which this document is delivered. A channel contains a set of properties, which identifies the source organization or application that has sent out the document. The channel also defines the specific steps that are performed by BizTalk Server before the document is delivered to the associated messaging port. Take a look at the relationship between receive functions, channels, and messaging ports.

Figure 4. Relationship between receive functions, channels, and messaging ports
To see how we've set up the channel that delivers requisitions to Northwind's approval process, open BizTalk Messaging Manager, click Channels, and then click Search Now. In the right pane, double-click Channel To Approval to edit it. Click Next. Alternatively, you can right-click the messaging port Req To Approval and choose the menu option Find Channels to show you all the channels, or show only Channel To Approval connected to the Req To Approval. In the dialog boxes that follow, we have defined that the documents to be processed by this channel will originate from an internal purchasing application, and that these documents will be in a format described by a document definition named Northwind Req.

Figure 5. The Channel Properties dialog box
You can optionally instruct a channel to translate a document from one document definition into another, as well as specify which information must be logged for tracking purposes as the channel delivers documents. Lesson 5 contains more about document translation.
So what is this document definition, and how do we create one?
Defining Document Specifications
In the first lesson, we explained how important it is for businesses to use the same language for describing the documents that are passed between them. This common language is XML. Although XML documents are stored in a text format and can be opened with any text editor, creating or modifying them manually is a very tedious and error-prone process. Fortunately, BizTalk Server provides an excellent tool called BizTalk Editor that greatly simplifies this task. All of our XML specifications are stored in the C:\LearnBizTalk\Documents directory. Open the NorthwindReq.xml file located in this directory in BizTalk Editor and it will appear as shown here.

Figure 6. The BizTalk Editor window
BizTalk Editor provides an easy way to visualize a document's format, to define data types for individual elements and attributes, to define which data fields are required and which are optional, and much more. This particular document schema represents an XML document, but the Editor looks similar for EDI and Flat-file schemas.
Since you can work with the specification on any workstation where you have BizTalk Editor installed, after the specification has been created it also needs to be added to the BizTalk Server WebDAV repository so the BizTalk server can retrieve it.
WebDAV (World Wide Web Distributed Authoring and Versioning) is the Internet Engineering Task Force (IETF) standard for collaborative authoring on the Web. It facilitates collaborative editing and file management between users located remotely from each other on the Internet. You can find more information regarding WebDAV on the IETF Web site at http://ietf.org/rfc/rfc2518.txt.
Creating the document definition is now simply a matter of associating a specific XML specification created in the BizTalk Editor and stored in WebDAV with a name to be used by BizTalk Server. To test this feature, in BizTalk Messaging Manager, on the File menu, click New, and then click Document Definition. Type a name for the document definition, select the Document specification check box, and then click Browse. The dialog box that appears next lets you choose any schema stored in the BizTalk Server WebDAV repository. Click OK to save the new document definition.
You can create multiple document definitions that are based on the same schema document. You can optionally define global document tracking options for each document definition that you create.
Running It
Now let's execute the part of the scenario we just reviewed. Copy the ReqToApprove.xml file from the C:\LearnBizTalk\Documents directory and paste it into the C:\LearnBizTalk\Pickup directory. The File Receive function ReceiveReq that we defined will pick up that file and deliver it to the Req Approval Port messaging port through the Channel To Approval channel. At the beginning of this lesson we ran a special script, which modified our channel and messaging port definitions. So instead of delivering the requisition document to BizTalk Orchestration Services, the messaging port simply wrote the document contents to a file called NorthwindRequisition.xml in the C:\LearnBizTalk\Output directory. Examine that file by double-clicking it to open it in Internet Explorer. You will see that it's exactly the same document which we placed in the \Pickup directory.
Perform these steps again, this time using the ReqToDecline.xml file. The file in the \Output directory will be overwritten with our newly submitted requisition.
It appears that you haven't achieved a lot with BizTalk Messaging in this lesson. We picked up a file from the file system in one directory and deposited it in another directory. Clearly there is a lot more that you can do with BizTalk Messaging Services, and now that you understand the basic concepts and terminology, we will show you some of these features.
In the next lesson, we will take a look at how Northwind's requisition approval process is defined using BizTalk Orchestration Services.