Development 101 with Microsoft BizTalk Server 2010


Microsoft BizTalk Server has been available since 2000, and during these ten years, the product has evolved to handle even the most complex situations in communications between organizations and integrating their diverse IT systems. This integration process is commonly known as Enterprise Application Integration, or EAI. EAI solutions help organizations to digitize and automate their business processes. For example, two organizations might share warehouse data, send orders, or integrate material sourcing of two manufacturing plants.

As a Microsoft solution, BizTalk Server can be extensively customized and extended using .NET technologies. In fact, BizTalk itself relies heavily on .NET technologies. For .NET developers wishing to learn BizTalk Server development, there's no better time to start: the new 2010 version is about to become ready, and more and more .NET examples are available on MSDN.

This article explores the overall picture of BizTalk Server 2010 beta, and shows how .NET developers can get started in their development work. Although this article uses BizTalk Server 2010 beta as the base platform, many of the principles apply to older BizTalk versions as well. The current production version is BizTalk Server 2009.

Understanding BizTalk Server

BizTalk Server is about integrating business systems, transferring data from one system to another, and monitoring these processes. Whether the amount of data is large or small, BizTalk is often apt to handle it without any custom development. However, complex scenarios and special steps can require custom code, allowing you to integrate and monitor any process you see fit. When learning about BizTalk, you will often run across the term process, and the associated term workflow. In the world of BizTalk, a process refers above all to a business process. A process timeframe can be anything from a couple of seconds to weeks or even months. A workflow on the other hand defines the technical steps necessary to complete a process. A workflow can contain multiple execution routes and decisions, and is best described visually as a flow chart (Figure 1). In fact, processes in BizTalk are modeled visually: workflows for instance can be drawn graphically, and do not necessarily require code.

Figure 1. A sample orchestration in Visual Studio 2010

In BizTalk, processes can happen completely inside a single organization, or can span between multiple organizations no matter their physical location. This gives lots of flexibility to using the product: both internal and external scenarios can be modeled. When BizTalk is working on behalf of an organization and executing a workflow, it is said to be orchestrating the process. In BizTalk parlance, a workflow is known as an orchestration.

BizTalk is a server-based product, and thus does not have any user interface for general users; for them, BizTalk has done its job if the needed data can be seen in a particular system. For instance, warehouse levels from a distributor might be directly seen inside a resellers' ERP system, if such data is shared between the two organizations.

For administrators and developers, BizTalk is managed through an administrative console, seen in Figure 2. Usually, BizTalk is installed on a Windows server operating system, but since developers also need access to the system, BizTalk 2010 can be installed on Windows 7, too. A central storage for all data and settings--called the message box--is implemented using Microsoft SQL Server. BizTalk 2010 requires you to use the latest SQL Server version 2008 R2.

Figure 2. The BizTalk Administration Console

Setting Up a BizTalk Test Environment

If you are keen to try your skills with BizTalk 2010, then Microsoft has provided a free beta version that you can readily test. When you download BizTalk 2010 for example from Microsoft Downloads, you gain access to both a 32-bit and 64-bit versions. Thus, you can install BizTalk 2010 into both 32 and 64-bit systems. However, there are certain special requirements when installing BizTalk into 64-bit operating systems, so even today, the 32-bit version is easier to get working. For instance, Excel integration currently only works with a 32-bit version of Excel.

For detailed instructions on how to install BizTalk 2010 beta, refer to a document titled "Installing BizTalk Server 2010 on Windows Server 2008 R2 and 2008" (see the Links section). A similar document is also available for Windows 7 users. Basically, you will need to install IIS with management compatibility, .NET framework 4.0, Microsoft Visual Studio 2010, Excel 2010, SharePoint 2010 and SQL Server 2008 R2 to get an environment suitable for BizTalk.

Once you have installed BizTalk 2010, BizTalk Server Developer Tools and the SDK kit onto your computer, you are ready to start exploring BizTalk development possibilities. First, you should become familiar with the main BizTalk administrative console. Note that you should run the configuration tool in elevated mode as an administrator: the first time you do so, you will need to go through an initial setup process (Figure 3). To run the console as an administrator, right-click the BizTalk Server Administration Console icon, and then choose the Run as Administrator command from the popup menu.

Figure 3. When launching the administration console for the first time, you need to step through a configuration process

Developing Solutions with Microsoft Visual Studio 2010

Once you have explored the BizTalk 2010 administration console a bit, it's time to develop a simple application with Microsoft Visual Studio. BizTalk 2010 changes .NET development in that only applications targeting the .NET Framework version 4.0 are supported. This means that older applications using for instance .NET framework 3.0 or 3.5 will have to be migrated to the 4.0 version.

When BizTalk is installed on a computer with Microsoft Visual Studio 2010, the setup process will extend Visual Studio's functionality to support BizTalk development. For example, to start writing BizTalk applications, you would begin with a BizTalk project template. This template creates an empty solution in Visual Studio, which you can use as your starting point.

BizTalk provides you many possibilities for writing custom code: you could be developing your own send and receive ports, maps to convert data from one format to another, schemas to define custom data formats, and so on. However, a BizTalk orchestration is a central piece of many BizTalk applications, and thus the rest of this article will provide a fast-paced tour to writing a simple orchestration using Visual Studio 2010.

With an empty BizTalk project open in Microsoft Visual Studio, choose the Add New Item command to add a new orchestration to the project (Figure 4). Microsoft Visual Studio divides orchestrations into three parts: the actual logic of the orchestration in the middle, at the left the receiving port(s), and at the right, the send port(s). Thus, you can think of an orchestration as the logic to receive data, process it, and then store the results.

Figure 4. BizTalk gives Visual Studio new icons to work with

Developing an orchestration starts by dragging and dropping components from the Toolbox onto the designer surface. For the sample application, drag a port component onto the gray area on the left. This will become a receive port, a component through which BizTalk can read information. In the sample application's case, the information will be read from a traditional flat text file containing customer information, and later converted (or transformed) into a simple XML presentation.

After dragging the port component, you will need to configure it using the wizard that is displayed on the screen. Once you have configured the port to access files from a particular path (for instance, "C:\Input"), you are ready to add more components. A port can be thought of as a technical "protocol" to receive input, and a receive component is the operation to read that input. Next, you will need to add a Receive component into the orchestration.

Since BizTalk orchestrations can become complex at times, Microsoft Visual Studio offers its help by showing you hints and tips about components. For example, if configurations are missing from a particular component, Visual Studio will display a red exclamation mark on the right of the component. Click this mark, and you will get a helpful hint of what is missing. In the receive component's case, the hint indicates that a message is missing ("No message").

The sample application is about reading a text file and converting it to an XML file. For this to be possible, BizTalk requires a schema for each file that is to be read or written. A schema is used so that BizTalk can understand the file's structure, field names and data types. Thus, you will need to define two schemas, one for the input file, and another for the output file.

To define the schemas, simply add new schema files to your Visual Studio project through the Add New Item dialog box. Visual Studio offers you several different options, and for flat text files, the Flat File Schema Wizard (Figure 5). The wizard is usually the easiest way to get started, and works for both delimited and non-delimited (fixed format) files. In the case of latter, you will need to separate areas from the file data and tell BizTalk which areas correspond to which record fields. For XML based files, a simple schema file is enough.

Figure 5. The Flat File Schema Wizard

Development 101 with Microsoft BizTalk Server 2010

Messages and Schemas

In the previous steps, you defined two schemas to support reading and writing files. With the schemas in place, you can define messages that conform to these schemas. Whenever you have an orchestration open in Visual Studio, the BizTalk extensions add a new tab titled Orchestration View next to Visual Studio's Solution Explorer window (Figure 6). Using this window, you can find a node captioned Messages. Right-click this node, and choose the New Message command. You will need to add two messages, one for input and one for output, just like with the schemas.

[Figure 6 - Orchestration View.png]
Figure 6. The Orchestration View window shows the components inside your orchestration

When you select a message in the Orchestration View, the Properties window shows a red exclamation mark next to the Message Type property. This means that a schema has not yet been set. To select your schema, click the drop-down arrow at the right, and under the schema tree node, select your input schema. Repeat the process for the output message.

With the messages and schemas defined, return to the orchestration. Now you need to connect the receive component to the receive port. This is easy as drag and drop: simply drag the green block from the receive component to the port component on the left, and you are set.

The next step would be to define what is to be done with the received message. In BizTalk terminology, you want to construct a different message from a received message. Thus, you will need to drag a Construct Message component into your orchestration, below the Receive component. The construct message component can create a message from scratch, or it can transform an existing message into a different format. Since this is what the sample application is after, also drag a Transform component inside the Construct Message component (Figure 7).

[Figure 7 - Construct And Transform.png]
Figure 7. The Construct Message and Transform components

For the Construct Message component, select (using the Properties window) that you want it to eventually construct an output message. Similarly, for the inner transformation component, specify the input message, output message and a map. In BizTalk, a map defines how transformation from one message type to another is to be carried out.

Adding a new map can be done through the Properties window by clicking the ellipsis button next to the Map property of the transform component, or by using the familiar Visual Studio Add New Item dialog box. Either way, a map is visually designed inside Visual Studio by drawing lines from one field to another. The map designer looks like the one in Figure 8.

[Figure 8 - BizTalk Map.png]
Figure 8. A BizTalk map with functoid components on the left

In the sample application's case, a simple copy of values from input to output suffices, but in more complex settings, you might find BizTalk's functoids useful. Functoids are small routines that are able to do small conversions and calculations for you. For example, a functoid might convert a hexadecimal number into a decimal one, calculate a sum of order amounts, test whether a certain logical expression holds, or convert a value to lowercase.

Even though BizTalk 2010 offers over 70 ready-made functoids, you might still need to develop your own. This is a matter of creating a .NET assembly with your conversion routine baked in. A custom functoid must be derived from the Microsoft.BizTalk.BaseFunctoids class.

Finishing the Orchestration and Deploying the Application

With the map configured and transformation assigned on the construction component, the last orchestration step is the creation of the send component and the send port. This process is similar to creating the receive component and port, but naturally you will need to select the output message format and the output schema.

With the send components correctly set up and linked, make sure the receive component's Activate property is set to true. This makes the port available for receiving data, or more precisely file in the case of the sample application. Now, your orchestration is complete. The final steps are related to the application as a whole.

To be able to deploy your project as a BizTalk application, you will need to sign the resulting assembly--the DLL file--with a strong name key. If you want to use a makeshift key in place of an official, paid third-party verified key, you can let Visual Studio create the key for you. To do this, go to the project's properties window in Visual Studio, and open the Signing page. Then, check the option to sign the assembly, and from the dropdown list, let Visual Studio create a key file for you. You can also choose an existing key file, if you already have one available.

With all the orchestration components and assembly signing in place, you are ready to start deploying the project as a BizTalk application. Make sure to build the whole project and take a note of any errors or warnings indicated. The BizTalk tools extend the Visual Studio building process so that you will get an informative list of issues, if your orchestration is somehow misconfigured. Once project building has succeeded without warnings or errors, it is time to deploy your application into BizTalk. Visual Studio 2010 makes this very easy with its Deploy command. All you need to do is simply right-click your project, and choose Deploy. The deployment command will configure your project to work with the local installation. You can then later transfer your project to a production BizTalk server by exporting the application into an MSI file using the BizTalk Administration Console.

Once deployment succeeds (this does not usually take longer than five to ten seconds), go to the BizTalk Administration Console, and open the Applications node (Figure 9). Under this node, you should find your deployed application with the name similar to "BizTalk Application 1". Under the application node, you should find subnodes titled Orchestrations, Send Ports, Receive Ports, Receive Locations, and so on. Although your BizTalk application is now deployed, it is not yet running.

[Figure 9 - Application In Console.png]
Figure 9. The sample in the BizTalk Server Administration Console

To run the application, you will need to enable and start it and its components. The sample application contains items in the Receive Locations, Send Ports and Orchestrations node that need to be enabled and started, in this order. Thus, work from the bottom to top, and enlist, start and run the items you can see under these nodes. Once the orchestration has been finally started, the application is running. Congratulations on your first BizTalk application!


BizTalk Server 2010 is the forth-coming version of Microsoft's business integration application. BizTalk offers organizations many possibilities for electronic integration and communication between diverse computer systems. For .NET developers, BizTalk offers many possibilities for writing custom applications. For instance, you can develop (or more correctly, visually design) orchestrations, but you can also develop custom data ports, functoids and maps to fine-tune how your solutions should work inside BizTalk.

Even though you could easily write custom C# programming code to transfer a flat text file into XML format, the process starts to become very time-consuming if you have dozens and dozens of file formats and inputs to manage. BizTalk makes this work just a matter of visual design, and thus much more productive than custom coding.

With Visual Studio 2010 and .NET framework 4.0 support to help you, building BizTalk applications, orchestrations and custom components is easier than ever. Although BizTalk is a complex application and learning can take time, spending that time is definitely worth your time if technical business integration is your job.

Happy exploring of the world of BizTalk!


BizTalk Server 2010 product pages
BizTalk Server 2010 Beta download page
BizTalk Server 2010 Beta installation guides for Windows Server 2008 and Windows 7
Microsoft BizTalk Server 2010 Help
Microsoft BizTalk Server Operations Guide

Related Articles

This article was originally published on August 30th, 2010

About the Author

Jani Jarvinen

Jani Jarvinen is a software development trainer and consultant in Finland. He is a Microsoft C# MVP, a frequent author and has published three books about software development. He is the group leader of a Finnish software development expert group at ITpro.fi and a board member of the Finnish Visual Studio Team System User Group. His blog can be found at http://www.saunalahti.fi/janij/. You can send him mail by clicking on his name at the top of the article.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date