The BizTalk Editor

[Previous] [Next]

In Chapter 4, I mentioned a tool for creating schemas, XML Authority. Why do you need another tool for creating schemas? While XML Authority is great for creating any kind of schema, the BizTalk Editor is optimized to create schemas that define business documents. Also, the schemas created by the BizTalk Editor contain extra information by way of some custom Microsoft and BizTalk namespaces that simplify mapping from one format to another. Using the BizTalk Editor, you can create schemas based on industry standards or you can create specifications unique to your organization.

Exercise: Creating a Purchase Order Schema

Let's use the BizTalk Editor to create a schema that can be used with BizTalk Server 2000. Let's create our favorite business document, the purchase order. This will be a standard purchase order schema that we might use to exchange business information with our partners. This example is created with tools from the BizTalk Server 2000 Tech Preview. You should have this or a subsequent version of BizTalk Server 2000 loaded on your system to complete the exercise.

  1. First you need to load the BizTalk Editor. From the Start menu, select Programs, Microsoft BizTalk Server 2000, and then choose BizTalk Editor. You should see the screen shown in Figure 12-1.
  2. The example you see in Figure 12-1 is simple for the purpose of demonstrating the tools and how they work together. Most documents will be more complex than this—in some cases they will be much more complex. However, the concepts you'll learn here apply to all documents.

  3. On the File menu, click New to create a new document. You will see the New Document Specification dialog box. Click Blank Specification, and then click OK.
  4. click to view at full size.

    Figure 12-1. The BizTalk Editor allows you to create specifications that describe the structure of a business document.

  5. In the panel on the left-hand side of the editor, you'll see a small icon with the label Blank Specification. This is a record that will act as the root of our document. Right-click on the record, and click Rename. Call the record PurchaseOrder. Press Enter.
  6. Note that the BizTalk Editor does not use the familiar XML words element and attribute. Instead, it uses records and fields, which are more familiar to typical database programmers. A record is similar to a database record in that it can contain fields. A field is where the data is located. In the BizTalk Editor, a record can contain data and fields. In the declaration area, you must decide to make something an element or an attribute. By default, records are elements, and fields are attributes.

  7. Right-click on the newly renamed record, and choose New Field. Call the field PODate.
  8. Repeat step 4, and call this new field CustomerNumber.
  9. Right-click on the PurchaseOrder record, and click New Record. You are going to create a container for other fields. Call the new record Item. Notice the pane on the right where this field is further defined. All the fields you've created are defined as Type Attribute, and the records are defined by default as Type Element. Click in the Content cell containing the value Empty. This turns the cell into a drop-down list box. Change the value in this cell by selecting Text Only from the drop-down list box. We'll use this record to hold the number of the item being ordered.
  10. Right-click on the Item record, and select New Field. Name the field Qty. In the Declaration pane, click in the cell to the right of Data Type and select Integer (int) from the drop-down list.
  11. Repeat step 7, and call this new field Price with a data type of Fixed Point (14.4).
  12. From the File menu, choose Save. Name the file PurchaseOrder1.xml, and put it in a convenient folder. The screen should look something like Figure 12-2.
  13. click to view at full size.

    Figure 12-2. Final purchase order structure in the BizTalk Editor.

When you saved the document, the XML schema shown in Listing 12-1 was created. This schema, however, looks different from the basic schemas described in Chapter 4 because the BizTalk Server uses extra information that the basic schema syntax does not provide.

The PurchaseOrder1.xml document created in this example is specified in XML Data Reduced (XDR). However, when the W3C XML Schema Definition (XSD) syntax is finalized, Microsoft will support that syntax as well. Converting from one syntax to the other should be as easy as clicking Save As. You should also be able to use XSLT to make the syntax change.

In Listing 12-1, notice the b: namespace defined in the <Schema> start tag. This namespace contains a set of tags used by various parts of BizTalk Server 2000.

Listing 12-1. Schema created by the BizTalk Editor.

 PurchaseOrder1.xml <?xml version="1.0"?> <Schema name="PurchaseOrder" b:root_reference="PurchaseOrder" b:standard="XML" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:d="urn:schemas-microsoft-com:datatypes" xmlns:b="urn:schemas-microsoft-com:BizTalkServer"> <b:SelectionFields/> <ElementType name="PurchaseOrder" content="eltOnly"> <b:RecordInfo/> <AttributeType name="PODate"> <b:FieldInfo/> </AttributeType> <AttributeType name="CustomerNumber"> <b:FieldInfo/> </AttributeType> <attribute type="PODate"/> <attribute type="CustomerNumber"/> <element type="Item"/> </ElementType> <ElementType name="Item" content="textOnly" model="closed"> <b:RecordInfo/> <AttributeType name="Qty" d:type="int"> <b:FieldInfo/> </AttributeType> <AttributeType name="Price" d:type="fixed.14.4"> <b:FieldInfo/> </AttributeType> <attribute type="Qty"/> <attribute type="Price"/> </ElementType> </Schema> 



XML and SOAP Programming for BizTalk Servers
XML and SOAP Programming for BizTalk(TM) Servers (DV-MPS Programming)
ISBN: 0735611262
EAN: 2147483647
Year: 2000
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net