Using Dynamic Transforms (Mapping) in Biztalk 2004 Orchestrations

Dynamic mapping is the concept of specifying the map to be used for a transform at runtime inside the orchestration. That means no Transform Shape is used to specify the map or input and output schemas.



The help guide talks about dynamic mapping. It is under the heading “Assigning to Transforms Dynamically”. The help guide does not go into any detail as to when or why you would want to use dynamic mapping. In fact, the help guide makes the topic seems more complex then it really is.



Dynamic transforms can be used any time you have the same business process that needs to have the same or different message types sent into it but they need to have different maps based on some parameter.



Example: We are receiving a standard invoice from multiple locations for the same vendor. The schema is exactly the same but the mapping of the vendor data to the base schema (date formats, currency conversion, etc.) is slightly different based on the vendor location.



Why not map on the Receive Port? This is the most common solution to this type of scenario. This uses document normalization to transform all your messages into the same type before it hits your business process. This is a great solution but what about exceptions?



Exceptions in maps on the Receive Port can be hard to react to and even harder to orchestrate a retry or recovery process. That is when mapping inside an Orchestration and Dynamic Maps come into play.



Calling maps inside an Orchestration provide a mechanism for exception handling, reprocess, and error notification. Dynamic maps allow for greater flexibility by allowing countless maps to be called without a Transform Shape.



With dynamic maps, the map name can be stored inside an attribute in the message, read from the SSO, or read from some other custom component. Then, it is as simple as creating a System.Type with the strong fully qualified map name.



This would look something like this:


tMapType = System.Type.GetType(“DynamicMaps.Map_A, DynamicMaps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=faed587cb93de4ea”);



construct Out_Xml


{


transform (Out_Xml) = tMapType(In_Xml);


}



If the map is inside the same assembly as the Orchestration, the full strong name is not needed. On that note, your maps usually are always inside a separate assembly…



It is important to point out this code needs to be inside an Expression Shape. The help guide says a Message Assignment shape. But, that will give a build error. If you want to use the code inside a Message Assignment shape just remove the Construct key word.



Sounds too good to be true? This does have one major drawback. If the message type of the input message does not match the message type expected in the map you get a blank message contracted. This can be seen in the sample below by running the RunMapType_ConstructBlank.xml message. So, it is import to check for this after the map.



I have put together a sample the shows dynamically calling maps inside an Orchestration both in the same assembly and inside another assembly.



Download: Dynamic Maps Inside an Orchestration



It is also common to see dynamic maps used with untyped messages (that is messages received as XmlDocuments).


Load Generation Tool For Testing BizTalk Server

A few days ago Microsoft released a Load Generation tool to help simulate load for testing Biztalk 2004 solutions.  You can download this testing tool here.



It seems that the installation package defaults the installation path for the testing tool to something other then your C drive.  In one case, my installation went to my E:\ drive and in the other two cases it went to my D:\ drive.  Just make sure during the installation you note (or change if you want to) the installation location.



Also, it appears that if you do not have MSMQ installed you will get an error saying MSMQTransmitter.dll did not register.  I said Ignore and it seemed to install correctly.  I tried this on the computer with MSMQ and did not have this problem.



I have not done anything more then install the program and briefly look at the documentation.  It seems quite powerful, but Larry Beck’s tool is much simpler and I didn’t have any problems installing it.


 


Thanks to Bryan Corazza for the release information.


 

New BizTalk Load Generation Tool Now Available

Overview


This tool is intended for developers and IT professionals to simulate load on a BizTalk Server. Using this tool, you can simulate load to instrument performance and stress against a BizTalk deployment. In addition, this tool may also be extended by developers to simulate load for custom transports. This tool should be used in a test environment only, and should not be used in a production environment. This tool is provided “as-is” and is not supported.

 


 

Dynamic Mapping Inside an Orchestration

This sample shows how a map can be called dynamically inside an Orchestration in Biztalk. This can allow for the map to be set at run time by setting a message context property or reading the value from the SSO or database. This can greatly reduce effort if a single business process is used for many different messages that need different maps.

This sample should work with BizTalk 2004 and BizTalk 2006.

Get more information from the original blog post on this topic: https://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2005/08/28/using-dynamic-transforms-_2800_mapping_2900_-in-biztalk-2004-orchestrations.aspx

Mapper Improvements in Biztalk 2006

Mapper Improvements in Biztalk 2006

Biztalk Server 2006 introduces many exciting new features like Recoverable Message Processing and Suspended Message Routing.  With great new features like these, sometimes the map and schema editor improvements can get overlooked. 



Anyone that has worked with Biztalk 2004 maps has probably seen this message pop up: “The map contains invalid links.  Please validate the contents of your map.  Saving the map file will delete all references to the invalid links.”  This is caused when the map references a schema that has changed and the changed fields are used inside the map. 



Since I have never been on a project that has successfully locked down the schemas after they were created, this message is something I have seen quite frequently.  In case you are lucky and haven’t seen this message before it looks like this:



Biztalk Server 2004 Map Error


 


In the past, these types of errors could be hard to track down.  If another developer made changes to the schema, the person working on the map may have to review the map field by field to track down the exact problem.  In the worse case scenario, a link could be broken and never fixed.



In Biztalk Server 2006, we now get this message:


Biztalk Server 2006 Map Error



This messages shows in great detail what links have been broken by the schema changes.



Since I have done my fair share of mapping in the past, I differently consider this one of the greatest enhancements to developer productivity in Biztalk 2006.  Now, if they could only make those property picker windows bigger…



While I’m on the developer productivity kick, another great enhancement is to right click on a host instance and select “Restart”.  Sure bests having to Stop, Wait, and Start again…



We also have a few new functoids available.  These include IsNil (Logical), Nil Value (Advanced) and Assert (Advanced). 



The IsNil functoid takes in one parameter and returns true if the input is set to Nil.



The Nil Value functoid sets the destination node to Nil.



The Assert functoid takes in 3 parameters.  1: expression to evaluate or result from logical functoid, 2: text to throw in the exception if 1 is false, 3: text to pass forward if 1 is true.  As expected, this only works for assemblies built in Development mode.

BizTalk 2006 Beta 1 First impressions Part 3 Workaround Group Hub Query

Yesterday I received an email from Microsoft with a workaround of issue (bug) I mentioned earlier , see  here. Indeed the error is a bug in Beta 1 and will be fixed in Beta 2. For a workaround follow the following instructions :

Workaround: Customers in the affected timezones should set the times on their machine to either GMT or to timezones lagging GMT. They should change the clock time prior to opening the Admin Console or open a new Admin Console window, where the changes will have taken effect. 

After opening the Admin Console with the clock set to GMT (or GMT lagging) and refreshing the Group Hub page (or running a specific query), users can reset the clock on their machine back to their GMT+ time. The Group Hub page will continue to work since certain cached time values are used. 

The workaround steps have to be followed for each new Admin Console window which is opened.