28
May

BAM ate my XML declaration!

There are integrations which only purpose is to move a file just as it is. No advanced routing. No orchestration processing. No transformation. Just a simple port-to-port messaging scenario.

It is however still a good idea to monitor these just as one would monitor a more complicated integration. We use BAM to monitor all our integrations and to measure how many messages that has been processed in a integration. Using BAM monitoring in a simple solution as the above however has its issues …

Setting up a simple test solution

image

  1. The solution will move a XML file between two port called “SimpleTrackingReceivePort” and “SimpleTrackingSendPort”.
  2. Both port have PassThru pipelines configured.
  3. The XML file does not have a installed schema. Remember we are just moving the file not actually doing anything with it.
  4. A BAM tracking definition with one milestone called “StartPort” will be used. This will be mapped to the “PortStartTime” property on both the receiving and sending port . 

Our tracking profile configuration will like below. Dead simple.

image

So – what’s the problem?

Let us drop a XML message looking some like this.

<?xml version="1.0" encoding="UTF-16"?>
<SimpleTest>
    <SimpleContent Text="This is a test" />
</SimpleTest>

Remember that there is not a schema installed so we do not really have to worry about the structure of the file. It should just be “a file” to BizTalk and everything should be transferred between the ports. Even if we drop a executable or whatever – it should just be transferred. Nothing should read or examine the file as it’s just a pass thru!

As soon as BAM tracking is configured on a port that is however not the case. Lets take a look at the file we receive on the other end of our integration.

<SimpleTest>
    <SimpleContent Text="This is a test" />
</SimpleTest>

BizTalk now removed our XML declaration! Basically it treated the message as a XML message and parsed the message as such while tracking it. It’ will also add the dreaded Byte-Order-Mark and fail any non-valid XML messages. The problem is that this is not the behavior what one expects and causes receiving systems that rely on the XML declaration to fail!

As we also don’t have a installed schema it is not possible to use a XMLTransmit pipeline to add the XML declaration and remove the BOM.

What to do?

If you’d like to track a XML based message using BAM make sure you have the schema installed … Even if you are just using PassThru.

Is it a bug or just something one should expect? In my opinion it is at least very annoying!

There's 6 Comments So Far

  • Antti Somersalo
    May 28th, 2009 at 5:58 pm

    We had a similar problem and opened a case with MS. The problem is that BAM actually probes the message and if it looks like XML, the message will be processed like XML with all the nasty side effects you mentioned. I think it is a bug but very difficult get fixed because it is so deep in BAM implementation. MS proposed that we prefix the file with a space character, so BAM does not recogize it as XML. Obviously you have to strip that character away in the send pipeline. Not something we wanted to do.

  • Thiago Almeida
    May 28th, 2009 at 10:08 pm

    Wow, that’s pretty annoying indeed. Specially given the fact that you don’t even use the message at all in the tracking profile. Thanks for sharing!

  • Mikael Håkansson
    June 4th, 2009 at 2:07 pm

    Have you verified if this behaviour exists in 2006, R2 and 2009?

  • Richard
    June 4th, 2009 at 3:49 pm

    @Mikael Håkansson: No, right now I only know it’s a problem in R2. I haven’t had a chance to test in 2009 yet. Let me know if you do.

  • David Grospelier
    January 9th, 2012 at 2:37 pm

    Hi,
    The problem is still here with BizTalk 2010 CU3 !

  • Richard
    January 16th, 2012 at 8:27 am

    My mistake … Looks like the problem actually still is there with CU3 … Removed the update.

Share your thoughts, leave a comment!