SIGN UP MEMBER LOGIN:    
ARTICLE

Calling External Assemblies From Maps in BizTalk

Posted by John Charles Olamendy Articles | BizTalk Server October 30, 2009
In this article, I will cover how to call external assemblies from maps in BizTalk through a simple example of an external assembly which implements the logic of string concatenation.
Reader Level:

Introduction

In this article, I will cover how to call external assemblies from maps in BizTalk through a simple example of an external assembly which implements the logic of string concatenation. This is a common scenario when the business logic is contained in an assembly and we want to reuse it not having to write the code twice.

Getting started with the solution

First of all, open Visual Studio .NET and create an empty solution. Then add an Empty Biztalk Server project (see Figure 1) and a Class Library project (see Figure 2) to the solution.

figure1.gif

Figure 1

figure2.gif

Figure 2

Then add the concatenation class to the Class Library project and implement the underlying business logic (see Listing 1).

using
System;
using System.Collections.Generic;
using System.Text;

namespace ExternalAssembly

{

    public class Concatenation

    {

        public string Concat(string strParam1, string strParam2)

        {

            return strParam1 + strParam2;

        }

    }
}

Listing 1

Add a strong name file to the project, then compile the assembly and add it to the Global Assembly Cache (GAC) using gacutil tool in order to be correctly referenced by BizTalk maps.

Now let's create two schemas which are the basis of the transformation. The first one represents the input parameters (see Figure 3) and the other one represents the output parameter (see Figure 4).

figure3.gif

Figure 3

figure4.gif

Figure 4

Now let's move to the BizTalk project and add a reference to the previously created assembly (see Figure 5).

figure5.gif

Figure 5

Now let's add a map representing the concatenation transformation. Set the source and destination schemas. Click on the Toolbox window, and then click on the Advanced Functoids tab, and drag and drop the Scripting functoid onto the map surface. This functoid's input and output values are dependent of the logic contained within the Scripting functoid. Connect the left side of Scripting functoid to the appropriate source data items as well as the right side to the destination data items (see Figure 6).

figure6.gif
 
Figure 6

Now let's configure the Scripting functoid by right-click over it and selecting Configure Functoid Script option (see Figure 7).

figure7.gif
 
Figure 7

When the Configure Functoid Script dialog is displayed, select External Assembly for Script Type. Set the ExternalAssembly assembly for the Script assembly, ExternalAssembly.Concatenation for the Scrip class and Concat for the Script method (see Figure 8).

figure8.gif
 
Figure 8

Conclusion

In this article, I covered how to call external assemblies from maps in BizTalk. Now you can apply this solution to your business scenario.

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Become a Sponsor