Schema Creation with BizTalk Editor

The first step in integrating with a legacy application, assuming you have an XML-based architecture in place, is to create the necessary model of the legacy data. This task is accomplished using the BizTalk Editor, show in Figure 15-1, which is capable of creating specifications or schemas that can be adhered to by your applications.

Figure 15-1 The BizTalk Editor.

To create a specification or schema within the Editor, you can either choose to create a new specification from the File menu or schema, or you can import (under the Tools menu) an existing well-formed XML document, a DTD, or an XDR Schema. If you choose to create a new schema, you will be presented with the dialog box shown in Figure 15-2 where you can create a Blank Specification, Electronic Data Interface For Administration, Commerce and Transport (EDIFACT), X12, or XML specification or schema. Furthermore, some common templates under EDIFACT, X12, or XML can help get you started.

Figure 15-2 Various options for creating schemas.

As an example, let's say you have built an issue submission system used by your technical support team. It's a simple system that contains only the customer name, phone, e-mail address, and issue. In Listing 15-1 you can see an example of the information collected.

Listing 15-1 allen-support.xml: A sample submission document of an issue.

 <?xml version="1.0" ?>  <support> <name>Allen Wyke</name> <phone>999.555.1212</phone> <email>mspress@microsoft.com</email> <issue>Unable to access Web-based email account</issue> </support> 

Now if you use the Import feature under the Tools menu of the Editor and then selecting Well-Formed XML Instance as the type, we can import and build a specification off of this document. The Editor does all the hard work of converting it to the necessary XDR-based format used by the other BizTalk applications. Go ahead and do this and save the file under the name support.xml, which we have included here as Listing 15-2.

If you are interested in controlling other aspects of these specifications, be sure to check the Help files. They will outline how you can specify recurring elements, default values, and so forth—many of the features that schema-based XML dialects allow.

Listing 15-2 support.xml: The specification for our support submission data.

 <?xml version="1.0"?> <!-- Generated by using BizTalk Editor on Thu, Aug 02 2001 10:35:27 PM --> <!-- Microsoft Corporation (c) 2000 (http://www.microsoft.com) --> <Schema name="support"  b:BizTalkServerEditorTool_Version="1.0"  b:root_reference="support"  b:standard="XML"  xmlns="urn:schemas-microsoft-com:xml-data"  xmlns:b="urn:schemas-microsoft-com:BizTalkServer"  xmlns:d="urn:schemas-microsoft-com:datatypes"> <b:SelectionFields/> <ElementType name="support" content="eltOnly" model="closed"> <b:RecordInfo/> <element type="name" maxOccurs="*" minOccurs="0"/> <element type="phone" maxOccurs="*" minOccurs="0"/> <element type="email" maxOccurs="*" minOccurs="0"/> <element type="issue" maxOccurs="*" minOccurs="0"/> </ElementType> <ElementType name="phone" content="textOnly" model="closed"> <b:FieldInfo/> </ElementType> <ElementType name="name" content="textOnly" model="closed"> <b:FieldInfo/> </ElementType> <ElementType name="issue" content="textOnly" model="closed"> <b:FieldInfo/> </ElementType> <ElementType name="email" content="textOnly" model="closed"> <b:FieldInfo/> </ElementType> </Schema> 

Before we move on, let's assume that you have a partner who will be sending you support cases as well, but that they have a slightly different format. They have broken down the <name> element into first and last names. In Listing 15-3 we have included such an example.

Listing 15-3 partner-support.xml: A sample support submission from a partner.

 <?xml version="1.0" ?>  <support> <name> <first>Allen</first> <last>Wyke</last> </name> <phone>999.555.1212</phone> <email>mspress@microsoft.com</email> <issue>Unable to access Web-based email account</issue> </support> 

After we import this in the Editor and save it in a file called partner.xml (Listing 15-4), we end up with the following.

Listing 15-4 partner.xml: A specification outlining the partner's format for support submissions.

 <?xml version="1.0"?> <!-- Generated by using BizTalk Editor on Thu, Aug 02 2001 10:45:06 PM --> <!-- Microsoft Corporation (c) 2000 (http://www.microsoft.com) --> <Schema name="support"  b:BizTalkServerEditorTool_Version="1.0"  b:root_reference="support"  b:standard="XML"  xmlns="urn:schemas-microsoft-com:xml-data"  xmlns:b="urn:schemas-microsoft-com:BizTalkServer"  xmlns:d="urn:schemas-microsoft-com:datatypes"> <b:SelectionFields/> <ElementType name="support" content="eltOnly" model="closed"> <b:RecordInfo/> <element type="name" maxOccurs="*" minOccurs="0"/> <element type="phone" maxOccurs="*" minOccurs="0"/> <element type="email" maxOccurs="*" minOccurs="0"/> <element type="issue" maxOccurs="*" minOccurs="0"/> </ElementType> <ElementType name="phone" content="textOnly" model="closed"> <b:FieldInfo/> </ElementType> <ElementType name="name" content="eltOnly" model="closed"> <b:RecordInfo/> <element type="first" maxOccurs="*" minOccurs="0"/> <element type="last" maxOccurs="*" minOccurs="0"/> </ElementType> <ElementType name="last" content="textOnly" model="closed"> <b:FieldInfo/> </ElementType> <ElementType name="issue" content="textOnly" model="closed"> <b:FieldInfo/> </ElementType> <ElementType name="first" content="textOnly" model="closed"> <b:FieldInfo/> </ElementType> <ElementType name="email" content="textOnly" model="closed"> <b:FieldInfo/> </ElementType> </Schema> 

While this quick example certainly does not display all the powers of the BizTalk Editor, it showed you how to perform some basic tasks and how to get started. In the next section we will build on the example and show you how to support the partner's specification by mapping it to yours.



XML Programming
XML Programming Bible
ISBN: 0764538292
EAN: 2147483647
Year: 2002
Pages: 134

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