Wednesday, November 30, 2005

Biztalk 2004: Per-Instance pipeling - Tool

Just found this interesting article.


For each pipeline (Receive Locations and Send Ports each have a Receive and Send Pipeline respectively, but if a port uses a Request-Response message exchange pattern it will also have a corresponding pipeline for the other direction, so the Receive Port will have a Send Pipeline and the Send Port will have a Receive Pipeline) the configuration database holds another piece of configuration. In the ExplorerOM this can be found as the ReceivePipelineData (on the ReceiveLocation or SendPort object) or SendPipelineData (on the SendPort or ReceivePort object) property.

This "data" is generally empty in most cases, but can be an XML document that overrides some or all of the properties of the components configured in the pipeline (note that the XML cannot add any addtional pipeline components)

Friday, November 25, 2005

Introduction ... better late than never ...

I've been running this blog for a few months now, without proper introduction. So now, I thougth, the time is ripe.
My real name is Kenneth. I've been dragging the kennywest alias around since my first hotmail acount (which was also my first real e-mail address), which is why I used this alias for my blog as well.
I'm a consultant implementing architectures/solutions for B2B and A2A scenario's. For the moment I am using Biztalk to do this. I've also used plain Java, Seebeyond's e*Gate and Crossworlds.
Although I am working with Biztalk and .NET . I am not a, how should I put it, Microsoft supporter. I'm more into Open Source and Linux or UNIX.
I first heard about linux 8 or 9 years ago. At that time we were doing labs on a DOS box telnetting to a Linux server to learn about a database called PostgreSQL. A friend of mine had a 6 CD box containing RedHat, SuSE and Slackware distros. He told me he'd installed it and loved it very much. I decided to take it for a spin. My first impression was rather average. I wasn't impressed about the stability. X crashed from time to time, maybe my hardware was a little flaky, who knows.
About a year later I decided to buy RedHat 5.2 . Yes, at that time you'd still have to buy distros on CD. Internet was just becoming popular and I didn't have any money to spare on a dial-up or broadband connection. So I installed RedHat 5.2 . RedHat was pretty cool. I could do whatever I wanted. I was writing lab reports in StarOffice (which was included) and running Apache web server for browsing my own web site on my own box. Pretty stupid, I know, but at that time it seemed very nice. RedHat used fvwm2 as default window manager, but I didn't like it. It looked too much like Windows 95. I preferred Afterstep. Afterstep was highly configurable and I was messing in a lot of configuration files to make it look just how I wanted it to look.
A few months later I decided to buy SuSE 6.0 . Now that was a total different distro. It was German ;) No, seriously, it was much easier to install and maintain than its RedHat predecessor. SuSE also packaged with 6 CDs containing a load of software. Since I didn't have any connection to the Internet, this was an ideal solution. SuSE used YAST to configure almost everything. YAST also had an option to “save” the list of packages installed on the system. If you used this feature you could reinstall a system quite fast using this saved list. I used SuSE 6.0 a lot. I also acquired an old 486DX4 computer to use it as a server. My main computer was running Windows 95 (or was it NT) and I used the Linux server for backups. You know how thrust worthy Windows was (still is) ;)
A few years later (01/09/2000) I started working and got myself a broadband connection to the Internet. I was still using SuSE 6.0 which was becoming very outdated at that time. Upgrading to new versions of software, on the server, was hard to maintain. I had to download it from the net and compile it. I was also using a very outdated kernel (2.0.x I think) running an ipfwadm firewall to serve my internal network.
Somewhere in 2001 I got fed up with SuSE. I was reading a lot about different distros and a lot of people where talking about Debian. Debian had a superior package manager called APT which made it easier to maintain. Some people claimed, however, it was not for the faint of heart to install. In the years I'd been using SuSE and RedHat I learned a lot and I thought I was not “faint of heart”.
Installing Debian (potato at that time) was a revelation. It wasn't hard to install at all. I was very impressed with the APT tool. The stuff I read about the ease of updating and upgrading was indeed true. I kept the same machine (yes, the 486DX4) running for almost 4 years, updating/dist-upgrading every now and then without ever reinstalling it.
It was love at first sight.
6 months ago I ditched the 486DX4 (he was becoming a bit flaky) and replaced it with a PII 266. I installed Debian on it, keeping the install base as small as possible. My main desktop, however, was still running Windows NT. The reason for this is I was merely using it to burn CDs and surfing the web. I also thought Debian was not suited as a desktop OS (but well suited as a server OS). I had bad experiences burning CDs on Linux, so I wasn't prepared replacing NT.
Then I bought a new PC. The desktop was becoming very old, so I decided to invest in something new. It came preloaded with XP home. I hate XP home. It isn't even capable authenticating against a PDC I was running (Samba + LDAP). I'd had to buy the professional edition to do that.
XP lasted about a week. Then it asked me to install updates/patches ... and that was the last time I saw it.
I still read a lot about different distros. I was looking for something like Debian, but more desktop oriented. Sure, I know about compiling a kernel or other packages. But a desktop has to work out of the box, without a lot of customizing. So I read about Xandros and Libranet. I even used Libranet, but didn't like it. It seemed buggy. Xandros was superior, but it wasn't freely downloadable.
And then I read about Ubuntu.
Ubuntu is the thing I've been waiting for, for a long time. It installed like a breeze on my desktop and recognized almost every piece of hardware in my PC (a HP Pavilion 5080.be). It has everything a nice GUI distro like Mandrake or SuSE should have, but with the APT power of Debian. I'm in love ;)
On forum people tend to argue from time to time about “the best distro” or “the best desktop”. Who cares. No, really. If you like SuSE, fine use it. If you like Ubuntu, then use Ubuntu. I like Ubuntu because it has a lot of Debian in it. And Debian is, from my point of view, far superior than any other distro out there. Sure, it's not as die hard as Gentoo or Slackware but I don't want to spend a week compiling before I get to use my desktop. Slackware is the oldest distro out there, but it doesn't have APT and I am not prepared to give this up.
Anyway, this is my “Linux” story. I hope you enjoyed reading it.

Enjoy life, enjoy Linux

Tuesday, November 15, 2005

Biztalk 2004: Mime revisited ...

I had to deploy a flow in production today that has been working fine for 2 months in our test environment. The flow receives a mail from an IIS maildrop folder, gets all attachments and sends them to an orchestration. Mails are in .eml format which is actually a mime message following the RFC2557 specification.
Below you can find a sample file that enters Biztalk:

From: a@a.com
To: b@b.com
Subject: hello world
Date: Mon, 14 Nov 2005 23:31:17 -0000
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----_=_NextPart_000_01C5E973.82A5C520"

------_=_NextPart_000_01C5E973.82A5C520
Content-Type: multipart/alternative; boundary=
"----_=_NextPart_001_01C5E973.82A5C520"

------_=_NextPart_001_01C5E973.82A5C520
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit

hello world, content

------_=_NextPart_001_01C5E973.82A5C520
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: 7bit


<HTML>
<HEAD>
<TITLE>hello world</TITLE>
</HEAD>
<BODY>hello world, content</BODY>
</HTML>

------_=_NextPart_001_01C5E973.82A5C520--
------_=_NextPart_000_01C5E973.82A5C520
Content-Type: text/plain; name="test.txt"
Content-Disposition: attachment; filename="test.txt"

text in attachment

------_=_NextPart_000_01C5E973.82A5C520--

After decoding the above message we have one IbaseMessage having multiple IBaseMessagePart objects.
In my pipeline component I always assumed that the actual body of the mail was a BodyPart and the attachments were all the other parts. I guess I was wrong. In the above sample, the BodyPart contains the attachment.
So how can we make sure that only the attachments are sent to Biztalk and not the body of the mail? Below is the solution:

        /// <summary>

        /// Try to determine if the message part is an attachment or not.

        /// Attachments will always have a file name in the mime property

        /// namespace.

        /// </summary>

        /// <param name="messagePart"></param>

        /// <returns></returns>

        private bool IsAttachment(IBaseMessagePart messagePart)

        {

            if (messagePart == null)

            { // bail if message part is empty

                return false;

            }

 

            /*

            * Read the file name from the mime property namespace.

            */

            string fileName = messagePart.PartProperties.Read("FileName","http://schemas.microsoft.com/BizTalk/2003/mime-properties") as string;

            if (fileName != null && fileName.Length > 0)

            {

                return true;

            }

            return false;

        }


In our pipeline component (disassemble stage), we will only disassemble messages that have the FileName-property set in the mime properties namespace.
Ok, I have to admit, no rocket-science here, but maybe there are people that will find this helpful.