Let this B2B e-commerce solution do the talking for your online business

usiness-to-business (B2B) e-commerce lets companies do business over the Internet without manual processes. Frequently, companies doing business use different applications and document formats, and integrating applications that use different data structures makes building a B2B e-commerce system a challenge. Traditionally, large companies have used EDI document standards to implement business application integration and trading. However, EDI is costly to implement, and few small to midsized companies can afford this solution.

To tackle the application integration problem and minimize the cost of developing a B2B e-commerce system, the IT industry is considering the World Wide Web Consortium's (W3C's) XML as the standard language for B2B e-commerce data. XML is free, easy to use, and supports data description for any application and platform. When two trading partners use the same XML document specification to exchange information, their XML-enabled applications can receive and handle data without manual data transformation and entry. (For more information about XML, see "Related Articles in Previous Issues," page 94.)

Several vendors, including IBM, SoftQuad, and Microsoft, offer XML-based B2B e-commerce applications. In 1999, Microsoft announced the development of its XML-based B2B e-commerce solution, code-named the BizTalk Initiative. In 2000, Microsoft released BizTalk Framework and BizTalk Server (BTS) 2000, two of the BizTalk Initiative's main building blocks. BizTalk Framework is a technical specification that defines BizTalk's architecture and message structure. BTS 2000 is a server product that integrates applications and automates business processes by automatically routing and transforming documents. Before you can use BizTalk to give your e-commerce business a voice, you must understand the components of this solution.

BizTalk Framework
In January, Microsoft released "BizTalk Framework 1.0a Independent Document Specification," which describes BizTalk's architecture and message structure. (To obtain this specification, go to http://www.microsoft.com/biztalk/download/biztalkframework1a.doc.) As Figure 1 shows, in a BizTalk-based B2B e-commerce system, trading partners use BizTalk servers to exchange business documents. (A third-party software vendor can develop a version of BizTalk Server as long as the version supports the BizTalk Framework.) When a business event occurs in the source organization, the source application uses the BizTalk schema that corresponds with that business event to generate an XML-based business document. For example, when the source organization wants to order equipment from the destination organization, the source organization's accounting application generates a purchase order according to a purchase order schema. The source application sends the document to the source BizTalk server, which constructs a BizTalk message and sends it to the destination organization's BizTalk server. The destination organization's BizTalk server uses the corresponding schemas to validate the received message and send the document to the destination application for business data processing.

A BizTalk schema is a BizTalk-specific XML schema that defines the vocabulary that BizTalk uses to describe the content and structure of a business document. Trading partners must use the same schema to submit and receive documents. Microsoft uses a Web site, http:// www.biztalk.org, as a central repository that stores and publishes XML schemas for BizTalk documents. Any organization can participate in defining an XML schema for a specific type of business document and publish it on the BizTalk Web site for public use. To find a specific schema in BizTalk's schema library, you can search by an industry category or keyword, then download the schemas you need.

As Figure 2 shows, the structure of a BizTalk message consists of a transport envelope and a BizTalk document. The transport envelope specifies the transport protocol that the BizTalk server uses to deliver the BizTalk message. However, in the BizTalk Framework specification, Microsoft didn't predefine a transport service for BizTalk messages. The transport service depends on the implementation of the BizTalk server. For example, BTS 2000 supports HTTP, HTTP over Secure Sockets Layer (HTTPS), FTP, SMTP, Microsoft Message Queue Server (MSMQ), fax, and Application Integration Components (AICs) for transport services. (An AIC is a COM component that integrates an application with BTS 2000 based on your business information exchange needs.)

A BizTalk document is a well-formed XML document, which always begins with an XML tag a BizTalk namespace reference> (the namespace reference is a variable that will change for each organization) and ends with the XML tag . Inside these tags are a document header and a document body. The document header contains delivery information and a document manifest. The delivery information provides destination and source addresses, the time that the source organization sent the message, and the message subject. (These fields are similar to the To, From, Time, and Subject fields in an email message header.) The sending and receiving BizTalk servers can use the delivery information for message routing. The document manifest describes what the BizTalk document is about (e.g., a purchase order). The document manifest can also include a message attachment in a file (e.g., a company logo image). The document body contains one or more business documents that provide business transaction information such as the quantity, equipment, price, and shipping address in a purchase order. The XML tags in Figure 2 show the hierarchical relationship of the main tags (aka BizTags) in a BizTalk message.

BTS 2000
BTS 2000 is Microsoft's implementation of the BizTalk server function necessary for the BizTalk Framework. In April 2000, Microsoft released BTS 2000 Technology Preview, which software developers can use to test BTS's functionality before the server's beta and formal release later this year. You can download this preview from Microsoft's Web site (http://www .microsoft.com/biztalkserver/).

Figure 3 shows how BTS 2000's components work together. BTS receives, validates, transforms, and delivers documents and ensures document integrity and security. An inbound agreement and an outbound agreement define the rules about how organizations exchange BTS documents. The agreement includes required information about the source and destination organizations, document specification, and the transport service configuration, and optional information about the document envelope and the document's security setting. For example, suppose you're a supplier who wants to use BTS to accept purchase orders from your customers and send the purchase orders to an internal accounting application. You can use BTS's BizTalk Management Desk to define an inbound agreement to receive the purchase orders and an outbound agreement to deliver the purchase orders to an accounting application. If you want to reply to customers by sending order confirmations and invoices, you need to set up another inbound agreement to receive the confirmations and invoices from an internal application and another outbound agreement to send them to customers. Figure 4 shows a BizTalk Management Desk inbound agreement.

You can define many inbound and outbound agreements in BTS, and you can reuse the agreements for different document exchanges. As Figure 3 shows, pipelines link the related inbound and outbound agreements for a specific document exchange flow and represent the information that BTS uses to receive incoming documents, perform desired actions on the documents, and send the documents to their destinations. You use BizTalk Management Desk to set up a pipeline.

To recognize and validate a document when it arrives, BTS uses a document definition, which you specify for each of the documents you want to exchange with your trading partners. BTS provides several ready-to-use document definitions, but these definitions might not meet your needs. BizTalk Editor lets you create a document definition by importing an available XML schema from an XML schema library (e.g., the BizTalk schema library) or defining a new definition. (However, BTS Technology Preview accepts only BizTalk-specific XML schemas. The final version of BTS might accept XML schemas from other XML organizations, such as xml.org.) BizTalk Editor's GUI lets you easily define a document definition's records and fields. Figure 5 shows a purchase order document definition in BizTalk Editor. BTS supports not only XML documents but also EDI documents in ANSI X12 and EDIFACT formats and text or delimited flat files. Thus, BizTalk Editor also lets you generate EDI document definitions.

The document definitions that you set up for an inbound document and its related outbound document can vary. For example, suppose you set up an XML inbound document but its related outbound document has to be an EDI document because the application that processes the document understands only EDI. In this case, BTS needs to transform the document from XML to EDI. BizTalk Mapper lets you define a transformation map. In BizTalk Mapper's easy-to-use interface, you can map two records or fields in two document structures by connecting them with a line, as Figure 6 shows. The interface's upper-left window shows an inbound document definition, and the upper-right window shows an outbound document definition. The grid in the middle of the interface is the design surface on which you run mapping lines. BizTalk Mapper provides several predefined formulas, called functoids, that you can use to perform a complex transformation, such as converting an integer to a string, adding two values from two source fields, and putting the result into a destination field. If you use a map in document delivery, you need to configure that document's pipeline to use the map.

A BTS group includes more than one BTS system to provide load balancing and fault tolerance. BizTalk Server Administration, a Microsoft Management Console (MMC) snap-in, lets you start and stop the BTS service, add a server to and delete a server from a BTS group, configure receive functions, and manipulate shared queues. For applications that can't use a COM interface to talk to BTS, a receive function submits the application's documents to a receive location (e.g., a file system, FTP server, or MSMQ queue), then sends the document to BTS.

BTS uses three Microsoft SQL Server databases. A BizTalk management database maintains BTS and BTS group configurations. A shared queue database stores documents that BTS is processing. And a document tracking and activity database saves information about document activities in BTS.

Configuring BTS 2000
BTS 2000 runs on Windows 2000 Server or Win2K Advanced Server. BTS 2000 clients, such as BizTalk Management Desk, BizTalk Editor, and BizTalk Mapper, run on any release of Win2K as well as on Windows NT 4.0 and Windows 98. BTS 2000 requires NTFS, Microsoft Data Access Components (MDAC) 2.5, Distributed COM (DCOM) 1.3, and Microsoft Internet Explorer (IE) 5.0. Before you install BTS 2000, you need to install SQL Server 7.0 on the same server or on a system that connects to the BTS 2000 system. (The three databases that BTS uses can even reside on separate SQL Server systems that connect to the BTS 2000 system.) All BTS servers in the same group use the same SQL Server databases. After installation, you're ready to configure BTS 2000.

The following example illustrates how to configure BTS. Suppose your company is E-Seller and your customer is E-Buyer. You want to configure BTS to use an Active Server Pages (ASP) script on the HTTP Web server to receive purchase orders and deliver the purchase orders to an internal accounting application through an AIC. In addition, you want inbound and outbound purchase orders to use the same document definition. However, according to your need and environment, you can use other protocols and mechanisms in receiving and delivering documents. For example, suppose you want to use HTTPS to secure receiving documents and MSMQ to asynchronously deliver the received documents to internal applications. To set up this BTS configuration, you must complete five major steps: define the organizations, create a document definition, define an inbound agreement, define an outbound agreement, and create a pipeline.

Define the organizations. You first need to define a default organization for BTS in BizTalk Management Desk. (The first organization you define for BTS becomes the default organization, which is usually your organization. If you define a trading partner first, that organization will be the default organization. After you've defined more than one organization, you can change the default organization. The source organization uses the defined default organization when you create new inbound or outbound agreements and pipelines.) To define a default organization, click Select in the Default Organization section in the BizTalk Management Desk interface's left pane, then click New in the resulting Select an Organization window. In the Organization Editor window that pops up, you define a new default organization by specifying an organization name, addresses (e.g., HTTP, FTP, email addresses that documents from trading partners will use), and application names in the appropriate fields. In the example, the default organization is E-Seller, the address is an HTTP address—http://biztalk.e-seller .com/ReceiveStandard.asp—and the application name is Accounting. You use the same method to define other organizations, such as your customer, E-Buyer, but don't set the other organizations as the default organization.

Create a document definition. After you and your customer have agreed on an XML schema from the BizTalk schema library (e.g., the schema called PO from the BizTalk Web site) for the purchase order document, save the schema in a directory of document definitions. For storing document definitions, BTS provides the default directory \Program Files\Microsoft BTSBizTalkServerRepository\DocSpecs. Next, use BizTalk Editor to import the schema. Select Import from the Tools menu, and choose XML-Data Schema as the import module. Find the schema file you saved and open it, then save the imported schema as a document definition file named PO Spec in the directory of document definitions.

Define an inbound agreement. Before you define an inbound agreement, copy the ReceiveStandard.asp file from \Program Files\Microsoft BizTalk Server\Samples to the Microsoft IIS default directory \Inetpub\wwwroot. BTS 2000 provides a standard ASP script to receive documents using HTTP. In the BizTalk Management Desk interface, click the leftmost toolbar icon (i.e., a page icon) and click Agreement. In the resulting Agreement Editor window, which Figure 4 shows, type the inbound agreement name in the Agreement name field (e.g., Inbound PO from E-Buyer). By default, the default organization E-Seller is the source when you create a new agreement. To change the source to E-Buyer, click the Source icon, then select E-Buyer. Agreement Editor will automatically use the default organization E-Seller as the destination after you change the source.

Next, you must specify the document definition and transport service that the agreement will use. To do so, click the Document Definition icon and select the document definition PO Spec. Click the Transport icon and specify the transport service, which uses HTTP and the address http://biztalk.e-seller.com/Receive Standard.asp. Then, save this inbound agreement as a complete agreement. The BTS preview version doesn't let you modify the source and destination after you've created and saved an agreement. (You can see that these options are shaded in Figure 4.) In addition, the preview version doesn't let you delete a saved agreement. However, I believe Microsoft will address these problems in the final release of BTS.

Define an outbound agreement. If you want to configure BTS to deliver received documents to an internal accounting application, you need to find out whether your application's vendor provides its AIC for BTS before you define an outbound agreement. For example, SAP offers SAP R/3 AIC for BTS. If your application's vendor doesn't provide an AIC for BTS, you must write an AIC for the application. (A software developer can use BTS's software development kit—SDK—and Microsoft Visual Basic— VB—or C++ to program an AIC. The BTS SDK provides a list of interfaces and objects that let the developer customize and extend BTS's functionality.) In BTS, you register the AIC from the vendor or software developer. (Microsoft's BTS manual details how to develop and register an AIC for BTS.)

The procedure to define an outbound agreement is similar to that for an inbound agreement. You name the agreement (e.g., Outbound PO to Accounting), provide the source organization (e.g., E-Seller), and type the destination (e.g., an accounting application). To define the destination, click the Destination icon, select E-Seller from the pop-up list of organizations, and select Accounting as the application. The document definition is the same PO Spec that you used for the inbound agreement, and the transport service is the AIC.

The Agreement Editor interface includes two optional icons: Envelope and Security. BTS envelopes are analogous to post-mail envelopes. You can use BizTalk Management Desk to create an envelope by specifying an envelope format, such as custom XML or X12, then associate the envelope with an agreement by clicking the Envelope icon in the Agreement Editor window. BTS uses the envelope in outbound agreements to encapsulate the outbound documents and in the inbound agreement to open the envelope that encapsulates the inbound documents. If you don't define an envelope for an agreement, BTS uses the XML format by default. The optional security setting lets BTS use encryption and digital signature functionality when sending and receiving documents.

Create a pipeline. To create a pipeline for the purchase order delivery, highlight the outbound agreement Outbound PO to Accounting on the list of agreements in the BizTalk Management Desk interface. Select New from the File menu, click Pipeline, and provide a new pipeline name (e.g., PO from E-Buyer to E-Seller's Accounting) in the resulting Pipeline Editor window, which Figure 7 shows. Click the Source icon, then select the organization E-Buyer as the source. Next, click the Inbound Document Definition icon and select the document definition PO Spec. (BTS can associate multiple document definitions with an agreement. Select only the document definition that you need for a specific document delivery flow in a pipeline.) Click the Outbound Document Definition icon, then select the same document definition PO Spec.

The pipeline in this example uses the same document definition for both inbound and outbound agreements, so you don't need to define a map for it. Otherwise, you have to use BizTalk Mapper to create a map file. To use a different transport service than the one that the outbound agreement defines, click the Override Transport Defaults icon and provide the new transport service information.

Related Articles in Previous Issues
You can obtain the following articles from Windows 2000 Magazine's Web site at http://www.win2000mag.com/.

KEN SPENCER
"Using XML to Build Internet Solutions," April 1999, InstantDoc 5056
BOB WELLS
Scripting Solutions, "Extensible Markup Language," April 2000, InstantDoc 8314
The Pipeline Editor lets you define pipeline filtering that instructs BTS to process only the received documents that meet filtering criteria (e.g., the PO payment type is a credit card). You can also configure a pipeline to tell BTS to log certain fields from inbound documents to the tracking database. Using this feature, you can track and analyze your business operation (e.g., discover the total number of orders for specific equipment).

An E-Commerce Voice
BizTalk provides a platform that enables B2B e-commerce and automatic business processes within an organization and over the Internet to other companies. After you build BizTalk-aware applications and BTS systems in your network and define documents' BizTalk XML schemas with your trading partners, BizTalk can do the talking for your e-commerce business.