Defining Document Definitions and Maps

Before we can begin working with the channels and ports, we need to define the documents with which we are going to be dealing.

The document definitions in this example will be named:

  • SunsetBank.xml

  • BigBank.xml

The SunsetBank schema defines the document format that will be sent to Big Bank and subsequently submitted to BizTalk Server. Listing 7.2 shows this schema.

Listing 7.2. SunsetBank.xml
<?xml version="1.0"?>
<Schema
  name="Transactions"
  b:BizTalkServerEditorTool_Version="1.0"
  b:root_reference="Transactions"
  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="Type" content="textOnly" model="closed">
<b:FieldInfo/>
</ElementType><ElementType name="Transactions" content="eltOnly"_ model="closed">
<b:RecordInfo/>
<element type="Transaction" maxOccurs="*" minOccurs="0"/>
</ElementType><ElementType name="Transaction" content="eltOnly" model="closed">
<b:RecordInfo/>
<AttributeType name="id">
<b:FieldInfo/></AttributeType>
<attribute type="id"/>
<element type="Account" maxOccurs="1" minOccurs="1"/>
<element type="Amount" maxOccurs="*" minOccurs="0"/>
<element type="Type" maxOccurs="*" minOccurs="0"/>
<element type="Facility" maxOccurs="*" minOccurs="0"/>
<element type="Location" maxOccurs="1" minOccurs="1"/>
</ElementType><ElementType name="Name" content="textOnly" model="closed">
<b:FieldInfo/>
</ElementType><ElementType name="Location" content="eltOnly" model="closed">
<b:RecordInfo/>
<element type="Name" maxOccurs="*" minOccurs="0"/>
<element type="Address" maxOccurs="*" minOccurs="0"/>
</ElementType><ElementType name="Facility" content="textOnly" model="closed">
<b:FieldInfo/>
</ElementType><ElementType name="Amount" content="textOnly" model="closed">
<b:FieldInfo/>
</ElementType><ElementType name="Address" content="textOnly" model="closed">
<b:FieldInfo/>
</ElementType><ElementType name="Account" content="empty" model="closed">
<b:RecordInfo/>
<AttributeType name="number">
<b:FieldInfo/></AttributeType>
<AttributeType name="name">
<b:FieldInfo/></AttributeType>
<attribute type="name"/>
<attribute type="number"/>
</ElementType>
</Schema>

Figure 7.5 shows what the previously listed schema looks like in the BizTalk Editor.

Figure 7.5. The SunSetBank BizTalk specification.


The BigBank schema, shown in Listing 7.3, defines the format that results from a BizTalk transformation on the Sunset Bank data and gets delivered to the getTrans ASP application.

Listing 7.3. BigBank.xml
<?xml version="1.0"?>
<Schema
  name="Transactions"
  b:BizTalkServerEditorTool_Version="1.0"
  b:root_reference="Transactions"
  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="Transactions" content="eltOnly" model="closed">
<b:RecordInfo/>
<element type="Transaction" maxOccurs="*" minOccurs="1"/>
</ElementType><ElementType name="Transaction" content="empty" model="closed">
<b:RecordInfo/>
<AttributeType name="id">
<b:FieldInfo/></AttributeType>
<AttributeType name="Amount">
<b:FieldInfo/></AttributeType>
<attribute type="id" required="no"/>
<attribute type="Amount" required="no"/>
</ElementType>
</Schema>

Figure 7.6 displays the BigBank schema in the BizTalk Editor. Both of these schema files should be saved to the WebDAV repository.

Figure 7.6. The BigBank BizTalk specification.


To add these specifications to BizTalk Server, go to the left pane in the BizTalk Messaging Manager and click on Document Definitions. Select the Search Now button to view a list of document definitions in the righthand pane.

From the menu, click File, New, Document Definition (or simply use Ctrl+D), and the New Document Definition dialog box opens, as shown in Figure 7.7. Now, name the document definition SunsetBank.

Figure 7.7. The Document Definition dialog.


Click the Document Specification check box and browse the WebDAV repository for your specification. You can put the specifications physically into the directories under BizTalk.

Note

If you haven't already created a specification, see Chapter 4, “The BizTalk Editor,” for details on how to build a specification using BizTalk Editor. Another option is to copy the Sunset Bank specification given previously and insert it into WebDAV manually.


The last two tabs, Global Tracking and Selection Criteria, are optional at this point and will not be used for this example. However, these points will be covered later in Chapter 12, “Advanced BizTalk Messaging.”

Click OK, and you see the document definition name populated in the right pane. Now, repeat these steps for the Big Bank Co. specification. Make sure that the name for your Big Bank document definition is BigBank and remember that BizTalk properties are case-sensitive.

Mapping the Document Definitions

There is one more step to take before getting into the process of generating channels and ports, and that is making sure that we have a map to transform the Sunset Bank and Sunrise Bank data into the Big Bank data format.

In Chapter 5, “The BizTalk Mapper,” you learned how to map a specification from one format to another, so I am going to assume that you are comfortable with the process. Follow these steps for building your map:

1.
Open BizTalk Mapper.

2.
Choose File, New and select a Source Specification from WebDAV. Choose the SunsetBank.xml file.

3.
Select BigBank.xml as your Destination Specification from WebDAV.

You see both specifications on either side of the mapper. Drag items from the left (Sunset Bank) to the right (Big Bank) to define a model in which certain elements from Sunset Bank's XML equate to particular elements in the Big Bank XML document. For the purpose of this example, the only things we are going to map are the transaction id and the Amount. So, drag

  • The id node from the Sunset Bank specification over to the id node in the Big Bank specification

  • The Amount node from left-to-right in the same manner

4.
Save (and compile) the map to WebDAV. Save the new map as SunsetBanktoBigBank.xml.

Figure 7.8 displays the map in the BizTalk Mapper.

Figure 7.8. The BizTalk Mapper.


Now that you have created and saved the map, you are ready to build a BizTalk Messaging port.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset