<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>eliasen - BizTalk 2004</title>
    <link>http://blog.eliasen.dk/</link>
    <description>Just another BizTalk guy</description>
    <language>en-us</language>
    <copyright>Jan Eliasen</copyright>
    <lastBuildDate>Sat, 15 Nov 2008 20:49:40 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.2.8279.16125</generator>
    <managingEditor>jan@eliasen.dk</managingEditor>
    <webMaster>jan@eliasen.dk</webMaster>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=d8bc8e42-e351-4d99-908e-b809e90b614d</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,d8bc8e42-e351-4d99-908e-b809e90b614d.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,d8bc8e42-e351-4d99-908e-b809e90b614d.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=d8bc8e42-e351-4d99-908e-b809e90b614d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi all
</p>
        <p>
I have often wondered why the built-in functoids doesn't encompass an If-Then-Else
functoid. The Value Mapping functoid only has an If-Then-part and not the Else-part.
</p>
        <p>
This is the first of two blog posts. This post will explore how to solve the issue
with the built-in functionality of BizTalk. The next post will be about creating a
custom functoid to do the job instead and the issues that come with this task.
</p>
        <p>
So, using the built-in functionality:
</p>
        <p>
Imagine this input schema:
</p>
        <p>
          <a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseInputSchema.jpg">
            <img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="112" alt="IfThenElseInputSchema" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseInputSchema_thumb.jpg" width="147" border="0" />
          </a>
        </p>
        <p>
And imagine this output schema:
</p>
        <p>
          <a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseOutputSchema.jpg">
            <img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="84" alt="IfThenElseOutputSchema" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseOutputSchema_thumb.jpg" width="154" border="0" />
          </a>
        </p>
        <p>
My goal, now is to create a map that will map the value of the "ifJan" element to
the destination IF the "qualifier" element equals the word "Jan" and otherwise the
value of the "ifNotJan" element should be mapped.
</p>
        <p>
So basically, given this input:
</p>
        <p>
&lt;ns0:IfThenElseInput xmlns:ns0="<a href="http://IfThenElse.IfThenElseInput&quot;">http://IfThenElse.IfThenElseInput"</a>&gt;<br />
  &lt;qualifier&gt;Jan&lt;/qualifier&gt;<br />
  &lt;ifJan&gt;ifJan&lt;/ifJan&gt;<br />
  &lt;ifNotJan&gt;ifNotJan&lt;/ifNotJan&gt;<br />
&lt;/ns0:IfThenElseInput&gt; 
</p>
        <p>
I want this output:
</p>
        <p>
&lt;ns0:IfThenElseOutput xmlns:ns0="<a href="http://IfThenElse.IfThenElseOutput&quot;">http://IfThenElse.IfThenElseOutput"</a>&gt;<br />
  &lt;field&gt;ifJan&lt;/field&gt;<br />
&lt;/ns0:IfThenElseOutput&gt; 
</p>
        <p>
And given this input:
</p>
        <p>
&lt;ns0:IfThenElseInput xmlns:ns0="<a href="http://IfThenElse.IfThenElseInput&quot;">http://IfThenElse.IfThenElseInput"</a>&gt;<br />
  &lt;qualifier&gt;NotJan&lt;/qualifier&gt;<br />
  &lt;ifJan&gt;ifJan&lt;/ifJan&gt;<br />
  &lt;ifNotJan&gt;ifNotJan&lt;/ifNotJan&gt;<br />
&lt;/ns0:IfThenElseInput&gt;
</p>
        <p>
I want this output:
</p>
        <p>
&lt;ns0:IfThenElseOutput xmlns:ns0="<a href="http://IfThenElse.IfThenElseOutput&quot;">http://IfThenElse.IfThenElseOutput"</a>&gt;<br />
  &lt;field&gt;ifNotJan&lt;/field&gt;<br />
&lt;/ns0:IfThenElseOutput&gt;
</p>
        <p>
Using a map and the built-in functoids, that would look like this:
</p>
        <p>
 <a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Functoids.jpg"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="190" alt="IfThenElseMap_Functoids" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Functoids_thumb.jpg" width="451" border="0" /></a></p>
        <p>
Basically, you need one value mapping functoid for each possible value to pass on,
and a logical functoid for each value as well, to use in the value mapping functoid.
The "String Concatenate" functoid is just my way of returning the string to use for
the qualifier - in this case: "Jan".
</p>
        <p>
You can also do it using one scripting functoid like this:
</p>
        <p>
          <a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Scripting_XSLT.jpg">
            <img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="138" alt="IfThenElseMap_Scripting_XSLT" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Scripting_XSLT_thumb.jpg" width="451" border="0" />
          </a>
        </p>
        <p>
where the scripting functoid is an "Inline XSLT Call Template" scripting type, and
the script looks likes this:
</p>
        <p>
&lt;xsl:template name="IfThenElse"&gt;<br />
  &lt;xsl:param name="qualifier" /&gt;<br />
  &lt;xsl:param name="ifJan" /&gt;<br />
  &lt;xsl:param name="ifNotJan" /&gt;<br />
  &lt;xsl:element name="field"&gt;<br />
    &lt;xsl:choose&gt;<br />
      &lt;xsl:when test="$qualifier='Jan'"&gt;<br />
        &lt;xsl:value-of select="$ifJan" /&gt;<br />
      &lt;/xsl:when&gt;<br />
      &lt;xsl:otherwise&gt;<br />
        &lt;xsl:value-of select="$ifNotJan" /&gt;<br />
      &lt;/xsl:otherwise&gt;<br />
    &lt;/xsl:choose&gt;<br />
  &lt;/xsl:element&gt;<br />
&lt;/xsl:template&gt; 
</p>
        <p>
Now... IF my good friend Henrik Badsberg is reading this, then by now he is screaming:
"USE A BLOODY C# SCRIPTING FUNCTOID!!!!!" :-) 
</p>
        <p>
This, naturally is also an option: 
</p>
        <p>
          <a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Scripting_CSharp.jpg">
            <img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="138" alt="IfThenElseMap_Scripting_CSharp" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Scripting_CSharp_thumb.jpg" width="451" border="0" />
          </a>
        </p>
        <p>
with an "Inline C#" script containing this script: 
</p>
        <p>
public string IfThenElse(string qualifier, string ifJan, string ifNotJan)<br />
{<br />
  if (qualifier == "Jan")<br />
    return ifJan;<br />
  else<br />
    return ifNotJan;<br />
} 
</p>
        <p>
Both scripting solutions can be altered to accept the output of a logical functoid
as the first input. Just change the string "Jan" to "true" in the scripts, and change
the name of the parameter if you want. 
</p>
        <p>
Now then... I am not a big fan of either of these three options. Generally, I avoid
scripting functoids when I can because it is difficult for a new developer to know
what is happening when he opens the map because he will have to open up all scripting
functoids and find out (and remember) what they do. Also, I am not really a big fan
of the first solution either. First of all, there are too many functoids, and it can
messy if this solution is needed several times in a map. Secondly, you get a warning
every time you compile, because you have two inputs to one element.
</p>
        <p>
        </p>
        <div class="wlWriterSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:a5a7990f-4d20-49d8-b310-2511383a432d" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">
          <p>
You can find my project with the three working maps <a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElse.zip" target="_blank">here.</a></p>
        </div>
        <p>
        </p>
        <p>
In my next post, I will look into creating a custom functoid that does the job and
I can tell you right now; That isn't as easy as I had imagined...
</p>
        <p>
-- 
<br />
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=d8bc8e42-e351-4d99-908e-b809e90b614d" />
      </body>
      <title>Solving the "If-Then-Else" problem in a map - part I</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,d8bc8e42-e351-4d99-908e-b809e90b614d.aspx</guid>
      <link>http://blog.eliasen.dk/2008/11/15/SolvingTheIfThenElseProblemInAMapPartI.aspx</link>
      <pubDate>Sat, 15 Nov 2008 20:49:40 GMT</pubDate>
      <description>&lt;p&gt;
Hi all
&lt;/p&gt;
&lt;p&gt;
I have often wondered why the built-in functoids doesn't encompass an If-Then-Else
functoid. The Value Mapping functoid only has an If-Then-part and not the Else-part.
&lt;/p&gt;
&lt;p&gt;
This is the first of two blog posts. This post will explore how to solve the issue
with the built-in functionality of BizTalk. The next post will be about creating a
custom functoid to do the job instead and the issues that come with this task.
&lt;/p&gt;
&lt;p&gt;
So, using the built-in functionality:
&lt;/p&gt;
&lt;p&gt;
Imagine this input schema:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseInputSchema.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="112" alt="IfThenElseInputSchema" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseInputSchema_thumb.jpg" width="147" border="0"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
And imagine this output schema:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseOutputSchema.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="84" alt="IfThenElseOutputSchema" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseOutputSchema_thumb.jpg" width="154" border="0"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
My goal, now is to create a map that will map the value of the "ifJan" element to
the destination IF the "qualifier" element equals the word "Jan" and otherwise the
value of the "ifNotJan" element should be mapped.
&lt;/p&gt;
&lt;p&gt;
So basically, given this input:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;ns0:IfThenElseInput xmlns:ns0="&lt;a href="http://IfThenElse.IfThenElseInput&amp;quot;"&gt;http://IfThenElse.IfThenElseInput"&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;qualifier&amp;gt;Jan&amp;lt;/qualifier&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;ifJan&amp;gt;ifJan&amp;lt;/ifJan&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;ifNotJan&amp;gt;ifNotJan&amp;lt;/ifNotJan&amp;gt;&lt;br&gt;
&amp;lt;/ns0:IfThenElseInput&amp;gt; 
&lt;p&gt;
I want this output:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;ns0:IfThenElseOutput xmlns:ns0="&lt;a href="http://IfThenElse.IfThenElseOutput&amp;quot;"&gt;http://IfThenElse.IfThenElseOutput"&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;field&amp;gt;ifJan&amp;lt;/field&amp;gt;&lt;br&gt;
&amp;lt;/ns0:IfThenElseOutput&amp;gt; 
&lt;p&gt;
And given this input:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;ns0:IfThenElseInput xmlns:ns0="&lt;a href="http://IfThenElse.IfThenElseInput&amp;quot;"&gt;http://IfThenElse.IfThenElseInput"&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;qualifier&amp;gt;NotJan&amp;lt;/qualifier&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;ifJan&amp;gt;ifJan&amp;lt;/ifJan&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;ifNotJan&amp;gt;ifNotJan&amp;lt;/ifNotJan&amp;gt;&lt;br&gt;
&amp;lt;/ns0:IfThenElseInput&amp;gt;
&lt;/p&gt;
&lt;p&gt;
I want this output:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;ns0:IfThenElseOutput xmlns:ns0="&lt;a href="http://IfThenElse.IfThenElseOutput&amp;quot;"&gt;http://IfThenElse.IfThenElseOutput"&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;field&amp;gt;ifNotJan&amp;lt;/field&amp;gt;&lt;br&gt;
&amp;lt;/ns0:IfThenElseOutput&amp;gt;
&lt;/p&gt;
&lt;p&gt;
Using a map and the built-in functoids, that would look like this:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Functoids.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="190" alt="IfThenElseMap_Functoids" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Functoids_thumb.jpg" width="451" border="0"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Basically, you need one value mapping functoid for each possible value to pass on,
and a logical functoid for each value as well, to use in the value mapping functoid.
The "String Concatenate" functoid is just my way of returning the string to use for
the qualifier - in this case: "Jan".
&lt;/p&gt;
&lt;p&gt;
You can also do it using one scripting functoid like this:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Scripting_XSLT.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="138" alt="IfThenElseMap_Scripting_XSLT" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Scripting_XSLT_thumb.jpg" width="451" border="0"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
where the scripting functoid is an "Inline XSLT Call Template" scripting type, and
the script looks likes this:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;xsl:template name="IfThenElse"&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;xsl:param name="qualifier" /&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;xsl:param name="ifJan" /&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;xsl:param name="ifNotJan" /&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;xsl:element name="field"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:choose&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:when test="$qualifier='Jan'"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="$ifJan" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:when&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:otherwise&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="$ifNotJan" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:otherwise&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:choose&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/xsl:element&amp;gt;&lt;br&gt;
&amp;lt;/xsl:template&amp;gt; 
&lt;p&gt;
Now... IF my good friend Henrik Badsberg is reading this, then by now he is screaming:
"USE A BLOODY C# SCRIPTING FUNCTOID!!!!!" :-) 
&lt;p&gt;
This, naturally is also an option: 
&lt;p&gt;
&lt;a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Scripting_CSharp.jpg"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="138" alt="IfThenElseMap_Scripting_CSharp" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElseMap_Scripting_CSharp_thumb.jpg" width="451" border="0"&gt;&lt;/a&gt; 
&lt;p&gt;
with an "Inline C#" script containing this script: 
&lt;p&gt;
public string IfThenElse(string qualifier, string ifJan, string ifNotJan)&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; if (qualifier == "Jan")&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return ifJan;&lt;br&gt;
&amp;nbsp; else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return ifNotJan;&lt;br&gt;
} 
&lt;p&gt;
Both scripting solutions can be altered to accept the output of a logical functoid
as the first input. Just change the string "Jan" to "true" in the scripts, and change
the name of the parameter if you want. 
&lt;p&gt;
Now then... I am not a big fan of either of these three options. Generally, I avoid
scripting functoids when I can because it is difficult for a new developer to know
what is happening when he opens the map because he will have to open up all scripting
functoids and find out (and remember) what they do. Also, I am not really a big fan
of the first solution either. First of all, there are too many functoids, and it can
messy if this solution is needed several times in a map. Secondly, you get a warning
every time you compile, because you have two inputs to one element.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:a5a7990f-4d20-49d8-b310-2511383a432d" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;
&lt;p&gt;
You can find my project with the three working maps &lt;a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/CreatinganIfThenElsefunctoid_C6A8/IfThenElse.zip" target="_blank"&gt;here.&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
In my next post, I will look into creating a custom functoid that does the job and
I can tell you right now; That isn't as easy as I had imagined...
&lt;/p&gt;
&lt;p&gt;
-- 
&lt;br&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=d8bc8e42-e351-4d99-908e-b809e90b614d" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,d8bc8e42-e351-4d99-908e-b809e90b614d.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=98764827-a434-4104-b030-3d8fb17833a9</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,98764827-a434-4104-b030-3d8fb17833a9.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,98764827-a434-4104-b030-3d8fb17833a9.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=98764827-a434-4104-b030-3d8fb17833a9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi all
</p>
        <p>
In almost all multiple server installations of BizTalk I have encountered, there has
been issues with MSDTC. MSDTC is Microsofts product for handling distributed transactions,
meaning transactions that span multiple servers. BizTalk uses this in high scale,
when running transactions against SQL Server, to maintain consistency in BizTalks
databases.
</p>
        <p>
All issues with MSDTC are solvable - sometimes it is just hard to figure out what
is wrong. 
</p>
        <p>
First of all, always use the DTCTester tool at <a href="http://support.microsoft.com/kb/293799">http://support.microsoft.com/kb/293799</a> to
test your MSDTC installation. If this tool reports no errors and you are still having
issues, then most likely, MSDTC isn't the cause of your issues.
</p>
        <p>
If something is wrong with MSDTC, I have encountered four major issues:
</p>
        <ol>
          <li>
MSDTC doesn't run on either of the server. Solve this by starting MSDTC. Steps to
start MSDTC (Note, that the MMC snapin is buggy, and it might appear that the "Component
Services" node has no children... but it does, trust me :-) ):</li>
        </ol>
        <ol>
          <li>
Go to "Administrative Tools" =&gt; "Component Services"</li>
          <li>
Go to "Component Services" =&gt; "Computers" =&gt; "My Computer"</li>
          <li>
Right click "My Computer" and choose "Start MS DTC".<br /><a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/Transactionsgivingyouaheadache_12380/start_msdtc.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="306" alt="start_msdtc" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/Transactionsgivingyouaheadache_12380/start_msdtc_thumb.jpg" width="522" border="0" /></a></li>
        </ol>
        <li>
MSDTC isn't configured for network access on both servers. Solve this in "add/remove
windows components" here:<br /><a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/Transactionsgivingyouaheadache_12380/install_msdtc_network_access.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="411" alt="install_msdtc_network_access" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/Transactionsgivingyouaheadache_12380/install_msdtc_network_access_thumb.jpg" width="630" border="0" /></a></li>
        <li>
The two servers have the same MS DTC ID. This ocurs if both servers are clones of
the same server or if one of the ervers is a clone of the other server. Usually, when
cloning servers, sysprep is used to clear out those errors, but in case it hasn't
been used, here is how you fix it: 
</li>
        <ol>
          <li>
Run "msdtc -uninstall" from a command prompt</li>
          <li>
reboot</li>
          <li>
Run "msdtc -install" from a command prompt</li>
          <li>
reboot</li>
        </ol>
        <li>
You can't ping the servers by hostname, which is required. This basically means, that
from both servers, you need to be able to ping the other server by hostname - pinging
by IP address isn't enough. If you can't ping by hostname, you have two options:</li>
        <ol>
          <li>
Get the network administrator to update your DNS</li>
          <li>
Enter new information into the hosts file in c:\windows\system32\drivers\etc</li>
        </ol>
        <p>
Hope this helps. 
</p>
        <p>
-- 
<br />
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=98764827-a434-4104-b030-3d8fb17833a9" />
      </body>
      <title>Transactions giving you a headache</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,98764827-a434-4104-b030-3d8fb17833a9.aspx</guid>
      <link>http://blog.eliasen.dk/2008/11/10/TransactionsGivingYouAHeadache.aspx</link>
      <pubDate>Mon, 10 Nov 2008 18:28:38 GMT</pubDate>
      <description>&lt;p&gt;
Hi all
&lt;/p&gt;
&lt;p&gt;
In almost all multiple server installations of BizTalk I have encountered, there has
been issues with MSDTC. MSDTC is Microsofts product for handling distributed transactions,
meaning transactions that span multiple servers. BizTalk uses this in high scale,
when running transactions against SQL Server, to maintain consistency in BizTalks
databases.
&lt;/p&gt;
&lt;p&gt;
All issues with MSDTC are solvable - sometimes it is just hard to figure out what
is wrong. 
&lt;/p&gt;
&lt;p&gt;
First of all, always use the DTCTester tool at &lt;a href="http://support.microsoft.com/kb/293799"&gt;http://support.microsoft.com/kb/293799&lt;/a&gt; to
test your MSDTC installation. If this tool reports no errors and you are still having
issues, then most likely, MSDTC isn't the cause of your issues.
&lt;/p&gt;
&lt;p&gt;
If something is wrong with MSDTC, I have encountered four major issues:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
MSDTC doesn't run on either of the server. Solve this by starting MSDTC. Steps to
start MSDTC (Note, that the MMC snapin is buggy, and it might appear that the "Component
Services" node has no children... but it does, trust me :-) ):&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;
Go to "Administrative Tools" =&amp;gt; "Component Services"&lt;/li&gt;
&lt;li&gt;
Go to "Component Services" =&amp;gt; "Computers" =&amp;gt; "My Computer"&lt;/li&gt;
&lt;li&gt;
Right click "My Computer" and choose "Start MS DTC".&lt;br&gt;
&lt;a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/Transactionsgivingyouaheadache_12380/start_msdtc.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="306" alt="start_msdtc" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/Transactionsgivingyouaheadache_12380/start_msdtc_thumb.jpg" width="522" border="0"&gt;&lt;/a&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;
MSDTC isn't configured for network access on both servers. Solve this in "add/remove
windows components" here:&lt;br&gt;
&lt;a href="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/Transactionsgivingyouaheadache_12380/install_msdtc_network_access.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="411" alt="install_msdtc_network_access" src="http://blog.eliasen.dk/content/binary/WindowsLiveWriter/Transactionsgivingyouaheadache_12380/install_msdtc_network_access_thumb.jpg" width="630" border="0"&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
The two servers have the same MS DTC ID. This ocurs if both servers are clones of
the same server or if one of the ervers is a clone of the other server. Usually, when
cloning servers, sysprep is used to clear out those errors, but in case it hasn't
been used, here is how you fix it: 
&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;
Run "msdtc -uninstall" from a command prompt&lt;/li&gt;
&lt;li&gt;
reboot&lt;/li&gt;
&lt;li&gt;
Run "msdtc -install" from a command prompt&lt;/li&gt;
&lt;li&gt;
reboot&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;
You can't ping the servers by hostname, which is required. This basically means, that
from both servers, you need to be able to ping the other server by hostname - pinging
by IP address isn't enough. If you can't ping by hostname, you have two options:&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;
Get the network administrator to update your DNS&lt;/li&gt;
&lt;li&gt;
Enter new information into the hosts file in c:\windows\system32\drivers\etc&lt;/li&gt;
&lt;/ol&gt;
&gt;
&lt;p&gt;
Hope this helps. 
&lt;p&gt;
-- 
&lt;br&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=98764827-a434-4104-b030-3d8fb17833a9" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,98764827-a434-4104-b030-3d8fb17833a9.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=3a40aef8-8caf-4a37-bfb9-c2a155616951</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,3a40aef8-8caf-4a37-bfb9-c2a155616951.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,3a40aef8-8caf-4a37-bfb9-c2a155616951.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=3a40aef8-8caf-4a37-bfb9-c2a155616951</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
So... 
</p>
        <p>
People sometimes ask, what is the difference between catching System.Exception and
the General Exception in a Catch Exception shape in the orchestration designer in
BizTalk.
</p>
        <p>
Off course, an obvious difference is, that with the General Exception, you don't get
an object with properties to investigate. But then it seems that the General Exception
is useless... surely there is a point to it?
</p>
        <p>
Well, I was curious about this myself, so I investigated a bit, and found <a href="http://mark.michaelis.net/Blog/ExceptionHandlingChangesInC20.aspx">this
post</a>. So basically, I think the catch of the general exception in BizTalk 2006
is a left over from BizTalk 2004. In BizTalk 2004 it made sense, since you actually
have exceptions thrown at you that didn't derive from System.Exception. That is no
longer possible in .NET 2.0 - they just haven't removed it from the designer - probably
just to be backwards compatible.
</p>
        <p>
That's it...
</p>
        <p>
-- 
<br />
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=3a40aef8-8caf-4a37-bfb9-c2a155616951" />
      </body>
      <title>System.Exception vs. General Exception</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,3a40aef8-8caf-4a37-bfb9-c2a155616951.aspx</guid>
      <link>http://blog.eliasen.dk/2007/12/12/SystemExceptionVsGeneralException.aspx</link>
      <pubDate>Wed, 12 Dec 2007 18:53:15 GMT</pubDate>
      <description>&lt;p&gt;
So... 
&lt;/p&gt;
&lt;p&gt;
People sometimes ask, what is the difference between catching System.Exception and
the General Exception in a Catch Exception shape in the orchestration designer in
BizTalk.
&lt;/p&gt;
&lt;p&gt;
Off course, an obvious difference is, that with the General Exception, you don't get
an object with properties to investigate. But then it seems that the General Exception
is useless... surely there is a point to it?
&lt;/p&gt;
&lt;p&gt;
Well, I was curious about this myself, so I investigated a bit, and found &lt;a href="http://mark.michaelis.net/Blog/ExceptionHandlingChangesInC20.aspx"&gt;this
post&lt;/a&gt;. So basically, I think the catch of the general exception in BizTalk 2006
is a left over from BizTalk 2004. In BizTalk 2004 it made sense, since you actually
have exceptions thrown at you that didn't derive from System.Exception. That is no
longer possible in .NET 2.0 - they just haven't removed it from the designer - probably
just to be backwards compatible.
&lt;/p&gt;
&lt;p&gt;
That's it...
&lt;/p&gt;
&lt;p&gt;
-- 
&lt;br&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=3a40aef8-8caf-4a37-bfb9-c2a155616951" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,3a40aef8-8caf-4a37-bfb9-c2a155616951.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=9f323fab-d449-48a0-b557-aa8da20f1aa1</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,9f323fab-d449-48a0-b557-aa8da20f1aa1.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,9f323fab-d449-48a0-b557-aa8da20f1aa1.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=9f323fab-d449-48a0-b557-aa8da20f1aa1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <font color="#000000">Hi</font>
        </p>
        <p>
          <font color="#000000">I am currently supporting an existing BizTalk 2004 environment,
and came across the need to debug an orchestration in the production environment.
Yes, I know - "Not in the production environment", you scream... but yes, indeed -
in the production environment.</font>
        </p>
        <p>
          <font color="#000000">Anyway, I set some breakpoints, waited for the orchestration
to hit the breakpoint and tried to attach to the orchestration. I got this error:</font>
        </p>
        <p>
          <font face="Verdana" color="#000000">Debugging user validation against group '&lt;servername&gt;\BizTalk
Server Administrators' failed with error: Debuging Client is not a BizTalk Server
Administrator.</font>
        </p>
        <p>
          <font face="Verdana" color="#000000">This seemed odd, so I investigated a bit further.
It turns out, that the setup is a multiple server setup, ie. one server for SQL Server
and one for BizTalk 2004. Also, it tunrs out, that the gyuy who installed the servers
didn't use domain groups. The services were running under domain accounts, but the
BizTalk groups were created on both machines. Not a supported setup, but I am hoping
they will upgrade to BizTalk 2006 R2 before long, and therefore, we are not going
to touch that.</font>
        </p>
        <p>
          <font color="#000000">Anyway, it turns out, that the user I was logged in as was a
member of the "BizTalk Server Administrators" group - but only on the BizTalk Server.
Once I added him to the same group on the SQL Server server, all was fine.</font>
        </p>
        <p>
          <font color="#000000">I googled the error, and didn't stumble upon an answer, so I
just thought I'd blog about it in case anyone has the need for the answer some day
:-)</font>
        </p>
        <p>
          <font color="#000000">-- 
<br />
eliasen</font>
        </p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=9f323fab-d449-48a0-b557-aa8da20f1aa1" />
      </body>
      <title>Error debugging orchestration in BizTalk 2004</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,9f323fab-d449-48a0-b557-aa8da20f1aa1.aspx</guid>
      <link>http://blog.eliasen.dk/2007/11/21/ErrorDebuggingOrchestrationInBizTalk2004.aspx</link>
      <pubDate>Wed, 21 Nov 2007 23:11:37 GMT</pubDate>
      <description>&lt;p&gt;
&lt;font color=#000000&gt;Hi&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;I am currently supporting an existing BizTalk 2004 environment,
and came across the need to debug an orchestration in the production environment.
Yes, I know - "Not in the production environment", you scream... but yes, indeed -
in the production environment.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;Anyway, I set some breakpoints, waited for the orchestration to
hit the breakpoint and tried to attach to the orchestration. I got this error:&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face=Verdana color=#000000&gt;Debugging user validation against group '&amp;lt;servername&amp;gt;\BizTalk
Server Administrators' failed with error: Debuging Client is not a BizTalk Server
Administrator.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face=Verdana color=#000000&gt;This seemed odd, so I investigated a bit further.
It turns out, that the setup is a multiple server setup, ie. one server for SQL Server
and one for BizTalk 2004. Also, it tunrs out, that the gyuy who installed the servers
didn't use domain groups. The services were running under domain accounts, but the
BizTalk groups were created on both machines. Not a supported setup, but I am hoping
they will upgrade to BizTalk 2006 R2 before long, and therefore, we are not going
to touch that.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;Anyway, it turns out, that the user I was logged in as was a member
of the "BizTalk Server Administrators" group - but only on the BizTalk Server. Once
I added him to the same group on the SQL Server server, all was fine.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;I googled the error, and didn't stumble upon an answer, so I just
thought I'd blog about it in case anyone has the need for the answer some day :-)&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#000000&gt;-- 
&lt;br&gt;
eliasen&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=9f323fab-d449-48a0-b557-aa8da20f1aa1" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,9f323fab-d449-48a0-b557-aa8da20f1aa1.aspx</comments>
      <category>BizTalk 2004</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=f4306b11-74b0-41f5-93e9-224d84405af0</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,f4306b11-74b0-41f5-93e9-224d84405af0.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,f4306b11-74b0-41f5-93e9-224d84405af0.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=f4306b11-74b0-41f5-93e9-224d84405af0</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi
</p>
        <p>
The other day, I suddenly found myself in a situation, where I needed to use the "Find
message" functionality and HAT to find a message, and I needed to filter on a promoted
property.
</p>
        <p>
My problems started appearing, when there were no promoted properties to select in
the Message properties filter view. I had chosen my schema, but still, the dropdowns
for promoted properties were empty.
</p>
        <p>
So I checked that tracking of both message bodies and promoted properties were enabled
in the receive port. Yes, they were... so I started wondering what might be the cause
of this. And then I though: Oh yeah, you need to enable tracking of these individually
in HAT. But in HAT I couldn't find anywhere to enable this. That stunned me for a
couple of minutes. Turns out, that was in BizTalk 2004 :-S
</p>
        <p>
Whoops :-)
</p>
        <p>
And the I remembered that I needed to do two things in order to get the tracking of
promoted properties to work:
</p>
        <p>
The first is to enable the tracking in the receive port:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/TrackingReceivePort.JPG" border="0" />
        </p>
        <p>
And the second thing is to enable tracking of each specific promoted property - and
now I remembered it isn't in HAT anymore, it is in BizTalk Server Administration for
each schema. So open BizTalk Server Administration. Go to the application that has
the schema, for which you need to track promoted properties. Go to the schemas collection
of this application, double click on the appropriate schema, go to the tracking pane,
and here you must select the properties to track.
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/TrackingSchemas.JPG" border="0" />
        </p>
        <p>
I googled this a lot, but had great difficulty finding any information... that's the
reason for this post.
</p>
        <p>
I hope others will find it useful in the future.
</p>
        <p>
Comments are welcome
</p>
        <p>
-- 
<br />
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=f4306b11-74b0-41f5-93e9-224d84405af0" />
      </body>
      <title>Tracking Promoted Properties and using them in HAT</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,f4306b11-74b0-41f5-93e9-224d84405af0.aspx</guid>
      <link>http://blog.eliasen.dk/2007/08/23/TrackingPromotedPropertiesAndUsingThemInHAT.aspx</link>
      <pubDate>Thu, 23 Aug 2007 19:46:55 GMT</pubDate>
      <description>&lt;p&gt;
Hi
&lt;/p&gt;
&lt;p&gt;
The other day, I suddenly found myself in a situation, where I needed to use the "Find
message" functionality and HAT to find a message, and I needed to filter on a promoted
property.
&lt;/p&gt;
&lt;p&gt;
My problems started appearing, when there were no promoted properties to select in
the Message properties filter view. I had chosen my schema, but still, the dropdowns
for promoted properties were empty.
&lt;/p&gt;
&lt;p&gt;
So I checked that tracking of both message bodies and promoted properties were enabled
in the receive port. Yes, they were... so I started wondering what might be the cause
of this. And then I though: Oh yeah, you need to enable tracking of these individually
in HAT. But in HAT I couldn't find anywhere to enable this. That stunned me for a
couple of minutes. Turns out, that was in BizTalk 2004 :-S
&lt;/p&gt;
&lt;p&gt;
Whoops :-)
&lt;/p&gt;
&lt;p&gt;
And the I remembered that I needed to do two things in order to get the tracking of
promoted properties to work:
&lt;/p&gt;
&lt;p&gt;
The first is to enable the tracking in the receive port:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/TrackingReceivePort.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
And the second thing is to enable tracking of each specific promoted property - and
now I remembered it isn't in HAT anymore, it is in BizTalk Server Administration for
each schema. So open BizTalk Server Administration. Go to the application that has
the schema, for which you need to track promoted properties. Go to the schemas collection
of this application, double click on the appropriate schema, go to the tracking pane,
and here you must select the properties to track.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/TrackingSchemas.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
I googled this a lot, but had great difficulty finding any information... that's the
reason for this post.
&lt;/p&gt;
&lt;p&gt;
I hope others will find it useful in the future.
&lt;/p&gt;
&lt;p&gt;
Comments are welcome
&lt;/p&gt;
&lt;p&gt;
-- 
&lt;br&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=f4306b11-74b0-41f5-93e9-224d84405af0" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,f4306b11-74b0-41f5-93e9-224d84405af0.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=fa80da9a-9c3e-4be4-9413-f31d715647d8</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,fa80da9a-9c3e-4be4-9413-f31d715647d8.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,fa80da9a-9c3e-4be4-9413-f31d715647d8.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=fa80da9a-9c3e-4be4-9413-f31d715647d8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi
</p>
        <p>
I had <a href="http://blog.eliasen.dk/PermaLink,guid,18d3629c-a462-40c3-9b9b-25ef7ef1422b.aspx">post</a> some
time ago, which explained how to promote fields from a schema generated by the SQL
Adapter. This post contains some information that could be useful for people searching
the net for information about changing the records in the generated schema into elements.
A search for those words wouldn't have my post in the top 1000 hits, though :-)
</p>
        <p>
So I thought just to have this simple post with a title that will hopefully match
what people search for, and let them find the information.
</p>
        <p>
That's it :-)
</p>
        <p>
-- 
<br />
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=fa80da9a-9c3e-4be4-9413-f31d715647d8" />
      </body>
      <title>SQL Adapter, changing records to elements</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,fa80da9a-9c3e-4be4-9413-f31d715647d8.aspx</guid>
      <link>http://blog.eliasen.dk/2007/03/04/SQLAdapterChangingRecordsToElements.aspx</link>
      <pubDate>Sun, 04 Mar 2007 21:01:32 GMT</pubDate>
      <description>&lt;p&gt;
Hi
&lt;/p&gt;
&lt;p&gt;
I had&amp;nbsp;&lt;a href="http://blog.eliasen.dk/PermaLink,guid,18d3629c-a462-40c3-9b9b-25ef7ef1422b.aspx"&gt;post&lt;/a&gt; some
time ago, which explained how to promote fields from a schema generated by the SQL
Adapter. This post contains some information that could be useful for people searching
the net for information about changing the records in the generated schema into elements.
A search for those words wouldn't have my post in the top 1000 hits, though :-)
&lt;/p&gt;
&lt;p&gt;
So I thought just to have this simple post with a title that will hopefully match
what people search for, and let them find the information.
&lt;/p&gt;
&lt;p&gt;
That's it :-)
&lt;/p&gt;
&lt;p&gt;
-- 
&lt;br&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=fa80da9a-9c3e-4be4-9413-f31d715647d8" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,fa80da9a-9c3e-4be4-9413-f31d715647d8.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=6c7ac8ec-3f3e-49e4-a15a-76c736d30654</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,6c7ac8ec-3f3e-49e4-a15a-76c736d30654.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,6c7ac8ec-3f3e-49e4-a15a-76c736d30654.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=6c7ac8ec-3f3e-49e4-a15a-76c736d30654</wfw:commentRss>
      <slash:comments>13</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi
</p>
        <p>
A guy on the microsoft.public.biztalk.orchestration newsgroup has asked about looping
around elements inside an orchestration, and I thought I'd just write some lines about
the issue here, for everybody to see in the future.
</p>
        <p>
The problem is, that he has the following document structure:
</p>
        <p>
&lt;Employees&gt;<br />
&lt;Employee title="mgr"&gt;<br />
&lt;/Employee&gt;<br />
&lt;Employee title="vp"&gt;<br />
&lt;/Employee&gt;<br />
&lt;Employee title="ceo"&gt;<br />
&lt;/Employee&gt;<br />
&lt;/Employees&gt;
</p>
        <p>
And he wants to do something with each employee, based on what the title is. As I
see it, there are two options:
</p>
        <ol>
          <li>
Loop through the Employee-elements inside the orchestration 
</li>
          <li>
Use an envelope to split the incoming Employees-message into several Employee-messages</li>
        </ol>
        <p>
          <font size="4">Suggestion 1</font>
        </p>
        <p>
I have proposed the following two schemas:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/EmployeesSchema.JPG" border="0" /> for
the big message that arrives and <img src="http://blog.eliasen.dk/content/binary/EmployeeSchema.JPG" border="0" /> for
the individual Employee. Note, that I have promoted "title" as a distinguished field.
</p>
        <p>
I then create an orchestration, that takes an instance of the Employees schema as
input, and loop around the employees. The orchestration looks like this: 
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/LoopAroundEmployee.Loop_Orchestration.jpg" border="0" />
        </p>
        <p>
It receives the incoming message, and then initializes a couple of variables. The
first expression shape, named "Initialize Loop variables" contains the following three
lines:
</p>
        <p>
empCount = xpath(InputMessage, "count(/*[local-name()='Employees' and namespace-uri()='']/*[local-name()='Employee'
and namespace-uri()=''])");<br />
counter = 1;<br />
counterStr = "1";
</p>
        <p>
Basically, I get the number of employee-elements, and initialize the counter. The
stringcounter is used to build xpath expression later, as you will see.
</p>
        <p>
Then, I loop. The loop condition is "counter &lt;= empCount" - so I want to loop as
long as there are employees.
</p>
        <p>
Inside the scope, I have declared a message employeeMessage, which is of the type
of a single employee.
</p>
        <p>
In the message assignment shape, I do this:
</p>
        <p>
EmployeeMessage = xpath(InputMessage, "/*[local-name()='Employees' and namespace-uri()='']/*[local-name()='Employee'
and namespace-uri()=''][" + counterStr + "]");
</p>
        <p>
It takes the employee from the big incoming message that corresponds to the counter
and assigns it to the message that is to be constructed.
</p>
        <p>
In the next expression shape, I just write the content of the distinguished field
"title" of the employee to the eventlog.
</p>
        <p>
And in the final expression shape, I increment the counter variables:
</p>
        <p>
counter = counter + 1;<br />
counterStr = System.Convert.ToString(counter);
</p>
        <p>
So by doing this, I am looping over the employees inside the employees-message, and
I have access to all the values inside the single employee. I didn't have to have
schema number 2, describing a single employee, I could have just used xpath all the
way down, or maybe declare an XmlNode variable to hold the employee-element instead.
But I like this solution better.
</p>
        <p>
Another option I have now is that I can add a decision shape, and based on the title
value, I can call different orchestrations, that will handle a specific employee-type.
Or perhaps I could just send the employee message to a direct-bound send port and
have other orchestrations subscribe to the employee message type. This would require
the title to be a promoted property instead of a distinguished field, though, in order
to route on it.
</p>
        <p>
          <font size="4">Suggestion 2</font>
        </p>
        <p>
I propose using an XML Envelope to split the incoming file into several employee-messages
and let the orchestration handle them individually.
</p>
        <p>
To do this, I have created two schemas:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/EmployeesEnvelopeSchema.JPG" border="0" /> for
the envelope and <img src="http://blog.eliasen.dk/content/binary/EmployeeFromEnvelopeSchema.JPG" border="0" /> for
the employee. <strong>Note:</strong> I have changed the names of the root nodes in
both schemas. Naturally, in real life you wouldn't do this. The only reason I did
this is to be able to have both my examples deployed at the same time. If I hadn't
done it, I would have had multiple schemas deployed with the same combination
of target namespace and root node, which we all know is <strong>BAD</strong>. On the
schema for the envelope, I have clicked on the "&lt;Schema&gt;"-node and in the properties
windows, I have set "Envelope" to "Yes". Then, I clicked on the "EmployeesEnvelope"-node
and in the properties window, I set the "Body XPath" property to point at the "EmployeesEnvelope"-element.
</p>
        <p>
Then, I created an orchestration, that takes an employee as the input - not the employees-type,
but the single employee. It looks like this: 
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/LoopAroundEmployeeEnvelope.Employee_Orchestration.jpg" border="0" />
        </p>
        <p>
So here I have a much smaller, simpler, and faster orchestration than the one
from suggestion 1. 
</p>
        <p>
After the solution is deployed, I create a receive location, and remember to use the
default XMLReceive pipeline. The disassembler stage will look at the incoming message,
determine the message type, see it is an envelope, split the message into smaller
messages, and publish them individually with their own message type.
</p>
        <p>
If I need different orchestrations depending on the value of the title attribute,
I can promote it to a promoted property instead of a distinguished field, and add
it to a filter on the receive shape in each orchestration.
</p>
        <p>
          <font size="4">Examples:</font>
        </p>
        <p>
I have my two samples here: <a href="http://blog.eliasen.dk/content/binary/LoopAroundEmployee.zip">LoopAroundEmployee.zip
(68,66 KB)</a> and here: <a href="http://blog.eliasen.dk/content/binary/LoopAroundEmployeeEnvelope.zip">LoopAroundEmployeeEnvelope.zip
(48,64 KB)</a></p>
        <p>
I hope this has been useful for someone. If you have any questions, just ask.
</p>
        <p>
-- 
</p>
        <p>
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=6c7ac8ec-3f3e-49e4-a15a-76c736d30654" />
      </body>
      <title>Looping around elements of a message</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,6c7ac8ec-3f3e-49e4-a15a-76c736d30654.aspx</guid>
      <link>http://blog.eliasen.dk/2006/11/05/LoopingAroundElementsOfAMessage.aspx</link>
      <pubDate>Sun, 05 Nov 2006 13:04:11 GMT</pubDate>
      <description>&lt;p&gt;
Hi
&lt;/p&gt;
&lt;p&gt;
A guy on the microsoft.public.biztalk.orchestration newsgroup has asked about looping
around elements inside an orchestration, and I thought I'd just write some lines about
the issue here, for everybody to see in the future.
&lt;/p&gt;
&lt;p&gt;
The problem is, that he has the following document structure:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;Employees&amp;gt;&lt;br&gt;
&amp;lt;Employee title="mgr"&amp;gt;&lt;br&gt;
&amp;lt;/Employee&amp;gt;&lt;br&gt;
&amp;lt;Employee title="vp"&amp;gt;&lt;br&gt;
&amp;lt;/Employee&amp;gt;&lt;br&gt;
&amp;lt;Employee title="ceo"&amp;gt;&lt;br&gt;
&amp;lt;/Employee&amp;gt;&lt;br&gt;
&amp;lt;/Employees&amp;gt;
&lt;/p&gt;
&lt;p&gt;
And he wants to do something with each employee, based on what the title is. As I
see it, there are two options:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Loop through the Employee-elements inside the orchestration 
&lt;li&gt;
Use an envelope to split the incoming Employees-message into several Employee-messages&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;font size=4&gt;Suggestion 1&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
I have proposed the following two schemas:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/EmployeesSchema.JPG" border=0&gt;&amp;nbsp;for
the big message that arrives and &lt;img src="http://blog.eliasen.dk/content/binary/EmployeeSchema.JPG" border=0&gt;&amp;nbsp;for
the individual Employee. Note, that I have promoted "title" as a distinguished field.
&lt;/p&gt;
&lt;p&gt;
I then create an orchestration, that takes an instance of the Employees schema as
input, and loop around the employees. The orchestration looks like this: 
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/LoopAroundEmployee.Loop_Orchestration.jpg" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
It receives the incoming message, and then initializes a couple of variables. The
first expression shape, named "Initialize Loop variables" contains the following three
lines:
&lt;/p&gt;
&lt;p&gt;
empCount = xpath(InputMessage, "count(/*[local-name()='Employees' and namespace-uri()='']/*[local-name()='Employee'
and namespace-uri()=''])");&lt;br&gt;
counter = 1;&lt;br&gt;
counterStr = "1";
&lt;/p&gt;
&lt;p&gt;
Basically, I get the number of employee-elements, and initialize the counter. The
stringcounter is used to build xpath expression later, as you will see.
&lt;/p&gt;
&lt;p&gt;
Then, I loop. The loop condition is "counter &amp;lt;= empCount" - so I want to loop as
long as there are employees.
&lt;/p&gt;
&lt;p&gt;
Inside the scope, I have declared a message employeeMessage, which is of the type
of a single employee.
&lt;/p&gt;
&lt;p&gt;
In the message assignment shape, I do this:
&lt;/p&gt;
&lt;p&gt;
EmployeeMessage = xpath(InputMessage, "/*[local-name()='Employees' and namespace-uri()='']/*[local-name()='Employee'
and namespace-uri()=''][" + counterStr + "]");
&lt;/p&gt;
&lt;p&gt;
It takes the employee from the big incoming message that corresponds to the counter
and assigns it to&amp;nbsp;the message that is to be constructed.
&lt;/p&gt;
&lt;p&gt;
In the next expression shape, I just write the content of the distinguished field
"title" of the employee to the eventlog.
&lt;/p&gt;
&lt;p&gt;
And in the final expression shape, I increment the counter variables:
&lt;/p&gt;
&lt;p&gt;
counter = counter + 1;&lt;br&gt;
counterStr = System.Convert.ToString(counter);
&lt;/p&gt;
&lt;p&gt;
So by doing this, I am looping over the employees inside the employees-message, and
I have access to all the values inside the single employee. I didn't have to have
schema number 2, describing a single employee, I could have just used xpath all the
way down, or maybe declare an XmlNode variable to hold the employee-element instead.
But I like this solution better.
&lt;/p&gt;
&lt;p&gt;
Another option I have now is that I can add a decision shape, and based on the title
value, I can call different orchestrations, that will handle a specific employee-type.
Or perhaps I could just send the employee message to a direct-bound send port and
have other orchestrations subscribe to the employee message type. This would require
the title to be a promoted property instead of a distinguished field, though, in order
to route on it.
&lt;/p&gt;
&lt;p&gt;
&lt;font size=4&gt;Suggestion 2&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
I propose using an XML Envelope to split the incoming file into several employee-messages
and let the orchestration handle them individually.
&lt;/p&gt;
&lt;p&gt;
To do this, I have created two schemas:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/EmployeesEnvelopeSchema.JPG" border=0&gt;&amp;nbsp;for
the envelope and &lt;img src="http://blog.eliasen.dk/content/binary/EmployeeFromEnvelopeSchema.JPG" border=0&gt;&amp;nbsp;for
the employee. &lt;strong&gt;Note:&lt;/strong&gt; I have changed the names of the root nodes in
both schemas. Naturally, in real life you wouldn't do this. The only reason I did
this is to be able to have both my examples deployed at the same time. If I hadn't
done it,&amp;nbsp;I would have had multiple schemas deployed with the same combination
of target namespace and root node, which we all know is &lt;strong&gt;BAD&lt;/strong&gt;. On the
schema for the envelope, I have clicked on the "&amp;lt;Schema&amp;gt;"-node and in the properties
windows, I have set "Envelope" to "Yes". Then, I clicked on the "EmployeesEnvelope"-node
and in the properties window, I set the "Body XPath" property to point at the "EmployeesEnvelope"-element.
&lt;/p&gt;
&lt;p&gt;
Then, I created an orchestration, that takes an employee as the input - not the employees-type,
but the single employee. It looks like this: 
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/LoopAroundEmployeeEnvelope.Employee_Orchestration.jpg" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
So here I have a much smaller,&amp;nbsp;simpler, and faster orchestration than the one
from suggestion 1. 
&lt;/p&gt;
&lt;p&gt;
After the solution is deployed, I create a receive location, and remember to use the
default XMLReceive pipeline. The disassembler stage will look at the incoming message,
determine the message type, see it is an envelope, split the message into smaller
messages, and publish them individually with their own message type.
&lt;/p&gt;
&lt;p&gt;
If I need different orchestrations depending on the value of the title attribute,
I can promote it to a promoted property instead of a distinguished field, and add
it to a filter on the receive shape in each orchestration.
&lt;/p&gt;
&lt;p&gt;
&lt;font size=4&gt;Examples:&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
I have my two samples here: &lt;a href="http://blog.eliasen.dk/content/binary/LoopAroundEmployee.zip"&gt;LoopAroundEmployee.zip
(68,66 KB)&lt;/a&gt;&amp;nbsp;and here: &lt;a href="http://blog.eliasen.dk/content/binary/LoopAroundEmployeeEnvelope.zip"&gt;LoopAroundEmployeeEnvelope.zip
(48,64 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I hope this has been useful for someone. If you have any questions, just ask.
&lt;/p&gt;
&lt;p&gt;
-- 
&lt;/p&gt;
&lt;p&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=6c7ac8ec-3f3e-49e4-a15a-76c736d30654" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,6c7ac8ec-3f3e-49e4-a15a-76c736d30654.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=44fab7d1-edde-4d75-b477-6e1dc676c34a</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,44fab7d1-edde-4d75-b477-6e1dc676c34a.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,44fab7d1-edde-4d75-b477-6e1dc676c34a.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=44fab7d1-edde-4d75-b477-6e1dc676c34a</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi
</p>
        <p>
Every now and then, I come across the need of adding a node to the output of a BizTalk
map.
</p>
        <p>
Now, if I just want to add some node which isn't dependent on the input, I can just
use a custom scripting functoid which is an XSLT template that just craeted the node
for me, like this:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/addinganode1.JPG" border="0" />
        </p>
        <p>
Use the "Inline XSLT Call Template" instead, if you need parameters to your XSLT.
</p>
        <p>
BUT, sometimes I need to add a node to a list of existing nodes. One example of this
I came across was the need to have a log inside the XML structure that was updated
every time BizTalk touched the document. So there would be a structure inside the
XML like this:
</p>
        <p>
&lt;TheLog&gt;<br />
&lt;LogEntry&gt;This is the first log entry and it was added by Jan&lt;/LogEntry&gt;<br />
&lt;LogEntry&gt;This is the second entry and it was added by BizTalk&lt;/LogEntry&gt;<br />
&lt;/TheLog&gt;
</p>
        <p>
So BizTalk needed to add a line to TheLog when BizTalk mapped the document. 
</p>
        <p>
Another example is a guy on the microsoft.public.biztalk.general newsgroup that needs
to add an OrderItem to an existing list of OrderItems.
</p>
        <p>
To do this, I have only found one solution, which is a custom xslt script that does
the whole thing.
</p>
        <p>
My example input schema:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/addinganode_inputschema.JPG" border="0" />
        </p>
        <p>
My example output schema:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/addinganode_outputschema.JPG" border="0" />
        </p>
        <p>
In both schemas, the "Order"-element can occur multiple times.
</p>
        <p>
The map looks like this:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/addinganode_map.JPG" border="0" />
        </p>
        <p>
Basically, just one scripting functoid. Note that no links go from the source document.
The scripting functoid is a "Inline XSLT" type, and the source is this:
</p>
        <p>
&lt;xsl:for-each select="//Orders/Order"&gt;<br />
&lt;xsl:element name="Order"&gt;<br />
&lt;xsl:element name="Ordernumber"&gt;&lt;xsl:value-of select="Ordernumber" /&gt;&lt;/xsl:element&gt;<br />
&lt;xsl:element name="OrderAmount"&gt;&lt;xsl:value-of select="Amount" /&gt;&lt;/xsl:element&gt;<br />
&lt;/xsl:element&gt;<br />
&lt;/xsl:for-each&gt;
</p>
        <p>
&lt;xsl:element name="Order"&gt;<br />
    &lt;xsl:element name="Ordernumber"&gt;400&lt;/xsl:element&gt;<br />
    &lt;xsl:element name="OrderAmount"&gt;40&lt;/xsl:element&gt;<br />
&lt;/xsl:element&gt;
</p>
        <p>
Basically, the for-each creates line in the output according to the input XML document.
And the xsl:element after the for-each creates the new node.
</p>
        <p>
You can find my BizTalk 2006 project here: <a href="http://blog.eliasen.dk/content/binary/AddingANode.zip">AddingANode.zip
(16,89 KB)</a> - it should work with BizTalk 2004 as well.
</p>
        <p>
I hope this has helped someone. Comments are welcome.
</p>
        <p>
-- 
</p>
        <p>
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=44fab7d1-edde-4d75-b477-6e1dc676c34a" />
      </body>
      <title>Adding a node to the output of a BizTalk map</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,44fab7d1-edde-4d75-b477-6e1dc676c34a.aspx</guid>
      <link>http://blog.eliasen.dk/2006/10/13/AddingANodeToTheOutputOfABizTalkMap.aspx</link>
      <pubDate>Fri, 13 Oct 2006 21:26:57 GMT</pubDate>
      <description>&lt;p&gt;
Hi
&lt;/p&gt;
&lt;p&gt;
Every now and then, I come across the need of adding a node to the output of a BizTalk
map.
&lt;/p&gt;
&lt;p&gt;
Now, if I just want to add some node which isn't dependent on the input, I can just
use a custom scripting functoid which is an XSLT template that just craeted the node
for me, like this:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/addinganode1.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Use the "Inline XSLT Call Template" instead, if you need parameters to your XSLT.
&lt;/p&gt;
&lt;p&gt;
BUT, sometimes I need to add a node to a list of existing nodes. One example of this
I came across was the need to have a log inside the XML structure that was updated
every time BizTalk touched the document. So there would be a structure inside the
XML like this:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;TheLog&amp;gt;&lt;br&gt;
&amp;lt;LogEntry&amp;gt;This is the first log entry and it was added by Jan&amp;lt;/LogEntry&amp;gt;&lt;br&gt;
&amp;lt;LogEntry&amp;gt;This is the second entry and it was added by BizTalk&amp;lt;/LogEntry&amp;gt;&lt;br&gt;
&amp;lt;/TheLog&amp;gt;
&lt;/p&gt;
&lt;p&gt;
So BizTalk needed to add a line to TheLog when BizTalk mapped the document. 
&lt;/p&gt;
&lt;p&gt;
Another example is a guy on the microsoft.public.biztalk.general newsgroup that needs
to add an OrderItem to an existing list of OrderItems.
&lt;/p&gt;
&lt;p&gt;
To do this, I have only found one solution, which is a custom xslt script that does
the whole thing.
&lt;/p&gt;
&lt;p&gt;
My example input schema:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/addinganode_inputschema.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
My example output schema:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/addinganode_outputschema.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
In both schemas, the "Order"-element can occur multiple times.
&lt;/p&gt;
&lt;p&gt;
The map looks like this:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/addinganode_map.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
Basically, just one scripting functoid. Note that no links go from the source document.
The scripting functoid is a "Inline XSLT" type, and the source is this:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;xsl:for-each select="//Orders/Order"&amp;gt;&lt;br&gt;
&amp;lt;xsl:element name="Order"&amp;gt;&lt;br&gt;
&amp;lt;xsl:element name="Ordernumber"&amp;gt;&amp;lt;xsl:value-of select="Ordernumber" /&amp;gt;&amp;lt;/xsl:element&amp;gt;&lt;br&gt;
&amp;lt;xsl:element name="OrderAmount"&amp;gt;&amp;lt;xsl:value-of select="Amount" /&amp;gt;&amp;lt;/xsl:element&amp;gt;&lt;br&gt;
&amp;lt;/xsl:element&amp;gt;&lt;br&gt;
&amp;lt;/xsl:for-each&amp;gt;
&lt;/p&gt;
&lt;p&gt;
&amp;lt;xsl:element name="Order"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:element name="Ordernumber"&amp;gt;400&amp;lt;/xsl:element&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:element name="OrderAmount"&amp;gt;40&amp;lt;/xsl:element&amp;gt;&lt;br&gt;
&amp;lt;/xsl:element&amp;gt;
&lt;/p&gt;
&lt;p&gt;
Basically, the for-each creates line in the output according to the input XML document.
And the xsl:element after the for-each creates the new node.
&lt;/p&gt;
&lt;p&gt;
You can find my BizTalk 2006 project here: &lt;a href="http://blog.eliasen.dk/content/binary/AddingANode.zip"&gt;AddingANode.zip
(16,89 KB)&lt;/a&gt;&amp;nbsp;- it should work with BizTalk 2004 as well.
&lt;/p&gt;
&lt;p&gt;
I hope this has helped someone. Comments are welcome.
&lt;/p&gt;
&lt;p&gt;
-- 
&lt;/p&gt;
&lt;p&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=44fab7d1-edde-4d75-b477-6e1dc676c34a" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,44fab7d1-edde-4d75-b477-6e1dc676c34a.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=56dfe07d-386b-4706-b7f9-7d9d15861459</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,56dfe07d-386b-4706-b7f9-7d9d15861459.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,56dfe07d-386b-4706-b7f9-7d9d15861459.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=56dfe07d-386b-4706-b7f9-7d9d15861459</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi
</p>
        <p>
A user in the microsoft.public.biztalk.general newsgroup has a challenge he'd like
solved.
</p>
        <p>
Basically, he has this structure:
</p>
        <p>
&lt;Root&gt;<br />
  &lt;Employee&gt;<br />
     &lt;EmployeeID&gt;1&lt;/EmployeeID&gt;<br />
     &lt;JobsAssigned&gt;10&lt;/JobsAssigned&gt;<br />
  &lt;/Employee&gt;<br />
  &lt;Employee&gt;<br />
     &lt;EmployeeID&gt;2&lt;/EmployeeID&gt;<br />
     &lt;JobsAssigned&gt;5&lt;/JobsAssigned&gt;<br />
  &lt;/Employee&gt;<br />
  &lt;Employee&gt;<br />
     &lt;EmployeeID&gt;3&lt;/EmployeeID&gt;<br />
     &lt;JobsAssigned&gt;8&lt;/JobsAssigned&gt;<br />
  &lt;/Employee&gt;<br />
&lt;/Root&gt;
</p>
        <p>
And he needs to find the EmployeeID of the employee that has the least jobs assigned
to him/her. In this case, he needs the value "2".
</p>
        <p>
This is a case, where the "Cumulative Minimum" functoid can be used.
</p>
        <p>
So, I have this input schema:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/instance_schema_cumulative_minimum.JPG" border="0" />
        </p>
        <p>
and I have this fictitious output schema:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/output_schema_cumulative_minimum.JPG" border="0" />
        </p>
        <p>
To do the task, I use this map:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/map_cumulative_minimum.JPG" border="0" />
        </p>
        <p>
Basically, I just map the fields, and then I make sure the "MinValues"-record is only
created when the JobsAssigned value is equal to the cumulative minimum of the JobsAssigned.
</p>
        <p>
The "Cumulative Minimum" functoid will return the smallest number of all the numbers
it is given as input.
</p>
        <p>
So, given the above mentioned input instance, the output of this map will be:
</p>
        <p>
&lt;ns0:OutputRoot xmlns:ns0="<a href="http://CumulativeMinimum.OutputSchema">http://CumulativeMinimum.OutputSchema</a>"&gt;<br />
&lt;MinValues&gt;<br />
  &lt;Employee&gt;2&lt;/Employee&gt; 
<br />
  &lt;JobsAssigned&gt;5&lt;/JobsAssigned&gt; <br />
&lt;/MinValues&gt;<br />
&lt;/ns0:OutputRoot&gt;
</p>
        <p>
which, luckily, was what we needed :-)
</p>
        <p>
Given an instance with more than one Employee hacing the same number of JobsAssigned
and if this number is the minimum, the map will actually create a node for each.
</p>
        <p>
As I don't know more of what the question-asker wants, I will let this be enough for
now. Should it not be ok to return more than one EmployeeID in the output, the map
will need to be changed.
</p>
        <p>
I hope this has helped someone.
</p>
        <p>
You can find a BizTalk 2006 project here: <a href="http://blog.eliasen.dk/content/binary/CumulativeMinimum.zip">CumulativeMinimum.zip
(4,51 KB)</a></p>
        <p>
The same will work for BizTalk 2004 - I just haven't been bothered creating the example.
Let me know if you need it.
</p>
        <p>
-- 
</p>
        <p>
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=56dfe07d-386b-4706-b7f9-7d9d15861459" />
      </body>
      <title>Cumulative Minimum - an example</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,56dfe07d-386b-4706-b7f9-7d9d15861459.aspx</guid>
      <link>http://blog.eliasen.dk/2006/10/13/CumulativeMinimumAnExample.aspx</link>
      <pubDate>Fri, 13 Oct 2006 20:23:30 GMT</pubDate>
      <description>&lt;p&gt;
Hi
&lt;/p&gt;
&lt;p&gt;
A user in the microsoft.public.biztalk.general newsgroup has a challenge he'd like
solved.
&lt;/p&gt;
&lt;p&gt;
Basically, he has this structure:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;Root&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Employee&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;EmployeeID&amp;gt;1&amp;lt;/EmployeeID&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;JobsAssigned&amp;gt;10&amp;lt;/JobsAssigned&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/Employee&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Employee&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;EmployeeID&amp;gt;2&amp;lt;/EmployeeID&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;JobsAssigned&amp;gt;5&amp;lt;/JobsAssigned&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/Employee&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Employee&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;EmployeeID&amp;gt;3&amp;lt;/EmployeeID&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;JobsAssigned&amp;gt;8&amp;lt;/JobsAssigned&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/Employee&amp;gt;&lt;br&gt;
&amp;lt;/Root&amp;gt;
&lt;/p&gt;
&lt;p&gt;
And he needs to find the EmployeeID of the employee that has the least jobs assigned
to him/her. In this case, he needs the value "2".
&lt;/p&gt;
&lt;p&gt;
This is a case, where the "Cumulative Minimum" functoid can be used.
&lt;/p&gt;
&lt;p&gt;
So, I have this input schema:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/instance_schema_cumulative_minimum.JPG" border="0"&gt;
&lt;/p&gt;
&lt;p&gt;
and I have this fictitious output schema:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/output_schema_cumulative_minimum.JPG" border="0"&gt;
&lt;/p&gt;
&lt;p&gt;
To do the task, I use this map:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/map_cumulative_minimum.JPG" border="0"&gt;
&lt;/p&gt;
&lt;p&gt;
Basically, I just map the fields, and then I make sure the "MinValues"-record is only
created when the JobsAssigned value is equal to the cumulative minimum of the JobsAssigned.
&lt;/p&gt;
&lt;p&gt;
The "Cumulative Minimum" functoid will return the smallest number of all the numbers
it is given as input.
&lt;/p&gt;
&lt;p&gt;
So, given the above mentioned input instance, the output of this map will be:
&lt;/p&gt;
&lt;p&gt;
&amp;lt;ns0:OutputRoot xmlns:ns0="&lt;a href="http://CumulativeMinimum.OutputSchema"&gt;http://CumulativeMinimum.OutputSchema&lt;/a&gt;"&amp;gt;&lt;br&gt;
&amp;lt;MinValues&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;Employee&amp;gt;2&amp;lt;/Employee&amp;gt; 
&lt;br&gt;
&amp;nbsp; &amp;lt;JobsAssigned&amp;gt;5&amp;lt;/JobsAssigned&amp;gt;&amp;nbsp;&lt;br&gt;
&amp;lt;/MinValues&amp;gt;&lt;br&gt;
&amp;lt;/ns0:OutputRoot&amp;gt;
&lt;/p&gt;
&lt;p&gt;
which, luckily, was what we needed :-)
&lt;/p&gt;
&lt;p&gt;
Given an instance with more than one Employee hacing the same number of JobsAssigned
and if this number is the minimum, the map will actually create a node for each.
&lt;/p&gt;
&lt;p&gt;
As I don't know more of what the question-asker wants, I will let this be enough for
now. Should it not be ok to return more than one EmployeeID in the output, the map
will need to be changed.
&lt;/p&gt;
&lt;p&gt;
I hope this has helped someone.
&lt;/p&gt;
&lt;p&gt;
You can find a BizTalk 2006&amp;nbsp;project here: &lt;a href="http://blog.eliasen.dk/content/binary/CumulativeMinimum.zip"&gt;CumulativeMinimum.zip
(4,51 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The same will work for BizTalk 2004 - I just haven't been bothered creating the example.
Let me know if you need it.
&lt;/p&gt;
&lt;p&gt;
-- 
&lt;/p&gt;
&lt;p&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=56dfe07d-386b-4706-b7f9-7d9d15861459" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,56dfe07d-386b-4706-b7f9-7d9d15861459.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=6d6a1434-15b2-4502-b2a4-347b56b9d58d</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,6d6a1434-15b2-4502-b2a4-347b56b9d58d.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,6d6a1434-15b2-4502-b2a4-347b56b9d58d.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=6d6a1434-15b2-4502-b2a4-347b56b9d58d</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi
</p>
        <p>
A colleague of mine, Morten la Cour Thomsen, who is "MCTS: BizTalk Server 2004" AND
"MCTS: BizTalk Server 2006" discovered something strange the other day. In fact, it
is so strange, that I thought I'd share it here on my blog.
</p>
        <p>
Morten was on a project, where he had taken over another persons BizTalk solution.
Unfortunately for Morten, the other guy had decided to put all artefacts into one
single assembly. That's right - all schemas, all maps, pipelines, orchestrations..
the works! Just one big assembly.
</p>
        <p>
This turned out to be quite a problem for the company that had this solution, since
versioning any single artefact meant versioning the whole thing. That is also why
they until now didn't version anything. Should something need to be changed in the
big assembly, four steps were performed:
</p>
        <ol>
          <li>
Stop all receive locations 
</li>
          <li>
Make the change in the artefact that needed changing 
</li>
          <li>
Wait until all long running transactions have stopped 
</li>
          <li>
Deploy the new assembly on top of the old one, leaving all versionnumbers the same</li>
        </ol>
        <p>
Mortens job was to create a better architecture, since it really wasn't ok with the
customer to have to stop receiving new messages until all orchestrations had stopped.
</p>
        <p>
One of the steps Morten came across was that he actually at some point needed to call
an orchestration that was inside this big assembly. The orchestration that Morten
needed to call was being called from other orchestrations inside the assembly, so
it was ready to be called (no activate receive shape, etc.). The only problem for
Morten was, that the orchestration, off course, was internal to the assembly. Morten
could reference the assembly, but he couldn't call the orchestration from within an
"Call Orchestration"-shape.
</p>
        <p>
But that's when Morten tried something that I would never have thought of trying:
He had the source code for the big assembly. And he had the keyfile that had been
used to sign it. So he changed the orchestration to be public, recompiled the big
assembly, referenced the newly compiled assembly, added the former internal orchestration
to his "Call Orchestration"-shape and compiled his own assembly.
</p>
        <p>
He now deployed his own assembly, but left the old big assembly in place. 
</p>
        <p>
Now he had the old big assembly, which still had the internal orchestration inside
it. And he had another deployed assembly, which was compiled against the source code
with a public orchestration. The big assembly was never redeployed!
</p>
        <p>
But it worked! Mortens orchestration is now calling the internal orchestration of
the other assembly, simply because it was compiled against a public orchestration
and the signature of the deployed big assembly matches the signature of his newly
compiled big assembly.
</p>
        <p>
Very weird, indeed. And it probably isn't meant to do that...
</p>
        <p>
I have a sample solution for BizTalk 2004 you can look at right here: <a href="http://blog.eliasen.dk/content/binary/InternalOrchestration.zip">InternalOrchestration.zip
(132 KB)</a></p>
        <p>
And two sample projects for BizTalk 2006 right here: <a href="http://blog.eliasen.dk/content/binary/Calling Internal Orchestration.zip">Calling
Internal Orchestration.zip (146,46 KB)</a></p>
        <p>
In both cases, the code reflects the internal orchestration AFTER it has been set
to public. What you want to do is to
</p>
        <ol>
          <li>
Set the type to "internal" on the called internal orchestration.</li>
          <li>
Build and deploy the assembly with the internal orchestration.</li>
          <li>
Test it to see that it works.</li>
          <li>
Try to build the other assembly. It will fail because of the internal orchestration.</li>
          <li>
Set the type to "public" on the called orchestration.</li>
          <li>
Build and deploy the second assembly WITHOUT redeploying the first assembly.</li>
          <li>
Test it to make sure it works.</li>
        </ol>
        <p>
So, basically, now you have a way of calling an internal orchestration, as long as
you have the source code for it and the key to sign it.
</p>
        <p>
Hope this is useful for someone.
</p>
        <p>
-- 
</p>
        <p>
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=6d6a1434-15b2-4502-b2a4-347b56b9d58d" />
      </body>
      <title>Calling Internal Orchestration from another assembly.</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,6d6a1434-15b2-4502-b2a4-347b56b9d58d.aspx</guid>
      <link>http://blog.eliasen.dk/2006/09/24/CallingInternalOrchestrationFromAnotherAssembly.aspx</link>
      <pubDate>Sun, 24 Sep 2006 21:07:52 GMT</pubDate>
      <description>&lt;p&gt;
Hi
&lt;/p&gt;
&lt;p&gt;
A colleague of mine, Morten la Cour Thomsen, who is "MCTS: BizTalk Server 2004" AND
"MCTS: BizTalk Server 2006" discovered something strange the other day. In fact, it
is so strange, that I thought I'd share it here on my blog.
&lt;/p&gt;
&lt;p&gt;
Morten was on a project, where he had taken over another persons BizTalk solution.
Unfortunately for Morten, the other guy had decided to put all artefacts into one
single assembly. That's right - all schemas, all maps, pipelines, orchestrations..
the works! Just one big assembly.
&lt;/p&gt;
&lt;p&gt;
This turned out to be quite a problem for the company that had this solution, since
versioning any single artefact meant versioning the whole thing. That is also why
they until now didn't version anything. Should something need to be changed in the
big assembly,&amp;nbsp;four steps were performed:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Stop all receive locations 
&lt;li&gt;
Make the change in the artefact that needed changing 
&lt;li&gt;
Wait until all long running transactions have stopped 
&lt;li&gt;
Deploy the new assembly on top of the old one, leaving all versionnumbers the same&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Mortens job was to create a better architecture, since it really wasn't ok with the
customer to have to stop receiving new messages until all orchestrations had stopped.
&lt;/p&gt;
&lt;p&gt;
One of the steps Morten came across was that he actually at some point needed to call
an orchestration that was inside this big assembly. The orchestration that Morten
needed to call was being called from other orchestrations inside the assembly, so
it was ready to be called (no activate receive shape, etc.). The only problem for
Morten was, that the orchestration, off course, was internal to the assembly. Morten
could reference the assembly, but he couldn't call the orchestration from within an
"Call Orchestration"-shape.
&lt;/p&gt;
&lt;p&gt;
But that's when Morten tried something that I would never have thought of trying:
He had the source code for the big assembly. And he had the keyfile that had been
used to sign it. So he changed the orchestration to be public, recompiled the big
assembly, referenced the newly compiled assembly, added the former internal orchestration
to his "Call Orchestration"-shape and compiled his own assembly.
&lt;/p&gt;
&lt;p&gt;
He now deployed his own assembly, but left the old big assembly in place. 
&lt;/p&gt;
&lt;p&gt;
Now he had the old big assembly, which still had the internal orchestration inside
it. And he had another deployed assembly, which was compiled against the source code
with a public orchestration. The big assembly was never redeployed!
&lt;/p&gt;
&lt;p&gt;
But it worked! Mortens orchestration is now calling the internal orchestration of
the other assembly, simply because it was compiled against a public orchestration
and the signature of the deployed big assembly matches the signature of his newly
compiled big assembly.
&lt;/p&gt;
&lt;p&gt;
Very weird, indeed. And it probably isn't meant to do that...
&lt;/p&gt;
&lt;p&gt;
I have a sample solution for BizTalk 2004 you can look at right here: &lt;a href="http://blog.eliasen.dk/content/binary/InternalOrchestration.zip"&gt;InternalOrchestration.zip
(132 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
And two&amp;nbsp;sample projects for BizTalk 2006 right here: &lt;a href="http://blog.eliasen.dk/content/binary/Calling Internal Orchestration.zip"&gt;Calling
Internal Orchestration.zip (146,46 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In both cases, the code reflects the internal orchestration AFTER it has been set
to public. What you want to do is to
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Set the type to "internal" on the called internal orchestration.&lt;/li&gt;
&lt;li&gt;
Build and deploy the assembly with the internal orchestration.&lt;/li&gt;
&lt;li&gt;
Test it to see that it works.&lt;/li&gt;
&lt;li&gt;
Try to build the other assembly. It will fail because of the internal orchestration.&lt;/li&gt;
&lt;li&gt;
Set the type to "public" on the called orchestration.&lt;/li&gt;
&lt;li&gt;
Build and deploy the second assembly WITHOUT redeploying the first assembly.&lt;/li&gt;
&lt;li&gt;
Test it to make sure it works.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
So, basically, now you have a way of calling an internal orchestration, as long as
you have the source code for it and the key to sign it.
&lt;/p&gt;
&lt;p&gt;
Hope this is useful for someone.
&lt;/p&gt;
&lt;p&gt;
-- 
&lt;/p&gt;
&lt;p&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=6d6a1434-15b2-4502-b2a4-347b56b9d58d" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,6d6a1434-15b2-4502-b2a4-347b56b9d58d.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=3e79edda-d890-4521-9b46-8d6f70c94502</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,3e79edda-d890-4521-9b46-8d6f70c94502.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,3e79edda-d890-4521-9b46-8d6f70c94502.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=3e79edda-d890-4521-9b46-8d6f70c94502</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi
</p>
        <p>
A guy (I think it is a guy, anyways :-) ) on the microsoft.public.biztalk.orchestration
newsgroup has a problem with this issue. And since I had the issue myself a long
time ago, and always wanted to write a quick blog entry about it, this seemed like
a perfect time for it :-)
</p>
        <p>
A quick note: This issue appears on both BizTalk 2004 and BizTalk 2006.
</p>
        <p>
So basically, the problem is: When compiling a BizTalk project, you get the "'projectname.orchestrationname':
cannot resolve imported 'service'" error. This occurs when you are compiling a project
that has an orchestration inside it, that calls another orchestration in another project
that again calls an orchestration in a third project. Confused? I bet! I will give
you details, screenshots and explanations in just a few lines.
</p>
        <p>
The quick answer is: The project you are trying to compile must reference the third
project.
</p>
        <p>
BUT, to the long answer:
</p>
        <p>
I have created a solution with three projects:
</p>
        <ul>
          <li>
ProjectA with ABCSchema.xsd and OrchestrationA.odx 
<ul><li>
Orchestration A does this 
<ul><li>
Receive a message of type ABCSchema.xsd 
</li><li>
Initialize a string variable to receive the value from a distinguished field in ABCSchema 
</li><li>
Write the value to the eventlog 
</li><li>
Call OrchestrationB</li></ul></li></ul></li>
          <li>
ProjectB with OrchestrationB.odx 
<ul><li>
Orchestration B does this: 
<ul><li>
Receive the string parameter from OrchestrationA 
</li><li>
Write the value to the eventlog 
</li><li>
Call OrchestrationC</li></ul></li></ul></li>
          <li>
ProjectC with OrchestrationC.odx 
<ul><li>
Orchestration C does this: 
<ul><li>
Receive the string parameter from OrchestrationB 
</li><li>
Write the value to the eventlog</li></ul></li></ul></li>
        </ul>
        <p>
Screenshots:
</p>
        <p>
The (very small) schema:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/ABCSchema.jpg" border="0" />
        </p>
        <p>
OrchestrationA:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/OrchestrationA.JPG" border="0" />
        </p>
        <p>
OrchestrationB:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/OrchestrationB.JPG" border="0" />
        </p>
        <p>
OrchestrationC:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/OrchestrationC.jpg" border="0" />
        </p>
        <p>
No hokus pokus at all!
</p>
        <p>
In order to call OrchestrationC from OrchestrationB, I added a reference to ProjectC
from ProjectB. Both ProjectB and ProjectC compile just fine.
</p>
        <p>
In order to call OrchestrationB from OrchestrationA, I add a reference to ProjectB
from ProjectA, but ProjectA wont compile. I get this error:
</p>
        <p>
          <img src="http://blog.eliasen.dk/content/binary/ABC Error.jpg" border="0" />
        </p>
        <p>
The famous "cannot resolve imported 'service'" error.
</p>
        <p>
BUT, referencing ProjectC from ProjectA solves this issue, and I can compile just
fine.
</p>
        <p>
Actually, the error description indicates it. When compiling ProjectA, it can't import
the "ProjectC.OrchestrationC" service. But often, you are maybe compiling the entire
solution, and you just see that the file in quesion is projectb.dll. But the error
just states that ProjectA cannot import ProjectC.OrchestrationC, which it needs to
according to projectb.dll.
</p>
        <p>
Should anyone think that it is really silly that ProjectA needs to reference
a dll that another dll references and that this breaks all nice architectures, I would
agree. If someone gives me a set of 20 dll's that make up a nice solution he/she has
made, and I need to call an orchestration in one of them, then I also need to reference
all the dll's that this one dll references, assuming there are internal "Call Orchestration"s
between these dll's. I will need to know how these dll's reference eachother in order
to reference one of them. Really silly, indeed.
</p>
        <p>
I don't know why they have made it like this, but they have.
</p>
        <p>
I hope this post helps others.
</p>
        <p>
Should you have comments, please don't hesitate... My three projects can be found
here: <a href="http://blog.eliasen.dk/content/binary/A_calls_B_calls_C.zip">A_calls_B_calls_C.zip
(137,08 KB)</a></p>
        <p>
-- 
</p>
        <p>
eliasen
</p>
        <img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=3e79edda-d890-4521-9b46-8d6f70c94502" />
      </body>
      <title>cannot resolve imported 'service'</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,3e79edda-d890-4521-9b46-8d6f70c94502.aspx</guid>
      <link>http://blog.eliasen.dk/2006/09/16/cannotResolveImportedService.aspx</link>
      <pubDate>Sat, 16 Sep 2006 12:00:22 GMT</pubDate>
      <description>&lt;p&gt;
Hi
&lt;/p&gt;
&lt;p&gt;
A guy (I think it is a guy, anyways :-) )&amp;nbsp;on the microsoft.public.biztalk.orchestration
newsgroup has&amp;nbsp;a problem with this issue. And since I had the issue myself a long
time ago, and always wanted to write a quick blog entry about it, this seemed like
a perfect time for it :-)
&lt;/p&gt;
&lt;p&gt;
A quick note: This issue appears on both BizTalk 2004 and BizTalk 2006.
&lt;/p&gt;
&lt;p&gt;
So basically, the problem is: When compiling a BizTalk project, you get the "'projectname.orchestrationname':
cannot resolve imported 'service'" error. This occurs when you are compiling a project
that has an orchestration inside it, that calls another orchestration in another project
that again calls an orchestration in a third project. Confused? I bet! I will give
you details, screenshots and explanations in just a few lines.
&lt;/p&gt;
&lt;p&gt;
The quick answer is: The project you are trying to compile must reference the third
project.
&lt;/p&gt;
&lt;p&gt;
BUT, to the long answer:
&lt;/p&gt;
&lt;p&gt;
I have created a solution with three projects:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
ProjectA with ABCSchema.xsd and OrchestrationA.odx 
&lt;ul&gt;
&lt;li&gt;
Orchestration A does this 
&lt;ul&gt;
&lt;li&gt;
Receive a message of type ABCSchema.xsd 
&lt;li&gt;
Initialize a string variable to receive the value from a distinguished field in ABCSchema 
&lt;li&gt;
Write the value to the eventlog 
&lt;li&gt;
Call OrchestrationB&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
ProjectB with OrchestrationB.odx 
&lt;ul&gt;
&lt;li&gt;
Orchestration B does this: 
&lt;ul&gt;
&lt;li&gt;
Receive the string parameter from OrchestrationA 
&lt;li&gt;
Write the value to the eventlog 
&lt;li&gt;
Call OrchestrationC&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
ProjectC with OrchestrationC.odx 
&lt;ul&gt;
&lt;li&gt;
Orchestration C does this: 
&lt;ul&gt;
&lt;li&gt;
Receive the string parameter from OrchestrationB 
&lt;li&gt;
Write the value to the eventlog&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Screenshots:
&lt;/p&gt;
&lt;p&gt;
The (very small) schema:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/ABCSchema.jpg" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
OrchestrationA:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/OrchestrationA.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
OrchestrationB:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/OrchestrationB.JPG" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
OrchestrationC:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/OrchestrationC.jpg" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
No hokus pokus at all!
&lt;/p&gt;
&lt;p&gt;
In order to call OrchestrationC from OrchestrationB, I added a reference to ProjectC
from ProjectB. Both ProjectB and ProjectC compile just fine.
&lt;/p&gt;
&lt;p&gt;
In order to call OrchestrationB from OrchestrationA, I add a reference to ProjectB
from ProjectA, but ProjectA wont compile. I get this error:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://blog.eliasen.dk/content/binary/ABC Error.jpg" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
The famous "cannot resolve imported 'service'" error.
&lt;/p&gt;
&lt;p&gt;
BUT, referencing ProjectC from ProjectA solves this issue, and I can compile just
fine.
&lt;/p&gt;
&lt;p&gt;
Actually, the error description indicates it. When compiling ProjectA, it can't import
the "ProjectC.OrchestrationC" service. But often, you are maybe compiling the entire
solution, and you just see that the file in quesion is projectb.dll. But the error
just states that ProjectA cannot import ProjectC.OrchestrationC, which it needs to
according to projectb.dll.
&lt;/p&gt;
&lt;p&gt;
Should anyone think that it is&amp;nbsp;really silly that ProjectA needs to reference
a dll that another dll references and that this breaks all nice architectures, I would
agree. If someone gives me a set of 20 dll's that make up a nice solution he/she has
made, and I need to call an orchestration in one of them, then I also need to reference
all the dll's that this one dll references, assuming there are internal "Call Orchestration"s
between these dll's. I will need to know how these dll's reference eachother in order
to reference one of them. Really silly, indeed.
&lt;/p&gt;
&lt;p&gt;
I don't know why they have made it like this, but they have.
&lt;/p&gt;
&lt;p&gt;
I hope this post helps others.
&lt;/p&gt;
&lt;p&gt;
Should you have comments, please don't hesitate... My three projects can be found
here: &lt;a href="http://blog.eliasen.dk/content/binary/A_calls_B_calls_C.zip"&gt;A_calls_B_calls_C.zip
(137,08 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
-- 
&lt;/p&gt;
&lt;p&gt;
eliasen
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=3e79edda-d890-4521-9b46-8d6f70c94502" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,3e79edda-d890-4521-9b46-8d6f70c94502.aspx</comments>
      <category>BizTalk 2004</category>
      <category>BizTalk 2006</category>
    </item>
    <item>
      <trackback:ping>http://blog.eliasen.dk/Trackback.aspx?guid=5c2d6137-582b-4ead-8481-583aec28a0ac</trackback:ping>
      <pingback:server>http://blog.eliasen.dk/pingback.aspx</pingback:server>
      <pingback:target>http://blog.eliasen.dk/PermaLink,guid,5c2d6137-582b-4ead-8481-583aec28a0ac.aspx</pingback:target>
      <dc:creator>Jan Eliasen</dc:creator>
      <wfw:comment>http://blog.eliasen.dk/CommentView,guid,5c2d6137-582b-4ead-8481-583aec28a0ac.aspx</wfw:comment>
      <wfw:commentRss>http://blog.eliasen.dk/SyndicationService.asmx/GetEntryCommentsRss?guid=5c2d6137-582b-4ead-8481-583aec28a0ac</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Hi<br /><br />
I ran into this one a while ago. I couldn't find any information about the error on
the internet, so I tried the microsoft public newsgroups. Again, no help (although
those newsgroups are a GREAT place for getting help...). Anyway, I found out, what
the error was, and it can probably be found in google groups by now, but I thought
I'd just share it here as well.<br /><br />
Basically, the problem was that BizTalk 2004 SP1 apparently has a bug. If you have
a "Call Orchestration"-shape (or a "Start Orchestration"-shape) in your orchestration,
and this shape is placed in some particular unreachable code, you get this error.<br /><br />
I had a decision shape in my orchestration, but I hadn't gotten around to deciding
what the rule in the decision shape was going to be. So I entered "1 == 1" in order
for the assembly to compile and then I could deploy it and test it for that branch
of my decision shape. Then, I wanted to test the other branch, still not knowing what
the final rule would be. So I modified the orchestration to have the rule to be "1
!= 1" - but then I couldn't compile - weird, eh?<br /><br />
Below is my orchestration.<br /><br /><br /><img src="content/binary/CompileErrorWhenDecisionShapeRuleIsFalse.jpg" border="0" /><br /><br />
So, as you can see - no funny stuff. Another weird thing is, that I can compile just
fine with my "Call Orchestration"-shape after a Terminate-shape. But that is unreachable
code as well.<br /><br />
I don't know what is happening, but it sure is weird.<br /><br />
I hope this posting has helped some of you.<br /><br />
You can find a copy of my project here: <a href="http://blog.eliasen.dk/content/binary/CompileErrorWhenDecisionShapeRuleIsFalse.zip">CompileErrorWhenDecisionShapeRuleIsFalse.zip
(59.09 KB)</a><br /><br />
Let me know if you have any comments.<br /><br />
-- 
<br />
eliasen<br /><img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=5c2d6137-582b-4ead-8481-583aec28a0ac" /></body>
      <title>fatal error X1001: unknown system exception</title>
      <guid isPermaLink="false">http://blog.eliasen.dk/PermaLink,guid,5c2d6137-582b-4ead-8481-583aec28a0ac.aspx</guid>
      <link>http://blog.eliasen.dk/2006/08/20/fatalErrorX1001UnknownSystemException.aspx</link>
      <pubDate>Sun, 20 Aug 2006 13:04:37 GMT</pubDate>
      <description>Hi&lt;br&gt;
&lt;br&gt;
I ran into this one a while ago. I couldn't find any information about the error on
the internet, so I tried the microsoft public newsgroups. Again, no help (although
those newsgroups are a GREAT place for getting help...). Anyway, I found out, what
the error was, and it can probably be found in google groups by now, but I thought
I'd just share it here as well.&lt;br&gt;
&lt;br&gt;
Basically, the problem was that BizTalk 2004 SP1 apparently has a bug. If you have
a "Call Orchestration"-shape (or a "Start Orchestration"-shape) in your orchestration,
and this shape is placed in some particular unreachable code, you get this error.&lt;br&gt;
&lt;br&gt;
I had a decision shape in my orchestration, but I hadn't gotten around to deciding
what the rule in the decision shape was going to be. So I entered "1 == 1" in order
for the assembly to compile and then I could deploy it and test it for that branch
of my decision shape. Then, I wanted to test the other branch, still not knowing what
the final rule would be. So I modified the orchestration to have the rule to be "1
!= 1" - but then I couldn't compile - weird, eh?&lt;br&gt;
&lt;br&gt;
Below is my orchestration.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;img src="content/binary/CompileErrorWhenDecisionShapeRuleIsFalse.jpg" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
So, as you can see - no funny stuff. Another weird thing is, that I can compile just
fine with my "Call Orchestration"-shape after a Terminate-shape. But that is unreachable
code as well.&lt;br&gt;
&lt;br&gt;
I don't know what is happening, but it sure is weird.&lt;br&gt;
&lt;br&gt;
I hope this posting has helped some of you.&lt;br&gt;
&lt;br&gt;
You can find a copy of my project here: &lt;a href="http://blog.eliasen.dk/content/binary/CompileErrorWhenDecisionShapeRuleIsFalse.zip"&gt;CompileErrorWhenDecisionShapeRuleIsFalse.zip
(59.09 KB)&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
Let me know if you have any comments.&lt;br&gt;
&lt;br&gt;
-- 
&lt;br&gt;
eliasen&lt;br&gt;
&lt;img width="0" height="0" src="http://blog.eliasen.dk/aggbug.ashx?id=5c2d6137-582b-4ead-8481-583aec28a0ac" /&gt;</description>
      <comments>http://blog.eliasen.dk/CommentView,guid,5c2d6137-582b-4ead-8481-583aec28a0ac.aspx</comments>
      <category>BizTalk 2004</category>
    </item>
  </channel>
</rss>