<?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>trace of thought (Scott Colestock) - BizTalk Tools</title>
    <link>http://www.traceofthought.net/</link>
    <description>a trace of thought on...BizTalk Server, Team Foundation Server, AppFabric, etc.</description>
    <language>en-us</language>
    <copyright>Scott Colestock</copyright>
    <lastBuildDate>Thu, 17 May 2007 19:48:19 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>scolestock@marcatopartners.net</managingEditor>
    <webMaster>scolestock@marcatopartners.net</webMaster>
    <item>
      <trackback:ping>http://www.traceofthought.net/Trackback.aspx?guid=0ddc3a73-aded-44e8-b877-0b59e8c4c332</trackback:ping>
      <pingback:server>http://www.traceofthought.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.traceofthought.net/PermaLink,guid,0ddc3a73-aded-44e8-b877-0b59e8c4c332.aspx</pingback:target>
      <dc:creator>Scott Colestock</dc:creator>
      <wfw:comment>http://www.traceofthought.net/CommentView,guid,0ddc3a73-aded-44e8-b877-0b59e8c4c332.aspx</wfw:comment>
      <wfw:commentRss>http://www.traceofthought.net/SyndicationService.asmx/GetEntryCommentsRss?guid=0ddc3a73-aded-44e8-b877-0b59e8c4c332</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <title>New release of QuickCounters...</title>
      <guid isPermaLink="false">http://www.traceofthought.net/PermaLink,guid,0ddc3a73-aded-44e8-b877-0b59e8c4c332.aspx</guid>
      <link>http://www.traceofthought.net/2007/05/17/NewReleaseOfQuickCounters.aspx</link>
      <pubDate>Thu, 17 May 2007 19:48:19 GMT</pubDate>
      <description>&lt;p&gt;
There is a new release of QuickCounters up at &lt;a href="http://codeplex.com/quickcounters"&gt;http://codeplex.com/quickcounters&lt;/a&gt;.&amp;nbsp;
Great new useability additions to the viewer application by Dave Comfort, as well
as fewer priviliges required against remote servers.&amp;nbsp; See &lt;a href="http://www.traceofthought.net/PermaLink,guid,26200471-1a98-4687-9020-6f0091f07b22.aspx"&gt;here &lt;/a&gt;for
the quick tour&amp;hellip;
&lt;/p&gt;
&lt;p&gt;
I&amp;rsquo;ll be talking about using QuickCounters with BizTalk at tonight&amp;rsquo;s &lt;a href="http://mnbiztalk.com/"&gt;Minnesota
BizTalk User Group&lt;/a&gt; meeting.&amp;nbsp; (Last night, I was presenting on using&amp;nbsp;Scrum
with Team Foundation Server at the &lt;a href="http://vstsmn.net/"&gt;Minnesota VSTS User
Group&lt;/a&gt; &amp;ndash; it&amp;rsquo;s been a busy week!)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.traceofthought.net/aggbug.ashx?id=0ddc3a73-aded-44e8-b877-0b59e8c4c332" /&gt;</description>
      <comments>http://www.traceofthought.net/CommentView,guid,0ddc3a73-aded-44e8-b877-0b59e8c4c332.aspx</comments>
      <category>BizTalk Tools</category>
    </item>
    <item>
      <trackback:ping>http://www.traceofthought.net/Trackback.aspx?guid=f0f391ca-ddad-4ef1-8bed-a6e3ee59e48e</trackback:ping>
      <pingback:server>http://www.traceofthought.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.traceofthought.net/PermaLink,guid,f0f391ca-ddad-4ef1-8bed-a6e3ee59e48e.aspx</pingback:target>
      <dc:creator>Scott Colestock</dc:creator>
      <wfw:comment>http://www.traceofthought.net/CommentView,guid,f0f391ca-ddad-4ef1-8bed-a6e3ee59e48e.aspx</wfw:comment>
      <wfw:commentRss>http://www.traceofthought.net/SyndicationService.asmx/GetEntryCommentsRss?guid=f0f391ca-ddad-4ef1-8bed-a6e3ee59e48e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Another release of QuickCounters is available - check it out! Improved WCF support,
and enhancements to the viewer. You really have to play with the library a bit to
realize what a huge benefit it can provide both to operations and performance test
investments (for fairly little investment on your part...) 
</p>
        <p>
Our CodePlex home is <a href="http://www.codeplex.com/quickcounters">here</a>. Downloads
and source code <a href="http://www.codeplex.com/quickcounters/Release/ProjectReleases.aspx">here</a>. 
</p>
        <img width="0" height="0" src="http://www.traceofthought.net/aggbug.ashx?id=f0f391ca-ddad-4ef1-8bed-a6e3ee59e48e" />
      </body>
      <title>QuickCounters update...</title>
      <guid isPermaLink="false">http://www.traceofthought.net/PermaLink,guid,f0f391ca-ddad-4ef1-8bed-a6e3ee59e48e.aspx</guid>
      <link>http://www.traceofthought.net/2007/02/01/QuickCountersUpdate.aspx</link>
      <pubDate>Thu, 01 Feb 2007 16:56:13 GMT</pubDate>
      <description>&lt;p&gt;
Another release of QuickCounters is available - check it out! Improved WCF support,
and enhancements to the viewer. You really have to play with the library a bit to
realize what a huge benefit it can provide both to operations and performance test
investments (for fairly little investment on your part...) 
&lt;/p&gt;
&lt;p&gt;
Our CodePlex home is &lt;a href="http://www.codeplex.com/quickcounters"&gt;here&lt;/a&gt;.&amp;nbsp;Downloads
and source code &lt;a href="http://www.codeplex.com/quickcounters/Release/ProjectReleases.aspx"&gt;here&lt;/a&gt;. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.traceofthought.net/aggbug.ashx?id=f0f391ca-ddad-4ef1-8bed-a6e3ee59e48e" /&gt;</description>
      <comments>http://www.traceofthought.net/CommentView,guid,f0f391ca-ddad-4ef1-8bed-a6e3ee59e48e.aspx</comments>
      <category>BizTalk Tools</category>
    </item>
    <item>
      <trackback:ping>http://www.traceofthought.net/Trackback.aspx?guid=26200471-1a98-4687-9020-6f0091f07b22</trackback:ping>
      <pingback:server>http://www.traceofthought.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.traceofthought.net/PermaLink,guid,26200471-1a98-4687-9020-6f0091f07b22.aspx</pingback:target>
      <dc:creator>Scott Colestock</dc:creator>
      <wfw:comment>http://www.traceofthought.net/CommentView,guid,26200471-1a98-4687-9020-6f0091f07b22.aspx</wfw:comment>
      <wfw:commentRss>http://www.traceofthought.net/SyndicationService.asmx/GetEntryCommentsRss?guid=26200471-1a98-4687-9020-6f0091f07b22</wfw:commentRss>
      <title>Introducing QuickCounters...</title>
      <guid isPermaLink="false">http://www.traceofthought.net/PermaLink,guid,26200471-1a98-4687-9020-6f0091f07b22.aspx</guid>
      <link>http://www.traceofthought.net/2006/12/14/IntroducingQuickCounters.aspx</link>
      <pubDate>Thu, 14 Dec 2006 22:53:19 GMT</pubDate>
      <description>    &lt;p&gt;
Have you ever wanted to get real-time metrics on:&amp;nbsp; How many times has a particular
orchestration executed on this node in the BizTalk group?&amp;nbsp; What does the average
execution time for my pipeline component looking like?&amp;nbsp; How many instances of
a particular orchestration are currently executing across the group, not including
dehydrated instances?
&lt;/p&gt;
&lt;p&gt;
Questions like this can be tough to answer - the built-in BizTalk counters are too
coarse-grained, and Tracking &amp;amp; BAM are only partially useful here (particularly
if you want high frequency samples.)&amp;nbsp; What you would like is the ability to get
fine-grained "request metrics" on all of your BizTalk orchestrations and pipelines
in a way that is simple to implement and easy to consume.
&lt;/p&gt;
&lt;p&gt;
I've been leading an open source project called &lt;strong&gt;QuickCounters&lt;/strong&gt; for
quite some time now - though we've just recently moved into CodePlex.&amp;nbsp; It is
a library that will be of interest to BizTalk developers - but it can be used in much
broader settings.&amp;nbsp; I had a chance to present on this topic at the &lt;a href="http://66.129.120.194/twincitiesnet/default.aspx"&gt; Twin
Cities .NET Users Group&lt;/a&gt; (on 11/2/2006 - presentation &lt;a href="http://www.traceventures.net/Misc/QuickCountersPresentation.pdf"&gt; here&lt;/a&gt;.)
&lt;/p&gt;
&lt;p&gt;
QuickCounters is a .NET library which makes it extremely easy to implement the common,
request-level performance counters that are interesting in just about any service
you might write.&amp;nbsp; You can use this library to instrument&amp;nbsp; general .Net components,
web services, BizTalk orchestrations, pipeline components, remoting interfaces, enterprise
service components...you get the idea.&amp;nbsp; There is special support in the library
for BizTalk and WCF scenarios, but it is quite easy to use in any case.
&lt;/p&gt;
&lt;p&gt;
QuickCounters recognizes that the Windows Performance Counter technology that has
been with us for some time is often still the best choice for providing (and consuming)
detailed performance metrics.&amp;nbsp; QuickCounters also recognizes that for any given
service request there are several metrics which turn out to be interesting for performance
testing, operational health analysis, and historical trending. The idea with QuickCounters
is to raise the level of abstraction from that of an individual performance counter
up to the request itself, using a simple API.
&lt;/p&gt;
&lt;p&gt;
Suppose you want to gather these metrics for each type of request in your system:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Requests Started&lt;/li&gt;
&lt;li&gt;
Requests Executing&lt;/li&gt;
&lt;li&gt;
Requests Completed&lt;/li&gt;
&lt;li&gt;
Requests Failed&lt;/li&gt;
&lt;li&gt;
Request Execution Time&lt;/li&gt;
&lt;li&gt;
Requests/Hour&lt;/li&gt;
&lt;li&gt;
Requests/Min&lt;/li&gt;
&lt;li&gt;
Requests/Sec&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Although the .NET performance classes would give you a good start, it will still be
a chunk of work.&amp;nbsp; With QuickCounters, you describe your requests in a &lt;a href="http://www.codeplex.com/quickcounters/Wiki/View.aspx?title=Simplest%20Sample"&gt; simple
xml format&lt;/a&gt;, and include a simple code snippet in each request implementation:
&lt;/p&gt;
&lt;pre&gt;void SampleRequest()
{
   RequestType someRequest = RequestType.Attach("MyApplication","someRequest");
   someRequest.BeginRequest();

   try
   {
      // Do useful work...
      someRequest.SetComplete();
   }
   catch
   {
      someRequest.SetAbort();
      throw;
   }
}
        &lt;/pre&gt;
&lt;p&gt;
After a quick "install" of the xml that describes your requests (via the included
"QuickCounter viewer" utility) you are on your way.&amp;nbsp; You can see all eight metrics
described above for all of your requests (which each become a Performance object)
- in PerfMon, with MOM, or any other performance counter consumer.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
For a BizTalk orchestration, you will simply have a variable of type RequestType,
which you will assign in an expression shape at the top of your orchestration via
the static "RequestType.Attach" method, followed by a call to BeginRequest:&amp;nbsp;
&lt;/p&gt;
&lt;pre&gt;quickCounterDemo = QuickCounters.RequestType.Attach(
    "QuickCounterDemo","demo",
    QuickCounterDemo(Microsoft.XLANGs.BaseTypes.InstanceId)); 
quickCounterDemo.BeginRequest();           &lt;/pre&gt;
&lt;p&gt;
Successful completion should end with another expression shape that calls SetComplete,
otherwise SetAbort.&amp;nbsp; (Full sample referenced below.)&amp;nbsp; And yes, the library
understands that an orchestration's execution will often begin on one node in your
BizTalk group and continue/complete on a different node.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Of course, if you have many requests, and many nodes in your BizTalk group, it can
be a hassle to add everything to PerfMon.&amp;nbsp; 20 requests * 3 servers = 60 interactions
with PerfMon's UI.&amp;nbsp; You might remember to save an .msc file, but you might not.&amp;nbsp;
Here is where the QuickCounter viewer comes into play.&amp;nbsp; Since you've already
written an xml file that describes your requests, just let the viewer know about that
file - &amp;nbsp;and a comma separated list of servers you are running on:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.traceofthought.net/content/binary/QuickCounterViewer1.jpg"&gt;&lt;img src="http://www.traceofthought.net/content/binary/QuickCounterViewer1_tn.jpg"/ / / / / /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;span class="subtle"&gt;(click)&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
(The viewer has benefitted substantially from John Thom's contributions...)
&lt;/p&gt;
&lt;p&gt;
Now, the WCF support in the library is...amazing, and completely the result of contributions
from &lt;a href="http://www.winterdom.com/weblog/2006/12/15/QuickCountersnetAndWCFSupport.aspx"&gt;Tomas
Restrepo&lt;/a&gt;.&amp;nbsp; Keep an eye on his blog for a full discussion, but the bottom
line is that creation of the &lt;a href="http://www.codeplex.com/quickcounters/Wiki/View.aspx?title=Simplest%20Sample"&gt; simple
xml format&lt;/a&gt; and all API calls (BeginRequest/SetComplete/SetAbort) are handled for
you &lt;em&gt;automatically&lt;/em&gt; simply by applying an attribute (or a behavior - your choice)
to your WCF service implementation.&amp;nbsp; How cool is that?
&lt;/p&gt;
&lt;p&gt;
Our CodePlex home is &lt;a href="http://www.codeplex.com/quickcounters"&gt;here&lt;/a&gt;.&amp;nbsp;
Downloads and source code &lt;a href="http://www.codeplex.com/quickcounters/Release/ProjectReleases.aspx"&gt; here&lt;/a&gt;.&amp;nbsp;
Contributors &lt;a href="http://www.codeplex.com/quickcounters/Project/ProjectPeople.aspx"&gt; here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I expect we'll release about once a month or so for awhile - give it a spin and let
us know what you think.&amp;nbsp; It is being used by some very large BizTalk projects
(in production) with good success right now.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.traceofthought.net/aggbug.ashx?id=26200471-1a98-4687-9020-6f0091f07b22" /&gt;</description>
      <comments>http://www.traceofthought.net/CommentView,guid,26200471-1a98-4687-9020-6f0091f07b22.aspx</comments>
      <category>BizTalk Tools</category>
    </item>
    <item>
      <trackback:ping>http://www.traceofthought.net/Trackback.aspx?guid=640d3834-9574-4eb1-bca2-e38b78284e63</trackback:ping>
      <pingback:server>http://www.traceofthought.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.traceofthought.net/PermaLink,guid,640d3834-9574-4eb1-bca2-e38b78284e63.aspx</pingback:target>
      <dc:creator>Scott Colestock</dc:creator>
      <wfw:comment>http://www.traceofthought.net/CommentView,guid,640d3834-9574-4eb1-bca2-e38b78284e63.aspx</wfw:comment>
      <wfw:commentRss>http://www.traceofthought.net/SyndicationService.asmx/GetEntryCommentsRss?guid=640d3834-9574-4eb1-bca2-e38b78284e63</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <div>
          <p>
In my last entry, I discussed some ways that can making working with binding files
a bit easier.  Here is another post in that same vein that addresses a common
pain point...
</p>
          <p>
            <b>Un-escaping TransportTypeData</b>
          </p>
          <p>
One of the annoying things about binding files is that adapters only have a string
element available to store adapter-specific information for send ports and receive
locations.  As a result, adapters will store escaped XML (or even "doubly escaped"
xml...)  This can be extremely hard to manage, especially for adapters such as
MQSeries that keep quite a bit of information in this form. 
</p>
          <p>
To solve this problem, I introduced a new command-line tool in the most recent version
of the <a href="http://www.traceofthought.net/CategoryView,category,Deployment%20Framework.aspx"> Deployment
Framework</a> called "ElementTunnel.exe" (the source for which is in the <a href="http://www.traceofthought.net/misc/BT2004DeployWithNAntExtraTools2.6.zip"> Tools</a> download.) 
This utility will take in an xml file, along with a file containing xpaths to elements
that should be "encoded" or "decoded".  The end result is that you can choose
to manage a "master" binding file (not directly useable) and run ElementTunnel on
it immediately prior to deployment.  (You may also run XmlPreProcess on the same
file for macro expansion! The sample in the deployment framework shows both occurring
- XmlPreProcess should occur first!)  
</p>
          <p>
So what does this mean?  An example for a single Send Port snippet: It means
that, in the case of MQSeries, instead of storing and maintaining this mess:
</p>
          <div>
            <div class="smallcode">&lt;SendPort Name="SomeQueue" IsStatic="true" IsTwoWay="false"&gt;<br />
&lt;TransmitPipeline Name="SomeAssembly.SomeQueue" FullyQualifiedName="SomeAssembly.SomeQueue,<br />
SomeAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bb955d799cc915b9" Type="2"
/&gt;<br />
&lt;PrimaryTransport&gt;<br />
&lt;Address&gt;MQS://SomeServer/SomeQM/SomeQueue&lt;/Address&gt;<br />
&lt;TransportTypeData&gt;&amp;lt;CustomProps&amp;gt;&amp;lt;AdapterConfig vt="8"&amp;gt;&amp;amp;lt;Config
xmlns:xsd= 
<br />
;"http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;<br />
amp;gt;&amp;amp;lt;uri&amp;amp;gt;MQS://SomeServer/SomeQM/ SomeQueue&amp; amp;lt;/uri&amp;amp;gt;&amp;amp;lt;queueDetails&amp;<br />
amp;gt;SomeServer/SomeQM/SomeQueue&amp;amp;lt;/queueDetails&amp;<br />
amp;gt;&amp;amp;lt;transactionSupported&amp;amp;gt;yes&amp;<br />
amp;lt;/transactionSupported&amp;amp;gt;&amp;amp;lt;dataConversion&amp;amp;gt;no&amp;amp;lt;/dataConversion&amp;<br />
amp;gt;&amp;amp;lt;segmentationAllowed&amp;amp;gt;no&amp;amp;lt;<br />
/segmentationAllowed&amp;amp;gt;&amp;amp;lt;fragmentationSize&amp;<br />
amp;gt;500&amp;amp;lt;/fragmentationSize&amp;amp;gt;&amp;amp;lt;ordered&amp; amp;gt;no&amp;amp;lt;/ordered&amp;amp;gt;&amp;amp;lt;/Config&amp;<br />
amp;gt;&amp;lt;/AdapterConfig&amp; gt;&amp;lt;/CustomProps&amp;gt;&lt;/TransportTypeData&gt;<br />
&lt;RetryCount&gt;3&lt;/RetryCount&gt;<br />
&lt;RetryInterval&gt;5&lt;/RetryInterval&gt;<br />
...<br />
&lt;/SendPort&gt;   
</div>
            <p>
You can store and maintain this:
</p>
            <div class="smallcode">
&lt;SendPort Name="SomeQueue" IsStatic="true" IsTwoWay="false"&gt;<br />
&lt;TransmitPipeline Name="SomeAssembly.SomeQueue" FullyQualifiedName="SomeAssembly.SomeQueue,<br />
SomeAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bb955d799cc915b9" Type="2"
/&gt;<br />
&lt;PrimaryTransport&gt;<br />
&lt;Address&gt;MQS://SomeServer/SomeQM/SomeQueue&lt;/Address&gt;<br />
&lt;TransportTypeData&gt;     &lt;CustomProps&gt;<br />
        &lt;AdapterConfig vt="8"&gt;<br />
            &lt;Config&gt;<br />
               
&lt;uri&gt;MQS://SomeServer/SomeQM/SomeQueue&lt;/uri&gt;<br />
               
&lt;queueDetails&gt;SomeServer/SomeQM/SomeQueue&lt;/queueDetails&gt;<br />
               
&lt;transactionSupported&gt;yes&lt;/transactionSupported&gt;<br />
               
&lt;dataConversion&gt;no&lt;/dataConversion&gt;<br />
               
&lt;segmentationAllowed&gt;no&lt;/segmentationAllowed&gt;<br />
               
&lt;fragmentationSize&gt;500&lt;/fragmentationSize&gt;<br />
               
&lt;ordered&gt;no&lt;/ordered&gt;<br />
            &lt;/Config&gt;<br />
        &lt;/AdapterConfig&gt;<br />
    &lt;/CustomProps&gt; &lt;/TransportTypeData&gt;<br />
&lt;RetryCount&gt;3&lt;/RetryCount&gt;<br />
&lt;RetryInterval&gt;5&lt;/RetryInterval&gt;<br />
...<br />
&lt;/SendPort&gt;  
</div>
            <p>
Ahhh, isn't that better?  Of course, similar goodness for all other adapters. 
And, in the clean version, you'll find it easier to place/maintain XmlPreProcess macros.  
</p>
            <p>
In the Deployment Framework sample, you'll see that we pass the following xpaths to
ElementTunnel (along with the "master" binding file itself):
</p>
            <div class="smallcode">
              <p>
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData/CustomProps/AdapterConfig<br />
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData<br />
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig<br />
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData<br /></p>
            </div>
            <br />
If you want to "unescape" your binding file (generally a one-time thing, just to get
clean content) you'll want to pass these xpaths in a slightly different order, because
of the "double escaping": 
<p></p><div class="smallcode"><p>
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData<br />
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData/CustomProps/AdapterConfig<br />
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData<br />
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig<br /></p></div><br />
So! If you are managing large binding files (where escaped xml is getting in your
way), you might find this technique handy...Grab the tool, and give it a go. 
</div>
        </div>
        <img width="0" height="0" src="http://www.traceofthought.net/aggbug.ashx?id=640d3834-9574-4eb1-bca2-e38b78284e63" />
      </body>
      <title>More Binding File Magic...</title>
      <guid isPermaLink="false">http://www.traceofthought.net/PermaLink,guid,640d3834-9574-4eb1-bca2-e38b78284e63.aspx</guid>
      <link>http://www.traceofthought.net/2005/08/12/MoreBindingFileMagic.aspx</link>
      <pubDate>Fri, 12 Aug 2005 18:32:47 GMT</pubDate>
      <description>   &lt;div&gt;
&lt;p&gt;
In my last entry, I discussed some ways that can making working with binding files
a bit easier.&amp;nbsp; Here is another post in that same vein that addresses a common
pain point...
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Un-escaping TransportTypeData&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
One of the annoying things about binding files is that adapters only have a string
element available to store adapter-specific information for send ports and receive
locations.&amp;nbsp; As a result, adapters will store escaped XML (or even "doubly escaped"
xml...)&amp;nbsp; This can be extremely hard to manage, especially for adapters such as
MQSeries that keep quite a bit of information in this form.&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
To solve this problem, I introduced a new command-line tool in the most recent version
of the &lt;a href="http://www.traceofthought.net/CategoryView,category,Deployment%20Framework.aspx"&gt; Deployment
Framework&lt;/a&gt; called "ElementTunnel.exe" (the source for which is in the &lt;a href="http://www.traceofthought.net/misc/BT2004DeployWithNAntExtraTools2.6.zip"&gt; Tools&lt;/a&gt; download.)&amp;nbsp;
This utility will take in an xml file, along with a file containing xpaths to elements
that should be "encoded" or "decoded".&amp;nbsp; The end result is that you can choose
to manage a "master" binding file (not directly useable) and run ElementTunnel on
it immediately prior to deployment.&amp;nbsp; (You may also run XmlPreProcess on the same
file for macro expansion! The sample in the deployment framework shows both occurring
- XmlPreProcess should occur first!)&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
So what does this mean?&amp;nbsp; An example for a single Send Port snippet: It means
that, in the case of MQSeries, instead of storing and maintaining this mess:
&lt;/p&gt;
&lt;div&gt;
&lt;div class="smallcode"&gt;&amp;lt;SendPort Name="SomeQueue" IsStatic="true" IsTwoWay="false"&amp;gt;&lt;br /&gt;
&amp;lt;TransmitPipeline Name="SomeAssembly.SomeQueue" FullyQualifiedName="SomeAssembly.SomeQueue,&lt;br /&gt;
SomeAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bb955d799cc915b9" Type="2"
/&amp;gt;&lt;br /&gt;
&amp;lt;PrimaryTransport&amp;gt;&lt;br /&gt;
&amp;lt;Address&amp;gt;MQS://SomeServer/SomeQM/SomeQueue&amp;lt;/Address&amp;gt;&lt;br /&gt;
&amp;lt;TransportTypeData&amp;gt;&amp;amp;lt;CustomProps&amp;amp;gt;&amp;amp;lt;AdapterConfig vt="8"&amp;amp;gt;&amp;amp;amp;lt;Config
xmlns:xsd= 
&lt;br /&gt;
;"http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;amp;&lt;br /&gt;
amp;gt;&amp;amp;amp;lt;uri&amp;amp;amp;gt;MQS://SomeServer/SomeQM/ SomeQueue&amp;amp; amp;lt;/uri&amp;amp;amp;gt;&amp;amp;amp;lt;queueDetails&amp;amp;&lt;br /&gt;
amp;gt;SomeServer/SomeQM/SomeQueue&amp;amp;amp;lt;/queueDetails&amp;amp;&lt;br /&gt;
amp;gt;&amp;amp;amp;lt;transactionSupported&amp;amp;amp;gt;yes&amp;amp;&lt;br /&gt;
amp;lt;/transactionSupported&amp;amp;amp;gt;&amp;amp;amp;lt;dataConversion&amp;amp;amp;gt;no&amp;amp;amp;lt;/dataConversion&amp;amp;&lt;br /&gt;
amp;gt;&amp;amp;amp;lt;segmentationAllowed&amp;amp;amp;gt;no&amp;amp;amp;lt;&lt;br /&gt;
/segmentationAllowed&amp;amp;amp;gt;&amp;amp;amp;lt;fragmentationSize&amp;amp;&lt;br /&gt;
amp;gt;500&amp;amp;amp;lt;/fragmentationSize&amp;amp;amp;gt;&amp;amp;amp;lt;ordered&amp;amp; amp;gt;no&amp;amp;amp;lt;/ordered&amp;amp;amp;gt;&amp;amp;amp;lt;/Config&amp;amp;&lt;br /&gt;
amp;gt;&amp;amp;lt;/AdapterConfig&amp;amp; gt;&amp;amp;lt;/CustomProps&amp;amp;gt;&amp;lt;/TransportTypeData&amp;gt;&lt;br /&gt;
&amp;lt;RetryCount&amp;gt;3&amp;lt;/RetryCount&amp;gt;&lt;br /&gt;
&amp;lt;RetryInterval&amp;gt;5&amp;lt;/RetryInterval&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/SendPort&amp;gt;&gt;&amp;nbsp; &gt; 
&lt;/div&gt;
&lt;p&gt;
You can store and maintain this:
&lt;/p&gt;
&lt;div class="smallcode"&gt;
&amp;lt;SendPort Name="SomeQueue" IsStatic="true" IsTwoWay="false"&amp;gt;&lt;br /&gt;
&amp;lt;TransmitPipeline Name="SomeAssembly.SomeQueue" FullyQualifiedName="SomeAssembly.SomeQueue,&lt;br /&gt;
SomeAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bb955d799cc915b9" Type="2"
/&amp;gt;&lt;br /&gt;
&amp;lt;PrimaryTransport&amp;gt;&lt;br /&gt;
&amp;lt;Address&amp;gt;MQS://SomeServer/SomeQM/SomeQueue&amp;lt;/Address&amp;gt;&lt;br /&gt;
&amp;lt;TransportTypeData&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;CustomProps&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;AdapterConfig vt="8"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Config&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;uri&amp;gt;MQS://SomeServer/SomeQM/SomeQueue&amp;lt;/uri&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;queueDetails&amp;gt;SomeServer/SomeQM/SomeQueue&amp;lt;/queueDetails&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;transactionSupported&amp;gt;yes&amp;lt;/transactionSupported&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;dataConversion&amp;gt;no&amp;lt;/dataConversion&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;segmentationAllowed&amp;gt;no&amp;lt;/segmentationAllowed&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;fragmentationSize&amp;gt;500&amp;lt;/fragmentationSize&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;lt;ordered&amp;gt;no&amp;lt;/ordered&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Config&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/AdapterConfig&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/CustomProps&amp;gt; &amp;lt;/TransportTypeData&amp;gt;&lt;br /&gt;
&amp;lt;RetryCount&amp;gt;3&amp;lt;/RetryCount&amp;gt;&lt;br /&gt;
&amp;lt;RetryInterval&amp;gt;5&amp;lt;/RetryInterval&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/SendPort&amp;gt;&amp;nbsp; 
&lt;/div&gt;
&lt;p&gt;
Ahhh, isn't that better?&amp;nbsp; Of course, similar goodness for all other adapters.&amp;nbsp;
And, in the clean version, you'll find it easier to place/maintain XmlPreProcess macros.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
In the Deployment Framework sample, you'll see that we pass the following xpaths to
ElementTunnel (along with the "master" binding file itself):
&lt;/p&gt;
&lt;div class="smallcode"&gt;
&lt;p&gt;
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData/CustomProps/AdapterConfig&lt;br /&gt;
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData&lt;br /&gt;
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig&lt;br /&gt;
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData&lt;br /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
If you want to "unescape" your binding file (generally a one-time thing, just to get
clean content) you'll want to pass these xpaths in a slightly different order, because
of the "double escaping": 
&lt;p&gt;
&lt;/p&gt;
&lt;div class="smallcode"&gt;
&lt;p&gt;
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData&lt;br /&gt;
/BindingInfo/ReceivePortCollection/ReceivePort/ReceiveLocations/ReceiveLocation/ ReceiveLocationTransportTypeData/CustomProps/AdapterConfig&lt;br /&gt;
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData&lt;br /&gt;
/BindingInfo/SendPortCollection/SendPort/*/TransportTypeData/CustomProps/AdapterConfig&lt;br /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
So! If you are managing large binding files (where escaped xml is getting in your
way), you might find this technique handy...Grab the tool, and give it a go. 
&lt;/div&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.traceofthought.net/aggbug.ashx?id=640d3834-9574-4eb1-bca2-e38b78284e63" /&gt;</description>
      <comments>http://www.traceofthought.net/CommentView,guid,640d3834-9574-4eb1-bca2-e38b78284e63.aspx</comments>
      <category>BizTalk Tools</category>
    </item>
    <item>
      <trackback:ping>http://www.traceofthought.net/Trackback.aspx?guid=c1164c59-72e2-49e2-be7a-47e4e8dc46d4</trackback:ping>
      <pingback:server>http://www.traceofthought.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.traceofthought.net/PermaLink,guid,c1164c59-72e2-49e2-be7a-47e4e8dc46d4.aspx</pingback:target>
      <dc:creator>Scott Colestock</dc:creator>
      <wfw:comment>http://www.traceofthought.net/CommentView,guid,c1164c59-72e2-49e2-be7a-47e4e8dc46d4.aspx</wfw:comment>
      <wfw:commentRss>http://www.traceofthought.net/SyndicationService.asmx/GetEntryCommentsRss?guid=c1164c59-72e2-49e2-be7a-47e4e8dc46d4</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <title>Messages from Scratch with Embedded Resources</title>
      <guid isPermaLink="false">http://www.traceofthought.net/PermaLink,guid,c1164c59-72e2-49e2-be7a-47e4e8dc46d4.aspx</guid>
      <link>http://www.traceofthought.net/2005/05/11/MessagesFromScratchWithEmbeddedResources.aspx</link>
      <pubDate>Wed, 11 May 2005 21:29:14 GMT</pubDate>
      <description>&lt;div&gt;
&lt;p&gt;
There have been several folks who have discussed how to create messages "from scratch"
within an Orchestration context - you can read &lt;a href="http://objectsharp.com/Blogs/matt/archive/2004/11/09/1009.aspx"&gt; Matt's
thoughts&lt;/a&gt; and check out a BizTalk &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz prog orch guxr.asp"&gt; documentation
excerpt&lt;/a&gt;. This is a common question, and I had an additional technique I thought
I would share...&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Background:&lt;/b&gt; When you have a schema that has many promoted properties (or distinguished
fields), or many elements that can be set via xpath expressions easily, it can be
useful to simply start with a "template" document instance and populate the element
content that you are interested in.&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
In this situation, you will often have a "Message Assignment" shape that looks something
like this:
&lt;/p&gt;
&lt;pre&gt;
xmlDoc.LoadXml("&amp;lt;ns0:BizTalkSampleS3 
      xmlns:ns0="http://BizTalkSample.Schemas.BizTalkSampleS3"&amp;gt;
      &amp;lt;SomeElement&amp;gt;&amp;lt;/SomeElement&amp;gt;&amp;lt;/ns0:BizTalkSampleS3&amp;gt;");
someMsg = xmlDoc;
someMsg.SomeElement = "some content";
// (or xpath(someMsg,someElementXPath) = "some content" if we don't have a 
// distinguished field.)
   &lt;/pre&gt;
&lt;p&gt;
One disadvantage of loading up "template" xml documents from either expression shapes
or code (via XmlDocument.LoadXml) is that those xml fragments can get easily "lost",
and are hard to update early in the development cycle when schemas may still be in
flux.&amp;nbsp; Loading the template files from the file system is problematic because
the question arises "where should I store these files, so that I can find them in
any environment I deploy to?" (Solvable, but a hassle.)
&lt;/p&gt;
&lt;p&gt;
Instead, why not embed the template xml documents as assembly resources?&amp;nbsp; For
those unfamiliar with that process, I have a short tutorial here (&amp;amp; a helper class.)&amp;nbsp;
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
You will need a C# project as part of your overall BizTalk solution. &amp;nbsp;Place your
template xml file(s) in the directory corresponding to this project, and add them
as an "existing item" to the project.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
Select this file within the Solution Explorer, and within the Properties window, select
"Embedded Resource" as the "Build Action" as shown here: 
&lt;p&gt;
&lt;img height="352" src="http://www.traceofthought.net/content/binary/image00212.jpg" width="344" border="0" / /&gt;&amp;nbsp;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
Place &lt;a href="http://www.traceofthought.net/misc/embeddedresourcecache.zip"&gt;this
class&lt;/a&gt; (text &lt;a href="http://www.traceofthought.net/misc/embeddedresourcecache.txt"&gt; here&lt;/a&gt;)
within the same C# project that houses the resources you have added.&lt;/li&gt;
&lt;li&gt;
To construct a message, drag out a "Message Assignment" shape, and within the associated
expression write some code like the following. &amp;nbsp;Simply pass the file name of
the template document as an argument to GetXmlDocResource (or GetStringResource.)&lt;br /&gt;
&lt;pre&gt;
sampleUsingTemplate = 
   BizTalkSample.Components.EmbeddedResourceCache.
      GetXmlDocResource("BizTalkSampleS3_output.xml");
   // Populate the "rest" of the message with distinguished fields, promoted 
   // properties, xpath expressions, etc.
   sampleUsingTemplate.SomeElement = "foo";
            &lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
The class I have supplied will cache the loaded resources in a hashtable for performance
sake, and allow you to load resources as both strings and XmlDocuments.
&lt;/p&gt;
&lt;p&gt;
A last thought: Many people ask, "Why can't I just create a message using a new operator
or a default constructor of some sort?" Well, because few XSD schemas sufficiently
constrain the set of valid instance documents enough for that to be useful - what
form would a "default message" take? (Would it have the optional elements you need?
Some elements that you don't want?)
&lt;/p&gt;
&lt;p&gt;
Enjoy - feedback appreciated!
&lt;/p&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.traceofthought.net/aggbug.ashx?id=c1164c59-72e2-49e2-be7a-47e4e8dc46d4" /&gt;</description>
      <comments>http://www.traceofthought.net/CommentView,guid,c1164c59-72e2-49e2-be7a-47e4e8dc46d4.aspx</comments>
      <category>BizTalk Tools</category>
      <category>BizTalk Insights</category>
    </item>
  </channel>
</rss>