Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

BizTalk 2010 Recipes : Document Mapping - Creating Simple Maps

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/26/2011 9:32:52 PM

1. Problem

You would like to map one XML format to another using the BizTalk tool set. This may be for a variety of reasons, such as application mapping with an internal application, format specifics (such as flat file to database object), or an external business scenario where a business partner requires the core data for a business process in a different format (such as an industry standard) than your schema provides.

2. Solution

The BizTalk Mapper enables you to perform XML message transformation. The tool is shipped with the core BizTalk product and provides numerous capabilities to support message transformation and translation via straight mapping and functoids, as well as unit test support.

NOTE

The term functoids refers to predefined functions within the BizTalk Mapper tool set. Functoids support a number of useful translations and transformations. As a point of interest, functoid is a term coined by Microsoft and is commonly described as "functions on steroids."

As an example, suppose that you have the following simple customer schema (Customer):

<Customer>
<FirstName> </FirstName>
<LastName> </LastName>
<MiddleInit> </MiddleInit>
<Age></Age>
<Address>
<AddrLine1> </AddrLine1>
<AddrLine2> </AddrLine2>
<AddrLine3> </AddrLine3>
<Zip> </Zip>
<State> </State>
<Country></Country>
</Address>
</Customer>

And you want to map to another customer schema (CustomerRecord) that is slightly different in structure and format:

<CustomerRecord >
<Name> </Name>
<MiddleInit> </MiddleInit>
<Address> </Address>
<Zip> </Zip>
<State> </State>
<Country> </Country>
<DateTime> </DateTime>
</CustomerRecord>

The example involves mapping values from a source to a destination schema that subsequently demonstrates different structure and invariably, message transformation. To create the BizTalk map for the example, follow these steps:

  1. Open the project that contains the schemas.

  2. Right-click the project, and select Add => New Item.

  3. In the Add New Item dialog box, shown in Figure 1, click Map and give the file name a valid name. Once completed, click the Add button.

    Figure 1. Adding a map
  4. A blank map will now be opened, with left and right panes for the source and destination schema, respectively, as shown in Figure 2. Click the Open Source Schema link in the left pane.

    Figure 2. A new blank map
  5. In the BizTalk Type Picker dialog box, select the Schemas tree node, and then select the Customer schema (see Figure 3). Click OK.

    Figure 3. The BizTalk Type Picker
  6. Click the Open Destination Schema link in the right pane.

  7. In the BizTalk Type Picker dialog box, select the Schemas tree node, select the CustomerRecord schema, and click OK. The source and destination schemas will now be displayed.

  8. Perform the straight-through mapping. Click the MiddleInit element in the source schema, and drag it across to the MiddleInit element in the destination schema. Repeat this for the Zip, State, and Country elements.

  9. Perform the concatenation mapping.

NOTE

The term concatenation mapping within the BizTalk Mapper refers to the joining of two or more values to form one output value.

Here are the steps to follow in order to perform the concatenation.

  1. In the left pane, click the Toolbox, and click the String Functoids tab.

  2. Click and drag two String Concatenate functoids onto the map surface, as shown in Figure 4.

    Figure 4. String Concatenate functoids on the design surface
  3. Click the FirstName element in the source schema and drag it across to the left point on the first String Concatenate functoid. Click the right side of the String Concatenate functoid, and drag it across to the Name element in the destination schema.

  4. Double-click the first String Concatenate functoid. Click the Plus button (this will add a new input), and create a constant that has a space in it (see Figure 5).

    Figure 5. String concatenate functoids on the design surface
  5. Click the LastName element in the source schema, and drag it across to the left point on the first String Concatenate functoid. This will complete the mapping of Name.

  6. Click the AddrLine1 element in the source schema, and drag it across to the left point on the second String Concatenate functoid. Click the right side of the String Concatenate functoid, and drag it across to the Address element in the destination schema.

  7. Repeat step 6 for AddrLine2 and AddrLine3, adding a comma between each address field. Figure 6 shows the completed concatenation mapping.

    Figure 6. String concatenation mappings

To demonstrate functoid usage, you will now add a Date and Time functoid to the mapping example. In this instance, the destination schema requires a date/time stamp to be mapped. This value will be generated from the Date and Time functoid, not the source schema.

  1. In the left pane, click the Toolbox, and then click the Date/Time Functoids tab (See Figure 7).

    Figure 7. Date/Time functoids in the Toolbox
  2. Click and drag a Date and Time functoid onto the map surface.

  3. Click the right side of the Date and Time functoid, and drag it across to the DateTime element in the destination schema.

The map is now complete, as shown in Figure 8.

Figure 8. Completed customer map

3. How It Works

The BizTalk Mapper is used to map XML messages (instances of XML schema at runtime) to an alternate format based on transformation and/or translation. It is built on XSLT and shields the user from complex XSLT transformation logic, by providing a GUI environment to facilitate the transformation. The tool comes with numerous functoids and mapping capabilities to support straight-through and deterministic transformation. In addition, the tool gives the built-in ability to perform unit testing.

The maps created within the BizTalk Mapper environment can be used within other BizTalk runtime environments. For example, they can be used with receive/send ports, for transforming a message to and from application end points. Port mapping might be advantageous when the mapping involves minimal process considerations or the need to apply multiple maps to a given message. Changes to maps on ports can be completed without recompilation of currently deployed BizTalk assemblies. Maps can also be used with transformation shapes, for message transformation within a BizTalk orchestration. Mapping within an orchestration might be preferred when the mapping process involves broad process considerations or process support via robust exception and error handling.

The choices for where and when to map vary depending on a number of factors. A number of these have to do with common development principals (such as consistency and readability) and standards enforced by the environment in which you are operating. However, a few common rules of thumb should be noted:

Keep it simple: Keep maps logically organized. Across maps, ensure that the same look and feel are applied for consistency.

NOTE

Just because you can create a map using the mapper and functoids doesn't always mean you should. Make sure that whatever maps you create are simple and maintainable. Highly complex maps with many interlocking functoids can become unwieldy and next to impossible to support. Alternatives to mapping (most notably XSLT) are often very intelligent alternatives.

Keep business rules in mind: Based on the deterministic ability of mapping, be careful or keep in mind the usage of business rules within maps. If you find you are using rules within maps (for example, If OrderTotal > $1000), keep in mind maintenance and where in your organization a decision may be made to change this rule. In addition, always consider the right place to maintain rules and context domain knowledge from an operation and support perspective.

Consider performance: While mapping is powerful, complex and/or large maps can affect performance. As with all common development activities, always ensure that the logic performed is the most efficient and tested for scale in your practical operating conditions and requirements. If you experience performance issues, employ techniques such as revisiting design by exploring the solution breakdown. Consider simplifying the development task at hand.

Like all good development processes, maps should be designed and tested for desired application operation conditions.

Other -----------------
- BizTalk 2010 Recipes : Creating SOAP Header Schemas
- Windows Server 2008 R2 : Managing Active Directory with Policies (part 5)
- Windows Server 2008 R2 : Managing Active Directory with Policies (part 4) - Deploying Software Packages Using Domain Group Policy Objects
- Windows Server 2008 R2 : Managing Active Directory with Policies (part 3) - Extending Group Policy Functionality
- Windows Server 2008 R2 : Managing Active Directory with Policies (part 2) - Configuring Restricted Groups for Domain Security Groups
- Windows Server 2008 R2 : Managing Active Directory with Policies (part 1) - Fine-Grained Password Policies
- Windows Server 2008 R2 : Managing Users with Policies
- BizTalk 2010 Recipes : Document Schemas - Creating Flat File Schemas via the Wizard
- BizTalk 2010 Recipes : Document Schemas - Creating Flat File Schemas
- SharePoint 2010 : Testing the Three-State Workflow
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server