Category nameļ¼šBizTalk 2006 R2

Difference in mapping between BizTalk 2010 and 2013

December 16, 2013 / Comments Off on Difference in mapping between BizTalk 2010 and 2013

Difference in mapping 2010
versus 2013


Artifacts description

In a
BizTalk 2010 project we have a function that passes the current XmlNode as an
XpathNodeIterator to a helper component. In BizTalk 2010 the map look like

Note that
we are using custom XSLT here. The content of the XSLT is show below :

<?xml version=1.0 encoding=UTF-16?>
xmlns:xsl=“” xmlns:msxsl=”urn:schemas-microsoft-com:xslt” xmlns:var=”” exclude-result-prefixes=”msxsl var userCSharp
ScriptNS0″ version=”1.0″ xmlns:ns0=”http://TestMap.SomeSchema” xmlns:userCSharp=”” xmlns:ScriptNS0=”″>
  <xsl:output omit-xml-declaration=“yes” method=”xml” version=”1.0″ />
  <xsl:template match=“/”>
    <xsl:apply-templates select=“/ns0:Root” />
  <xsl:template match=“/ns0:Root”>
      <xsl:for-each select=“RepeatingNode”>
        <xsl:variable name=“var:v1″ select=”userCSharp:StringTrimRight(string(SomeNode1/text()))” />
        <xsl:variable name=“var:v3″ select=”userCSharp:StringTrimRight(string(SomeNode2/text()))” />
          <xsl:variable name=“var:v2” select=”ScriptNS0:WriteNode(string($var:v1) , .)” />
            <xsl:value-of select=“$var:v2” />
          <xsl:variable name=“var:v4” select=”ScriptNS0:WriteNode(string($var:v3) , .)” />
            <xsl:value-of select=“$var:v4” />
  <msxsl:script language=“C#” implements-prefix=”userCSharp”><![CDATA[

string StringTrimRight(string str)
       if (str == null)
               return “”;
       return str.TrimEnd(null);


The content
of the Extension XML is shown below :

  <ExtensionObject Namespace=“″ AssemblyName=”MapHelper,
Version=, Culture=neutral, PublicKeyToken=94092251336a29ea” ClassName=”MapHelper.mapHelperClass” />


The code of
function in the Helperclass is shown below :



   public class mapHelperClass

        public static bool
WriteNode(string somedata,XPathNodeIterator node)
xpn = node.Current;
xdoc = new XmlDocument();
function ->”+ xdoc.OuterXml);
            return true;

Expected behavior BizTalk

If we run
this map in BizTalk 2010 and watch for the output in Debug View we get the
expected output

Also the
map test succeeds in BizTalk 2010. As shown below:

The compilation is using the CustomXslt and CustomExtensionXml tags to generate
the output.  The map content is ignored.
used the following file:
<file:///C:UsersAdministratorAppDataLocalTempinputfile.xml> as
input to the map.
Test Map
success for map file F:ProjectsTestMapTestMapSomeMap.btm. The output is
stored in the following file:
Component invocation succeeded.

Observed behavior BizTalk

If we run
this in BizTalk 2013 we get the following output.

Invoking component…

The compilation is using the CustomXslt and CustomExtensionXml tags to generate
the output.  The map content is ignored.
TestMap used the following file:
<file:///C:UsersAdministratorAppDataLocalTempinputfile.xml> as
input to the map.
error btm1050: XSL transform error: Unable to write output instance to the

has been thrown by the target of an invocation. An error occurred during a call
to extension function ‘WriteNode’. See InnerException for a complete
description of the error. Enumeration has not started. Call MoveNext.
Test Map failure for map file <file:///C:ProjectsTestMap2013TestMapTestMapSomeMap.btm>.
The output is stored in the following file:
Component invocation succeeded.

So the map failed because the behavior of the compiled xslt is different from the interpreted xslt.

Desired Behavior

The behavior
should be the same as in BizTalk 2010.


You can find the test project in the attachment

Getting rid of : WCF-Custom" raised an error message. Details "System.Data.SqlClient.SqlException: Timeout expired

December 22, 2010 / Comments Off on Getting rid of : WCF-Custom" raised an error message. Details "System.Data.SqlClient.SqlException: Timeout expired

I had a nice setup in my BizTalk environment. I had 4 receive locations polling for data (in the same table) and it all boiled down to execute a stored procedure with different parameters. I used the WCF adapter with SQL bindings for that.
For some obscure reason, I would get timeouts in the eventlog. Below is a screenshot of the receive port setup I had. Only one is shown but I had four of them.

Some important things to notice:

  • PolledDataAvailablestatement, is not used cause Pollwhiledatatfound = false. But you still have to put stuff in there to make things work.
  • Execute a specific sproc, with the number of records you want to receive as a parameter.
  • UseAmbientTransaction, no, no,no, had too many problems in the past when using msdtc and receive locations (locks and stuff) so this is a NO.
  • ReceiveTimeout is set to 10 minutes. This is a bit long but i never touched that value, it’s the default.

To make things a little bit more clear, The stored procedure I used looks looked like this :

 CREATE PROCEDURE [dbo].[Get_TeVertalen_Berichten]
 @MaximumAantal INT = NULL
 EXEC [dbo].[Get_Berichten_Internal]
  @MaximumAantalInternal = @MaximumAantal,
  @OudeBerichtStatus = ‘TeVertalen’,
  @NieuweBerichtStatus = ‘VertalenGestart’,
  @Richting  = ‘Ingaand’  

And here is the code of Get_Berichten_Internal:

CREATE PROCEDURE [dbo].[Get_Berichten_Internal]
 @MaximumAantalInternal INT = 15,
 @OudeBerichtStatus  VARCHAR(200),
 @NieuweBerichtStatus VARCHAR(200),
 @Richting    VARCHAR(20) 
  — Declare variables
   BerichtID NUMERIC(18, 0)
   — Some sets needed
  — Perform the update statement and capture all the keys
   TOP (@MaximumAantalInternal) dbo.tb_Bericht
   BerichtStatus = @NieuweBerichtStatus
   BerichtStatus = @OudeBerichtStatus
   ExternBerichtTypeID IS NOT NULL
   InternBerichtTypeID IS NOT NULL
   Richting = @Richting
  <– SNIP–>

Now everything looks good and in the query analyzer everything was working blazingly fast. But I started to see the following message in the eventlog every 10 minutes (hmm that’s the receive timeout).  And sometimes several (four to be exactly) of them within a very short period of time.

Event Type: Warning
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5740
Date:  14-12-2010
Time:  10:47:07
User:  N/A
Computer: BA34T
The adapter “WCF-Custom” raised an error message. Details “System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
   at Microsoft.ServiceModel.Channels.Common.Design.AdapterAsyncResult.End()
   at Microsoft.ServiceModel.Channels.Common.Channels.AdapterInputChannel.EndTryReceive(IAsyncResult result, Message& message)
   at System.ServiceModel.Dispatcher.InputChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
   at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)”.

For more information, see Help and Support Center at

And once this message started to appear, stuff went downhill from there on. I could see in the profiler that stored procedures were taking ages, and even simple updates of a single record would take thirty seconds or so. Lock-Time-outs and deadlocks were occuring on a very regular basis. Even though the receive locations werent receiving any data. So nothing was received and I still got may daily portion of errors/warnings/suspended stuff in BizTalk because of this.
So basically it looked like I was having some kind of locking problem even if no work was done by the second stored procedure. But the second procedure did an update (even when there was nothing to update) and maybe that triggered the nasty behaviour.

I started a discusiion on MSDN to see if anybody could help : <<See here>>

 But eventually i cghanged something to make this behaviour go away. The idea was only to perform the update when there was stuff to update. So i changed the first procedure to :

CREATE PROCEDURE [dbo].[Get_TeVertalen_Berichten]
   @MaximumAantal INT = NULL
 DECLARE @Aantal int
  dbo.tb_Bericht WITH (NOLOCK)
  BerichtStatus = ‘TeVertalen’
  ExternBerichtTypeID IS NOT NULL
  InternBerichtTypeID IS NOT NULL
  Richting = ‘Ingaand’
 IF @Aantal > 0
  EXEC [dbo].[Get_Berichten_Internal]
    @MaximumAantalInternal = @MaximumAantal,
    @OudeBerichtStatus  = ‘TeVertalen’,
    @NieuweBerichtStatus = ‘VertalenGestart’,
    @Richting    = ‘Ingaand’  

 And by first checking if there was any work to do and only then do an update, I got rid of the deadlocks and the errors in the eventlog.
I really don’t know why this solved it, but my guess is there is some bug in the WCF adapters, that go wrong if you start a transaction but return no data.

Everything is running smooth now and I hope this post will help somebody experiencing the same problems.

Strange COM exception in BizTalk

September 27, 2010 / Comments Off on Strange COM exception in BizTalk

A while ago I had serious problems with BizTalk. For some obscure reason the BizTalk engine would throw some XLANG errors and stop processing all messages. A restart of the hosts would fix the problem for a while but after some time the same problem would occur and BizTalk would effectively stop processing. (orchestrations would be marked as  active but nothing happens)

The funny thing is, these orchestrations were deployed on the BizTalk Server a long time ago and they never gave any problem. All of a sudden these problems started to appear. So I think the blame is probably in some kb^*&^(& hotfix somewhere.

I had a case with MS-Support (and for sure they had never seen this error) and even google will not tell you that much about it.
However, until now I have had two people contact me with exactly the same problem.
So I know I was not alone ! Since googling on this gives me very poor results I will put some details about what happened in this post.

Unable to cast COM object of type ‘System.__ComObject’   followed by No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

When this happens you will find a lot of references to the guid 6C90EC05-4918-11D3-A242-00C04F60A533 (see bottom)

I have mentioned both MSDN threads that have this problem. The things we have in common are:

  • Usage of the classic SQL adapter 
  • Typically, this problem occurs when the orchestration engine reaches a Call Orchestration shape or a Start Orchestration shape.

To isolate this problem we added a specific SQL Host that does all the work for the SQL Adapter. We hoped the next time we saw the error, we could see if it was caused by orchestrations or really by the SQL adapter. Cause then onlu the SQL Host would have a problem. We had everything set up to debug the BizTalk environment with the tools provided by MS and we were waiting for the event to happen. But unfortunately after we added a dedicated SQL host the problem never re-occurred. So the supportcase is closed now (without a definitive answer).

If you have had a similar experience please give a response to this post.

About EDI / Property Schemas and Validate instance

May 11, 2009 / Comments Off on About EDI / Property Schemas and Validate instance

In the future we need to process EDI documents so I am currently looking at some EDI Samples.

  • I did some tutorials (from Pro EDI in BizTalk Server 2006 Apress) and I created my own EDI schema based on X12_00401_810 (Exercise 1.0 to 1.4)
  • Then I had to create my own PropertySchemas to promote some nodes (Exercise 1.5)
  • Then I had to validate an instance of the schema i had just created….(Exercise 1.6 to 1.7)

But no matter what I did, I kept getting the same error over and over again. The errors were :

Invoking component…
D:XXXSchemasX12_BatchSchema.xsd: error BEC2004: Object reference not set to an instance of an object.
D:XXXSchemasX12_BatchSchema.xsd: error BEC2004: Validate Schema failed for file: <file:///D:XXXSchemasX12_BatchSchema.xsd>.
D:XXXSchemasX12_BatchSchema.xsd: error BEC2004: Validate Instance failed for schema X12_BatchSchema.xsd, file: <file:///C:Apress.IntegrationChapter 1Test DocumentsValid-Input.txt>.
Component invocation succeeded.

So I googled around a bit and tried to create a new solution. This has helped somebody who whas experiencing the same problems. But it Didn’t help me. The same rror keept popping up.

Only when I removed the property schema from my solution (created in 1.5) everything worked as expected. So since there is very little docuementation on this behaviour I hope this can help anybodu in the future.




  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta