Understanding the BizTalk Mapper - BizTalk 2013R2 Version#

I've decided to update my article on Understanding the BizTalk Mapper for BizTalk 2013R2. You can download the article here (in .docx and .pdf formats)

I originally wrote this article in 2008, and it was aimed at BizTalk 2006 R2. Since then, we’ve had 3 more versions of BizTalk: 2010, 2013, and 2013R2. With BizTalk 2016 entering CTP in the next few days, I thought it was time to revisit this article and update it for the latest (public) version of BizTalk.

Friday, April 01, 2016 10:12:15 AM (GMT Daylight Time, UTC+01:00) #    Comments [0]  |  Trackback


Aggregating messages and removing duplicates in a BizTalk Map#
Aggregating messages is a fairly common task in BizTalk.
By "aggregating" I mean taking two separate messages with repeating elements and combining them into a new message which contains the elements of both messages - the same as doing a Union in SQL.

However, what if you want to remove duplicates?
It's not as easy as it seems, and in truth the only way I have found to do this is via custom XSLT.

Combining two messages
This is actually fairly easy: you use...
Wednesday, May 21, 2008 2:42:26 PM (GMT Daylight Time, UTC+01:00) #    Comments [1]  |  Trackback


System.Data.SqlXmlHelper - calling extended XPath functions from BizTalk Maps#
In this post:
   Methods in the helper class
   Notes on implementation
   Installation Instructions
   Problems with the Script Functoid
   Examples of Usage
   Download the code
   Testing the sample map

I’m not sure if this is actually of any use to anyone but if you do want to use Microsoft's Extended XPath Functions from a BizTalk Map (see my previous post) then I've created a wrapper assembly to do this for you.
Method names are the same as the original functions, but using "_" instead of "-".

Saturday, March 15, 2008 11:30:27 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Using Microsoft's Extended XPath functions in BizTalk#
It's not that well documented, but Microsoft have a bunch of extra functions you can use from XPath expressions within XSLT.
You can find the documentation on them here.

What isn't made apparent is that none of them work with XslTransform: a subset of them will work with XslCompiledTransform, and the others only work with MSXML 4.0 onwards.

This becomes obvious if you try and use these functions, or if you read this blog post from the Microsoft XML team on the XslCompiledTransform class.

Being the curious cat I am, I wondered if there was any way to use the functions from within XslTransform - if there was, I figured you could use the functions in a BizTalk Map...

Thursday, March 13, 2008 11:21:00 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Download the Article#
If you prefer to do your reading offline, then you can download the entire series of 13 posts as a single 68-page Microsoft Word document, or Adobe PDF document.

Get them here:
     Understanding the BizTalk Mapper.doc (1.2MB)
     Understanding the BizTalk Mapper.pdf (640kB)

Please let me know what you think!
Saturday, March 01, 2008 8:14:07 PM (GMT Standard Time, UTC+00:00) #    Comments [3]  |  Trackback


Understanding the BizTalk Mapper: Part 13 - Is the Mapper the best choice for Transformation in BizTalk?#
In this section:
Transformation Choices
BizTalk Mapper
Custom XSLT with the BizTalk Mapper
External Transform Engine
Transformation in code
Which one should you use?

Transformation Choices
When performing transformations in BizTalk, you have four choices (that I can think of):
  1. Using the BizTalk Mapper
  2. Using a custom XSLT file with the BizTalk Mapper
  3. Using a separate transformation engine (called from code)
  4. Performing transformations in code
Each of these offers their own benefits depending on your requirements.

Normally your choice will depend on 3 factors:
  • Performance
  • Complexity
  • Maintainability
Generally you will get one (or two) of these, at the cost of the third.

For simple transformations, you can get all three with the Mapper using the built-in functoids.

Friday, February 29, 2008 4:05:35 PM (GMT Standard Time, UTC+00:00) #    Comments [3]  |  Trackback


Understanding the BizTalk Mapper: Part 12 - Performance and Maintainability#
In this section:
   Summary of Tests
   Testing performance in isolation (non-BizTalk)
   Performance Test Results
   Measuring Memory Usage in BizTalk
   BizTalk Memory Test Results
   Byte Arrays
   Analysing the performance results
   External XSLT
   Serialisable Classes
   Why is it so difficult to edit code in the Script functoid?

Any large BizTalk project will likely have had the inevitable conversations about performance and maintainability: will it be fast/sustainable enough, and will the tech support team (or whoever looks after the code once the developers have finished) be able to maintain it?

In this post I want to look at the performance of the Mapper, and also look at how maintainable maps are generally.

In order to do this, I want look at the different options you have for executing XSLT with the Mapper, and compare this to the most common non-Mapper mechanism for performing transformation: using serialisable classes.
Tuesday, February 26, 2008 7:14:07 PM (GMT Standard Time, UTC+00:00) #    Comments [1]  |  Trackback


Understanding the BizTalk Mapper: Part 11 - Advanced Functoids#
Interestingly, all of the advanced functoids emit XSLT. No C# in sight at all.
The reason for this is that the functoids in this category all perform operations best suited to trees of data i.e. XML.
The only way to do this in C# would be to load the data into a DOM (i.e. XmlDocument) or XmlReader, or treat the XML as string data and search for tokens.

Note: this category was the one that actually started this series – I felt that if you knew the XSLT emitted by these functoids it would help understand when to use them, and what you can achieve with them.

Functoids covered in this category:
Assert Record Count
Index Scripting
Iteration Table Looping
Looping Table Extractor
Mass Copy Value Mapping
Nil Value Value Mapping (Flattening)
Wednesday, February 20, 2008 3:21:53 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Part 10 - Database Functoids#
This category contains both Database and Cross Referencing Functoids – but they all connect to a database to retrieve/update data.
Unlike all other default functoids, these functoids all call classes/methods in external assemblies – no inline C# is emitted at all. Because of this, this is the only category that emits an ExtensionObjects file listing the strong names of the external assemblies used.

Note: in this category I show some of the source code from the external assemblies as well.

Functoids covered in this category:
Database Lookup Get Common Value
Error Return Remove Application ID
Format Message Set Common ID
Get Application ID Value Extractor
Get Application Value Common Code
Get Common ID  

Monday, February 18, 2008 3:20:59 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Part 9 - Cumulative Functoids#
Of the functoids in this category, only Cumulative Sum has a counterpart in XSLT v1.0 – all the others can be performed in XSLT v2.0, but not XSLT v1.0.

Functoids covered in this category:
Cumulative Average Cumulative Minimum
Cumulative Concatenate Cumulative Sum
Cumulative Maximum Common Code

Saturday, February 16, 2008 3:20:01 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Part 8 - Scientific Functoids#
Yet another category which has no direct support in XSLT v1.0 or XSLT v2.0!
However, given the strong support for scientific functions in .NET, it's easy to call out to .NET classes, which is exactly what every single one of the functoids in this category does.

Having said that: have you ever used one of these functoids in a map? Care to share a real world example?
I'd be interested to find out how often they are used.

Functoids covered in this category:
10^n Natural Logarithm
Arc Tangent Sine
Base-Specified Logarithm Tangent
Common Logarithm X^Y
Cosine Common Code
Natural Exponential Function  

Friday, February 15, 2008 3:19:04 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Part 7 - Conversion Functoids#
Surprisingly, neither XSLT v1.0 nor XSLT v2.0 have any built-in conversion support (well, not for the scenarios represented in this category anyway).
It is possible to download XSLT libraries which can do this sort of conversion (as mentioned in the notes below each functoid), but the XSLT is not pretty, and I'm not convinced about performance.
So C# is generally your only option here.

Functoids covered in this category:
ASCII to Character Octal
Character to ASCII Common Code

Thursday, February 14, 2008 3:18:07 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Part 6 - Date/Time Functoids#
XSLT v1.0 has no support for Date/Time values, whilst XSLT v2.0 has full support.
Therefore it's not surprising that your only option is to use C#'s rich support for Date/Time values.
And this is why all of the functoids in this category emit inline C#.

Functoids covered in this category:
Add Days Time
Date Common Code
Date and Time  

Wednesday, February 13, 2008 3:17:24 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Part 5 - Logical Functoids#
Whenever I've looked at the XSLT generated by a map I've always been confused by the amount of inline C# generated by these functoids.
After the String Functoids I'd say that these are the next most widely used and yet all but one of them has an XSLT v1.0 equivalent!
The code emitted for "Logical Equal" always makes me laugh – 12 lines of C# code can be replaced by... (wait for it)... one "=" symbol!

Functoids covered in this category:
Equal Logical Existence
Greater Than Logical NOT
Greater Than or Equal To Logical Numeric
IsNil Logical OR
Less Than Logical String
Less Than or Equal To Not Equal
Logical Date Common Code

Tuesday, February 12, 2008 3:16:22 PM (GMT Standard Time, UTC+00:00) #    Comments [1]  |  Trackback


Understanding the BizTalk Mapper: Part 4 - Mathematical Functoids#
Mathematics is not a strong point of XSLT. XSLT v1.0 has very poor mathematic support, whilst XSLT v2.0 has better support, but only by a small amount. Therefore most of the functoids in this category can only be implemented in C#.

So if you want to perform a complicated mathematical function (i.e. anything more than addition or subtraction!) you’re better off using one of these functoids, or an external assembly.

Once again, inline C# isn’t the fastest, but given a choice between a slow function and no function, you might not have a choice.

Functoids covered in this category:
Absolute Value Modulo
Addition Multiplication
Division Round
Integer Square Root
Maximum Value Subtraction
Minimum Value Common Code

Monday, February 11, 2008 3:13:46 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Part 3 - String Functoids#
The String Functoids are probably the most frequently used in maps (in my experience), mainly because they're the most familiar to a procedural programmer (i.e. a C# or VB programmer). However because they all emit inline C#, they perform the slowest so if you want your maps to run faster you're better off using the corresponding XSLT, or implementing the functionality you require in a separate assembly.

Functoids covered in this category:
Lowercase String Left Trim
Size String Right
String Concatenate String Right Trim
String Extract Uppercase
String Find Common Code
String Left  
Saturday, February 09, 2008 12:28:03 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Part 2 - Functoids Overview#
This whole series of posts started because I wanted to show what XSLT was emitted when using the default functoids provided by Microsoft.
Specifically, I wanted to show the XSLT emitted by the Advanced Functoids. Understanding this XSLT can help in understanding how to use the functoids.
For some reason (as seems to happen with me) the post expanded into a whole series on the Mapper... every time I explain one thing, I seem to want to explain all the things that the first thing is based on... oops.

Anyway, suffice to say that the next 9 posts will cover the code emitted by all of the default functoids provided with BizTalk 2004 / 2006 / 2006 R2.

One thing to realise is that the majority of the default functoids emit inline C# code – which is odd as quite a lot of the functionality can be performed using pure XSLT.

So for each functoid I've shown:
  1. Whether XSLT or C# is emitted
  2. Whether an XSLT equivalent exists
  3. The XSLT or C# emitted by the functoid
  4. Where C# is emitted, the equivalent XSLT to achieve the same functionality (in both XSLT v1.0 and v2.0)
Friday, February 08, 2008 12:03:15 PM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


Understanding the BizTalk Mapper: Part 1 - Introduction#
In this post:
BizTalk Mapper 101
BizTalk Mapper in BTS 2004 / 2006 / 2006R2
What happens when a map is compiled
What happens when a map is executed
XslTransform vs XslCompiledTransform
XSLT 1.0 vs XSLT 2.0

The BizTalk Mapper is an integral part of the BTS toolkit and, depending on your inclination and experience, you will probably either love, hate it, or not care about it.
At its core, the BizTalk Mapper is simply a visual tool for specifying XSLT (eXtensible Stylesheet Language Transformations).
This XSLT is used to transform one stream of XML data into another stream of XML data. And since a "stream of XML data" = "message in BizTalk", this means transforming one message into another message.

[Aside: you might think that the Mapper allows you to specify multiple source or destination messages, but this is actually a trick - BizTalk creates a special schema with one part per input/output message - there's still only one input/output message]

How well the BizTalk Mapper performs its task depends on the complexity of the transformation you're attempting - and the skill/experience of the developer using the BizTalk Mapper!

Thursday, February 07, 2008 11:38:44 AM (GMT Standard Time, UTC+00:00) #    Comments [0]  |  Trackback


All content © 2020, Daniel Probert
On this page
This site
<December 2020>
Blogroll OPML

Powered by: newtelligence dasBlog 2.3.12105.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts

Pick a theme: