Showing posts with label BizTalk Map. Show all posts
Showing posts with label BizTalk Map. Show all posts

Sunday, 1 April 2018

Optimizing BizTalk Map Execution and Modularizing Map using Import XSLT


Here in this article, I would brief about optimizing map execution using XSL Compile Transformation and achieve Importing XSLT using helper component.

Let go straight into mapping scenarios, below is a use case where we have huge Inline XSLT code, this can be moved to separate xsl file as template and this file should be embedded as resource in BizTalk  assembly. As you see, we have moved the code to separate XSL file and within BizTalk using XSLT Scripting functiod, we would just call the actually template.
There can be a use case, where we have complete custom xsl instead of BizTalk mapper. Here, we have the main custom XSL which invokes the template in other XSL files. Refer below for the child template XSL files. Just to generalize, implementation here, I have created multiple child template XSL files and master template file which just imports these child templates and during runtime, we would import the master template in the BizTalk Map/Custom XSL file using Custom helper component.
Here is use case of multi-part message, we would use a similar approach to earlier one but challenge  is to merge/construct a multi-part message for our execution.
Overview of XSLCompiledTranformHelper, this would be used from orchestrations instead of Transform shape
Critical methods are shown below, if you observe GetMapInfo method, we dynamically import the master template xsl file and EmbeddedResourceResolver resolves imported xsl templates from the assembly.
Here are few critical helper classes.

Here is our orchestration uses XSLCompiledTransformHelper for transformation as shown below, which executes maps for different use cases mentioned in our problem statement.

Multiple part message can be executed either by combining messages into single message and executing the transform or by directly invoking the transform method with message params, as shown below.
I have referred below articles and added this feature to the XSL Compile Transformation component.
  • https://blogs.msdn.microsoft.com/paolos/2010/01/29/how-to-boost-message-transformations-using-the-xslcompiledtransform-class/
  • https://blogs.msdn.microsoft.com/paolos/2010/04/08/how-to-boost-message-transformations-using-the-xslcompiledtransform-class-extended/

Wednesday, 13 July 2016

Boomerang BizTalk Web Service for Transformation


In this article, I would show how to develop a Transformation Web Service in BizTalk with a simple custom pipeline component. This can be extended to leverage other BizTalk features.

Lets create custom pipeline component as shown below, this a simple component which writes the incoming property back to the RouteDirectTo and EPMRRCorrelationToken context properties, which would help us to achieve the echo back service or boomerang service.
Lets create a BizTalk project, add Source and Destination schema then add maps to do simple direct mapping from SourceA To DestinationA and SourceB To DestinationB. Finally, add receive pipeline and have XML Disassembler and our custom boomerang component as shown.
Lets deploy and configure the Application. Here we would just add a simple Two-way receive port and configure the receive location as shown below and configure the maps at the inbound map in the receive port.
Test and verify the process, refer below for execution. As you post the source message, pipeline at dissemble stage context properties are promoted and when it comes to resolver stage, boomerang component rewrites the context properties in such as way, it is subscribed the receive ports send side. Thus the transformed message are echoed back. Similar to boomerang!!  

Custom Funtiods in BizTalk | Encryption and Decryption in Map


In this article, I will brief about developing a custom function in BizTalk for encrypting and decrypting the sensitive information.  Actually, the right place to encrypt and decrypt sensitive information is at the biztalk pipeline using custom component, which I would cover in later topic.

Create a class library project and add the reference of Microsoft.BizTalk.BaseFunctoids assembly and then derive our functoid from Microsoft.BizTalk.BaseFunctoids.  

In the class construct provide the function name, function bitmaps to be displayed in the mapper, tool tip text, description and a functoid ID as shown. Specify category the functoid belongs to (Math, Logical, String etc..) and set input and output parameters restrictions and connection types. finally, specify the function to call.
Here is the encrpytion and decryption methods, compile the library place the dll in BizTalk Mapper folder then GAC it.
Create a new BizTalk Project, already Source, Internal Canonical and Target Schemas are defined. Let create a BizTalk map and load Source and Canonical  as shown; the sensitive information in the source would be encrypted using custom functiod which we built. In order to add the custom function to Toolbox, right click on it then select  choose items.
Then from the BizTalk Mapper tab; select the custom functiod as shown below.
Now, custom funtiod is available under the category we specified.
Another map Canonical to Target is added, where the information is  decrypt using custom function and passed to target system.
Lets now test the both the maps and verify the results.
Encryption of Data,
 Decryption of Data