Using the New BizTalk Mapper Shape in a Windows Workflow Service

So hidden within the plethora of announcements about the BizTalk Server 2010 beta launch was a mention of AppFabric integration.  The best that I can tell, this has to do with some hooks between BizTalk and Windows Workflow.  One of them is pretty darn cool, and I’m going to show it off here.

In my admittedly limited exposure thus far to Windows Workflow (WF), one thing that jumped out was the relatively clumsy way to copy data between objects.  Now, you get a new “BizTalk Mapper” shape in your Windows Workflow activity palette which lets you use the full power of the (new) BizTalk Mapper from within a WF.

First off, I created a new .NET 4.0 Workflow Service.  This service accepts bookings into a Pet Hotel and returns a confirmation code.  I created a pair of objects to represent the request and response messages.

namespace Seroter.Blog.WorkflowServiceXForm
    public class PetBookingRequest
        public string PetName { get; set; }
        public PetList PetType { get; set; }
        public DateTime CheckIn { get; set; }
        public DateTime CheckOut { get; set; }
        public string OwnerFirstName { get; set; }
        public string OwnerLastName {get; set; }

    public class PetBookingConfirmation
        public string ConfirmationCode { get; set; }
        public string OwnerName { get; set; }
        public string PetName { get; set; }

    public enum PetList

Then I created WF variables for those objects and associated them with the request and response shapes of the Workflow Service.


To show the standard experience (or if you don’t have BizTalk 2010 installed), I’ve put an “Assignment” shape in my workflow to take the “PetName” value from the request message and stick it into the Response message.


After compiling and running the service, I invoked it from the WCF Test Client tool.  Sure enough, I can pass in a request object and get back the response with the “PetName” populated.


Let’s return to our workflow.  When I installed the BizTalk 2010 beta, I saw a new shape pop up on the Windows Workflow activity palette.  It’s under a “BizTalk” tab name and called “Mapper.”


Neato.  When I drag the shape onto my workflow, I’m prompted for the data types of my source and destination message.  I could choose primitive types, or custom types (like I have).


After that, I see an unconfigured “Mapper” shape in my workflow. 


After setting the explicit names of my source and destination variables in the activity’s Property window, I clicked the “Edit” button of the shape.  I’m asked whether I want to create a new map, or leverage an existing one.


This results in a series of files being generated, and a new *.btm file (BizTalk Map) appears.


In poking around those XSD files, I saw that two of them were just for base data type definitions, and one of them contained my actual message definition.  What also impressed me was that my code enumeration was properly transferred to an XSD enumeration.


Now let’s look at the Mapper itself.  As you’d expect, we get the shiny new Mapper interface included in BizTalk Server 2010.  I’ve got my source data type on the left and destination data type on the right.


What’s pretty cool is that besides getting the graphical mapper, I also get access to all the standard BizTalk functoids.  So, I dragged a “Concatenate” functoid onto the map and joined the OwnerLastName and OwnerFirstName and threw it into the OwnerName field.


Next, I want to create a confirmation code out of a GUID.  I dragged a “Scripting” functoid onto the map and double clicked.  It’s great that double-clicking now brings up ALL functoid configuration options.  Here, I’ve chosen to embed some C# code (vs. pointing to external assembly or writing custom XSLT) that generates a new GUID and returns it.  Also, notice that I can set “Inline C#” as a default option, AND, import from an external class file.  That’s fantastic since I can write and maintain code elsewhere and simply import it into this limited editor.


Finally, I completed my map by connected the PetName nodes.


After once again building and running the Workflow Service, I can see that my values get mapped across, and a new GUID shows up as my confirmation value.


I gotta be honest, this was REALLY easy.  I’m super impressed with where Windows Workflow is and think that adding the power of the BizTalk Mapper is a killer feature.  What a great way to save time and even get reuse from BizTalk projects, or, aid in the migration of BizTalk solutions to WF ones.

UPDATE: Apparently this WF activity gets installed when you install the WCF LOB Adpater SDK update for BizTalk Server 2010.  JUST installing BizTalk Server 2010 won’t provide you the activity.


Author: Richard Seroter

Richard Seroter is Director of Developer Relations and Outbound Product Management at Google Cloud. He’s also an instructor at Pluralsight, a frequent public speaker, the author of multiple books on software design and development, and a former editor plus former 12-time Microsoft MVP for cloud. As Director of Developer Relations and Outbound Product Management, Richard leads an organization of Google Cloud developer advocates, engineers, platform builders, and outbound product managers that help customers find success in their cloud journey. Richard maintains a regularly updated blog on topics of architecture and solution design and can be found on Twitter as @rseroter.

26 thoughts

  1. Hi Richard, interesting stuff. Too bad everyone is jumping on the new features so I’m always too late with writing my blog 😉
    Like you I’m interested in the new BizTalk shapes in WF4, but unfortunately they’re not in my toolbox when I start a new console workflow app.(?)
    I have installed a BizTalk Server 2010 beta Hyper-V image on Win2k8 R2/SQL 2k8 R2. Do I need to do anything else?

  2. Thanks Richard for providing even more motivation to try out BTS2010 beta. I have downloaded it so it should not be too difficult now. I’m super exceited after reading your article.

  3. Richard, having the same issue as the others. Don’t see the Mapper shape in my WF toolbox after installation. Any ideas?


  4. Jean-Paul, Lars and James,

    I’m assuming you all have BizTalk 2010, Visual Studio 2010 installed. Mine did show up in the toolbox automatically, but, it can also be found in the Microsoft.ServiceModel.Channels.MapperActivity which is found at:
    c:\Program Files\Microsoft BizTalk Server 2010\Developer Tools\Microsoft.ServiceModel.Channels.MapperActivity.dll

  5. Have MS released any information regarding the licensing of the mapper activity in lieu of a full blown BTS license?

  6. That DLL did not exist in my install. Is this because I only installed the Dev Tools and not the server components?

  7. Richard this is awesome! I just tried this out at the hotel this morning and was amazed. I wasn’t sure about the idea of opening parts of BizTalk up outside of the core product, but this is amazing. You and Microsoft (I guess they deserve some credit) really outdid yourselves. I think this will greatly expand the base for BizTalk.

  8. From my experience, the Mapper Activity comes in the WCF LOB Adapter SDK. I have not installed the Adapter Pack.

  9. Richard, Thanks for sharing this, one question:

    If I add an XSD into my Workflow project, can I use that in my map directly? as is the case in Biztalk, or I’ve to generate a class first from that XSD and only then I can use it inside the WF Mapper?

    I am not able to do the above so far, the XSD type doesn’t show up in the type selector for map, and it says “Select .Net Type” so I am wondering if using an XSD directly in a map is an option here or not.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.