Tallan Blog

Tallan’s Experts Share Their Knowledge on Technology, Trends and Solutions to Business Challenges

Category Archive for "Custom Software Development"

EclEmma – Unit Test Coverage Analysis in Eclipse

I was recently looking for a unit test coverage analyzer such as JCoverage for a project I’m working on. After reviewing several tools I discovered an amazing free tool called EclEmma.
I’ve used JCoverage in the past and while it’s HTML based reports are useful for project managers they are less so for developers. This tool essentially gives you the same information, but directly in Eclipse. You simply run the analyzer on either a single class or a set of classes and viola… you have your coverage report.
It even color codes each line of code within your editor window.

Use the http://update.eclemma.org/ update site to install EclEmma.

Unit Testing BizTalk Applications

Unit testing is a best practice when it comes to application development.  BizTalk development falls into this realm of application development so it would be great to be able to unit test these applications as well.
The most commonly used unit testing tool with BizTalk is BizUnit (http://www.codeplex.com/bizunit).   This is a step based test framework where steps are defined in XML.  Using BizUnit in conjunction with either Visual Studio .Net Tests or nUnit tests would allow for unit tests to be integrated as part of a build process.
More information and examples will be posted in the coming weeks so stay tuned.

Microsoft ESB Guidance

On November 8, 2007 Microsoft released the ESB Guidance. The ESB Guidance was developed by Microsoft patterns and practices team and the Connected Systems Division. It provides architectural guidance, patterns, practices, and a set of .NET and BizTalk Server components to simplify the development of Enterprise Service Bus (ESB) on the Microsoft platform and to allow companies to extend their messaging and integration solutions.
The Microsoft ESB Guidance is based on BizTalk Server 2006 R2 and extends its functionality to provide new capabilities that focus on building robust, connected, service-oriented applications. These capabilities include:

Policy driven mediation

Itinerary-based service invocation that supports lightweight service composition at the time of message publication
Dynamic resolution of endpoints and maps that enable decoupling the consumer from the services

Connecting systems

Message namespace normalization
JMS/WMQ connectivity
Support for messaging patterns that enable dynamic service aggregation, message routing, validation and transformation
Service registry and…

Handling of Record Tag Identifiers by BizTalk 2006 Flat File Schema Wizard

Those, who work with BizTalk 2006 Flat File Schema Wizard, probably noticed that record tag identifiers are handled differently for delimited and positional records. Let’s use a simple text file Person.txt for this example.

After opening Flat File Schema Wizard, skipping the Welcome Screen and entering required information on Flat File Schema Information screen we are presented with this Select Document Data screen.

Here tag identifier PERSON marks the whole record and it is followed by a User ID. Next line is person’s name record presented in comma delimited format. This record is tagged with NAME tag identifier. The last line represents person’s address. The address is presented using relative positions format and it is tagged with ADDRESS tag identifier. The children of the root element Person are {CR}{LF} delimited, so we make corresponding selection on Delimited Record screen and enter PERSON…

Testing Multi-part Map

Recently I was debugging an orchestration and found unexpected output from the map. The obvious decision was to use Visual Studio’s “Test Map” option. I opened the Map and realized that “Input” schema is a multi-part schema.

Combining two xml messages into one file will produce the multiple roots exception. So, I looked at the map’s source to figure out the structure. In order to view the map source, I simply ran “Validate map” and opened the generated xslt stylesheet.

The interesting part I found on the top of the schema was:
<?xml version=”1.0″ encoding=”UTF-16″?>
<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform
xmlns:msxsl=”urn:schemas-microsoft-com:xslt”
xmlns:var=”http://schemas.microsoft.com/BizTalk/2003/var
exclude-result-prefixes=”msxsl var s1 s0 userCSharp”
version=”1.0″
The aggregation schema
xmlns:s1=http://schemas.microsoft.com/BizTalk/2003/aggschema
Here is the root
<xsl:apply-templates select=”/s1:Root” />
</xsl:template>
The  catch statement
<xsl:template match=”/s1:Root”>
<ns0:CreateNewTaskRequest>
<xsl:for-each select=”InputMessagePart_1/ns0:WorkflowTaskList…”>
The Input message has to have the following structure in order to comply with the generated schema:
<ns0:Root xmlns:ns0=”http://schemas.microsoft.com/BizTalk/2003/aggschema>
<InputMessagePart_0>
Message 1
</InputMessagePart_0>
<InputMessagePart_1>
Message 2
</InputMessagePart_1>
</ns0:Root>
Here is the resulting message I came up with for testing.
<ns0:Root xmlns:ns0=”http://schemas.microsoft.com/BizTalk/2003/aggschema>
<InputMessagePart_0>
<ns0:IssueProcessRequest xmlns:ns0=http://Workflow.IssueProcessing.IssueProcessRequest>
<IssueId xmlns=””>16</IssueId>
<IssueTypeId xmlns=””>1</IssueTypeId>
<IssueTypeCode xmlns=””>REQUEST</IssueTypeCode>
<IssuePurposeId…

UnzipDisassembler

I came across an article on CodeProject about creating a custom pipeline component for disassembling incoming messages in zip formats. Even though it is implemented in 2004 version, it is still valid for 2006. It articulates well on how the custom pipeline is constructed in C# and how it can be deployed to a BizTalk solution.

Beyond the Flat File Wizard in BTS 2006 – Part 1

I was recently helping one of our clients parse a record-based flat file where the records are mostly positional identified by a tag. The issue was that the flat file was a credit card transaction log where each record, identified by a tag, is a sibling to the other records with no specific order in which the records appear. Such a scenario cannot be handled by an “out of the box”  usage of the FF wizard. This series of postings will focus on explaining how BizTalk Flat File schemas are structured, analyze the output of the FF wizard and how to customize it.
BizTalk handles Flat Files through the use of flat file extensions defined within schema annotations (more about annotations…, more about flat file extensions…). A receive pipeline component known as a Flat File Disassembler (or assembler for the send counterpart) can act on these extensions to parse an…

Custom Pipeline Components – part 1: Getting Started

This is the first post in a series on how to develop custom pipelines and incorporate advanced functionality. The final example will allow the reader to incorporate PGP decryption on the receive sid and encryption on the send ports.
A custom pipeline component is just a plain .NET class that implements several BizTalk interfaces. I recommend creating a seperate c# project to contain just your custom pipeline classes.
In this post, I will go through creating a sample pipeline component that archives the incoming message to the file system at the Decode stage
To get started, create a standard C# Class Library project.
Add references to the following:
Microsoft.BizTalk.Messaging (C:\Program Files\Microsoft BizTalk Server 2006\Microsoft.Biztalk.Messaging.dll)
Microsoft.BizTalk.Pipeline (C:\Program Files\Microsoft BizTalk Server 2006\Microsoft.BizTalk.Pipeline.dll)
System
System.Data
System.Drawing
System.XML

Add your namespace and the following namespace directives…

namespace Tallan.BlogBizTalk.PipelineComponent
{
    using System;
    using System.IO;
    using System.Text;
    using System.Drawing;
    using System.Resources;
    using System.Reflection;
    using System.Diagnostics;
    using System.Collections;
    using System.ComponentModel;
    using Microsoft.BizTalk.Message.Interop;
   …

Programmatically Creating A New Message in BizTalk Pipeline Component

In the BizTalk Pipeline component, often times you need to construct new messages out of the received messages in the Disassemble stage before passing them on to the orchestration. This can be done in a few different ways.
The easiest way is to build a concatenated XML string using StringBuilder or something similar, and load it into a new XmlDocument object. However, this is very inflexible. If the structure of the message is changed, the Pipeline component would have to be recompiled and redeployed. Another approach will be to load the XML strings from a configuration file at runtime, or keep it as a separate resource file to be loaded at the runtime. This approach avoids the recompilation process when the XML structure is changed, but you still have to worry about keeping the external XML file in sync with the…

View Orchestration in C#

BizTalk Orchestration Designer is the core tool for laying out components representing business processes, and connecting them with logic operations when designing BizTalk applications in Visual Studio. Behind the scene, the XLANG compiler actually generates C# source code before compiling it into .NET assemblies. If you ever want to look under the hood and view the C# source, here is a little trick.
Use your favoriate registry editor (I simply use RegEdit.exe), go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0. This is where some key properties of Visual Studio 2005 IDE are stored. Add a DWORD value named “GenerateCSFiles”, and set the value to 1.
Next time you launch Visual Studio to open a BizTalk project with orchestration files (.odx file) in it, click on the “Show All Files” icon in the Solution Explorer after the project is built. You will see along side with your abc.odx…

\\\