A guest post from my super resourceful and wise beyond his years colleague Colin Dijkgraaf (you can stop pointing the gun at my head now Colin :)), who came to the rescue with an out of the box solution where I was about to put on my coding hat and write my own custom pipeline component.

The age old (or at least as long as BizTalk has been around) of removing the namespace prefix on a document created by BizTalk came up.

The usual suggestions of using XSLT in a map, custom pipeline components came up when I searched.

However in one thread it was suggested to use the namespace components in the ESB toolkit.

Here is the message as it looked like initially.

 <ns0:Batch BatchName=”10.4″ BatchID=”125″ xmlns:ns0=”Test”>

  <Document DocumentType=”DocumentType_0″>

    <Fields>

      <Field FieldName=”FieldName_0″>Field_0</Field>

    </Fields>

    <Files>

      <File>File_0</File>

    </Files>

  </Document>

</ns0:Batch>

First I tried just adding the ESB Add Namespace and just set the NamespaceBase Pipeline Component Property.

This resulted in the error message

There was a failure executing the send pipeline: “BizTalk_Server_Project1.SendPipeline1, BizTalk Server Project1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c21ce57b7bcc506e” Source: “ESB Add Namespace” Send Port: “TestSendPort” URI: “C:\Test\test app\out\%MessageID%.xml” Reason: Error 105010: Root element contains a namespace that matches what was specified as the new namespace – however, the prefix that exists within the document ‘ns0’ does not match the prefix specified ”.  Please change the Prefix property accordingly.

 To resolve this I added the ESB Remove Namespace as below.

This resulted in the message below.   Success!

 <Batch xmlns=”Test” BatchName=”10.4″ BatchID=”125″ >

  <Document DocumentType=”DocumentType_0″>

    <Fields>

      <Field FieldName=”FieldName_0″>Field_0</Field>

    </Fields>

    <Files>

      <File>File_0</File>

    </Files>

  </Document>

</Batch>