<?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:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" version="2.0">
  <channel>
    <title>Matevž Gačnik's Weblog - .NET 3.5 - WCF</title>
    <link>https://www.request-response.com/blog/</link>
    <description>Technology Philanthropy</description>
    <image>
      <url>http://www.request-response.com/blog/images/favicon.jpg</url>
      <title>Matevž Gačnik's Weblog - .NET 3.5 - WCF</title>
      <link>https://www.request-response.com/blog/</link>
    </image>
    <language>en-us</language>
    <copyright>Matevz Gacnik</copyright>
    <lastBuildDate>Fri, 10 Apr 2009 21:06:43 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>matevz.gacnik@gmail.com</managingEditor>
    <webMaster>matevz.gacnik@gmail.com</webMaster>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=e855a729-04c4-4504-b20d-037bd13f0ec2</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,e855a729-04c4-4504-b20d-037bd13f0ec2.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,e855a729-04c4-4504-b20d-037bd13f0ec2.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e855a729-04c4-4504-b20d-037bd13f0ec2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There are a couple situations where one might use <font face="Courier New">svcutil.exe</font> in
command prompt vs. Add Service Reference in Visual Studio.
</p>
        <p>
At <em>least</em> a couple.
</p>
        <p>
I don't know who (or why) made a decision not to support namespace-less proxy generation
in  Visual Studio. It's a fact that if you make a service reference, you <strong>have
to specify a nested namespace</strong>.
</p>
        <p>
On the other end, there is an option to make the proxy class either public or internal,
which enables one to hide it from the outside world.
</p>
        <p>
That's a design flaw. There are numerous cases, where you would not want to create
another [1] namespace, because you are designing an object model that needs to be
clean.
</p>
        <p>
          <font size="1">[1] This is only limited to local type system namespace declarations
- it does not matter what you are sending over the wire.</font>
        </p>
        <p>
Consider the following namespace and class hierarchy that uses a service proxy (<font face="Courier New">MyNamespace.Service</font> class
uses it):
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/namespace4.png" />
        </p>
        <p>
Suppose that the <font face="Courier New">Service</font> class uses a WCF service,
which synchronizes articles and comments with another system. If you use Add Web Reference,
there is no way to hide the generated service namespace. One would probably define <font face="Courier New">MyNamespace.MyServiceProxy</font> as
a namespace and declared a using statement in <font face="Courier New">MyNamespace.MyService</font> scope
with:
</p>
        <p>
          <font face="Courier New">using MyNamespace.MyServiceProxy;</font>
        </p>
        <p>
This results in a dirty object model - your clients will see your internals and that
shouldn't be an option.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/namespace1.png" />
        </p>
        <p>
Your class hierarchy now has another namespace, called <font face="Courier New">MyNamespace.ServiceProxy</font>,
which is actually only used inside the <font face="Courier New">MyNamespace.Service</font> class.
</p>
        <p>
What one can do is insist that the generated classes are marked <font face="Courier New">internal</font>,
hiding the classes from the outside world, but still leaving an empty namespace visible
for instantiating assemblies.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/namespace3.png" />
        </p>
        <p>
Leaving only the namespace visible, with no public classes in it is pure cowardness. 
</p>
        <p>
Not good.
</p>
        <p>
Since there is no <font face="Courier New">internal</font> namespace modifier in .NET,
you have no other way of hiding your namespace, even if you demand internal classes
to be generated by the Add Service Reference dialog.
</p>
        <p>
So, <font face="Courier New">svcutil.exe</font> to the rescue:
</p>
        <p>
          <font face="Courier New">svcutil.exe &lt;metadata endpoint&gt;<br />
   /namespace:*, MyNamespace<br />
   /internal 
<br />
   /out:ServiceProxyClass.cs</font>
        </p>
        <p>
The <font face="Courier New">/namespace</font> option allows you to map between XML
and CLR namespace declarations. The preceding examples maps all (therefore <font face="Courier New">*</font>)
existing XML namespaces in service metadata to <font face="Courier New">MyNamespace</font> CLR
namespace.
</p>
        <p>
The example will generate a service proxy class, mark it <font face="Courier New">internal</font> and
put it into the desired namespace.
</p>
        <p>
Your object model will look like this:
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/namespace2.png" />
        </p>
        <p>
Currently, this is the only way to hide the internals of service communication with
a proxy and still being able to keep your object model clean.
</p>
        <p>
Note that this is useful when you want to wrap an existing service proxy or hide a
certain already supported service implementation detail in your object model. Since
your client code does <em>not need</em> to have access to complete service proxy (or
you want to enhance it), it shouldn't be a problem to hide it completely.
</p>
        <p>
Considering options during proxy generation, per method access modifiers would be
beneficial too.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=e855a729-04c4-4504-b20d-037bd13f0ec2" />
      </body>
      <title>Designing Clean Object Models with SvcUtil.exe</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,e855a729-04c4-4504-b20d-037bd13f0ec2.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,e855a729-04c4-4504-b20d-037bd13f0ec2.aspx</link>
      <pubDate>Fri, 10 Apr 2009 21:06:43 GMT</pubDate>
      <description>&lt;p&gt;
There are a couple situations where one might use &lt;font face="Courier New"&gt;svcutil.exe&lt;/font&gt; in
command prompt vs. Add Service Reference in Visual Studio.
&lt;/p&gt;
&lt;p&gt;
At &lt;em&gt;least&lt;/em&gt; a couple.
&lt;/p&gt;
&lt;p&gt;
I don't know who (or why) made a decision not to support namespace-less proxy generation
in&amp;nbsp; Visual Studio. It's a fact that if you make a service reference, you &lt;strong&gt;have
to specify a nested namespace&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
On the other end, there is an option to make the proxy class either public or internal,
which enables one to hide it from the outside world.
&lt;/p&gt;
&lt;p&gt;
That's a design flaw. There are numerous cases, where you would not want to create
another [1] namespace, because you are designing an object model that needs to be
clean.
&lt;/p&gt;
&lt;p&gt;
&lt;font size=1&gt;[1] This is only limited to local type system namespace declarations
- it does not matter what you are sending over the wire.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Consider the following namespace and class hierarchy that uses a service proxy (&lt;font face="Courier New"&gt;MyNamespace.Service&lt;/font&gt; class
uses it):
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.request-response.com/blog/images/namespace4.png"&gt;
&lt;/p&gt;
&lt;p&gt;
Suppose that the &lt;font face="Courier New"&gt;Service&lt;/font&gt; class uses a WCF service,
which synchronizes articles and comments with another system. If you use Add Web Reference,
there is no way to hide the generated service namespace. One would probably define &lt;font face="Courier New"&gt;MyNamespace.MyServiceProxy&lt;/font&gt; as
a namespace and declared a using statement in &lt;font face="Courier New"&gt;MyNamespace.MyService&lt;/font&gt; scope
with:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;using MyNamespace.MyServiceProxy;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
This results in a dirty object model - your clients will see your internals and that
shouldn't be an option.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.request-response.com/blog/images/namespace1.png"&gt;
&lt;/p&gt;
&lt;p&gt;
Your class hierarchy now has another namespace, called &lt;font face="Courier New"&gt;MyNamespace.ServiceProxy&lt;/font&gt;,
which is actually only used inside the &lt;font face="Courier New"&gt;MyNamespace.Service&lt;/font&gt; class.
&lt;/p&gt;
&lt;p&gt;
What one can do is insist that the generated classes are marked &lt;font face="Courier New"&gt;internal&lt;/font&gt;,
hiding the classes from the outside world, but still leaving an empty namespace visible
for instantiating assemblies.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.request-response.com/blog/images/namespace3.png"&gt;
&lt;/p&gt;
&lt;p&gt;
Leaving only the namespace visible, with no public classes in it is pure cowardness. 
&lt;/p&gt;
&lt;p&gt;
Not good.
&lt;/p&gt;
&lt;p&gt;
Since there is no &lt;font face="Courier New"&gt;internal&lt;/font&gt; namespace modifier in .NET,
you have no other way of hiding your namespace, even if you demand internal classes
to be generated by the Add Service Reference dialog.
&lt;/p&gt;
&lt;p&gt;
So, &lt;font face="Courier New"&gt;svcutil.exe&lt;/font&gt; to the rescue:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;svcutil.exe &amp;lt;metadata endpoint&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp; /namespace:*, MyNamespace&lt;br&gt;
&amp;nbsp;&amp;nbsp; /internal 
&lt;br&gt;
&amp;nbsp;&amp;nbsp; /out:ServiceProxyClass.cs&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
The &lt;font face="Courier New"&gt;/namespace&lt;/font&gt; option allows you to map between XML
and CLR namespace declarations. The preceding examples maps all (therefore &lt;font face="Courier New"&gt;*&lt;/font&gt;)
existing XML namespaces in service metadata to &lt;font face="Courier New"&gt;MyNamespace&lt;/font&gt; CLR
namespace.
&lt;/p&gt;
&lt;p&gt;
The example will generate a service proxy class, mark it &lt;font face="Courier New"&gt;internal&lt;/font&gt; and
put it into the desired namespace.
&lt;/p&gt;
&lt;p&gt;
Your object model will look like this:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.request-response.com/blog/images/namespace2.png"&gt;
&lt;/p&gt;
&lt;p&gt;
Currently, this is the only way to hide the internals of service communication with
a proxy and still being able to keep your object model clean.
&lt;/p&gt;
&lt;p&gt;
Note that this is useful when you want to wrap an existing service proxy or hide a
certain already supported service implementation detail in your object model. Since
your client code does &lt;em&gt;not need&lt;/em&gt; to have access to complete service proxy (or
you want to enhance it), it shouldn't be a problem to hide it completely.
&lt;/p&gt;
&lt;p&gt;
Considering options during proxy generation, per method access modifiers would be
beneficial too.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=e855a729-04c4-4504-b20d-037bd13f0ec2" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,e855a729-04c4-4504-b20d-037bd13f0ec2.aspx</comments>
      <category>.NET 3.5 - WCF</category>
      <category>Web Services</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of our core products, <a href="http://gama-system.com/Content.aspx?id=20050200">Gama
System eArchive</a> was <a href="http://www.merriam-webster.com/dictionary/accredit">accredited</a> last
week.
</p>
        <p>
This is <strong>the first accreditation</strong> of a domestic product and <strong>the
first one</strong> covering long term electronic document storage in a SOA based system.
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>Every document stored inside the Gama System eArchive product is now legally legal.
No questions asked.</em>
          </p>
        </blockquote>
        <p>
Accreditation is done by a <a href="http://www.arhiv.gov.si/en/">national body</a> and
represents the last step in a formal acknowledgement to holiness.
</p>
        <p align="center">
          <img src="http://www.request-response.com/blog/content/binary/archive1.jpg" />
        </p>
        <p>
That means a lot to me, even more to <a href="http://www.gama-system.si">our company</a>.
</p>
        <p>
The following blog entries were (in)directly inspired by the development of this product:
</p>
        <ul>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,f37eda08-845c-4b0a-a66c-ea9cec03c06b.aspx">Laws
and Digital Signatures</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx">Reliable
Messaging and Retry Timeouts</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx">Approaches
to Document Style Parameter Models</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx">XmlSerializer,
Ambient XML Namespaces and Digital Signatures</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,f731e5cc-9490-4f1e-bc7d-efb91f357cd1.aspx">Security
Sessions and Service Throttling</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,a6cb59e6-cbc2-4ce3-92b2-ea40bc5929f6.aspx">Reliable
Message Delivery</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,aa617aa7-1073-422c-86f5-deaaa0758e7d.aspx">Reliable
Message Delivery Continued</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,03fb0e40-b446-42b5-ad90-3be9b0260cb5.aspx">Durable
Reliable Messaging</a>
          </li>
        </ul>
        <p>
We've made <strong>a lot of effort</strong> to get this thing developed and accredited.
The certificate is <a href="http://www.request-response.com/blog/content/binary/e_ars_2007_003.pdf">here</a>.
</p>
        <p>
          <a href="http://www.arhiv.gov.si/si/e_hramba_dokumentarnega_gradiva/akreditacija/register_akreditirane_opreme_in_storitev">This</a>, <a href="http://www.posta.si/Namizje.aspx?tabid=746">this</a>, <a href="http://www.agencijanet.si/gama-system-e-arhiv-inovacija-leta-med-malimi-in-srednjimi-podjetji/">this</a>, <a href="http://finance.si/214263">this</a>, <a href="http://www.mojmikro.si/mreza/po_slovensko/ucinkovito_upravljanje_dokumentov_in_varna_e-hramba_podatkov">this</a>, <a href="http://mladipodjetnik.si/arhiv/novice/clani-tehnoloskega-parka-ljubljana-izbrani-med-10-najbolj-inovativnih-podjetij-v-sloveniji">this</a>, <a href="http://www.mojmikro.si/news/gama_system_pricakuje_preboj_med_svetovno_elito">this</a>, <a href="http://www.imix.ba/">this</a>, <a href="http://www.ashrafcom.com/edoc.htm">this</a> and <a href="http://www.si21.com/news.php?id=62696">t</a><a href="http://download.microsoft.com/download/7/D/E/7DE50907-87DD-4FFB-B10F-44A891EB49EC/cs_posta-slovenije-arhiviranje.doc">h</a><a href="http://www.agencijanet.si/slovenska-podjetja-na-cebit-u-2008/">o</a><a href="http://download.microsoft.com/download/F/2/4/F248F674-5D6E-430D-9C31-76546D57C2A3/CS%20Posta%20CEP.DOC">s</a><a href="http://www.agencijanet.si/matevzu-gacniku-ze-tretjic-mandat-microsoftovega-regionalnega-direktorja/">e</a> are
direct approvals of our correct decisions.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0" />
      </body>
      <title>Accreditus: Gama System eArchive</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0.aspx</link>
      <pubDate>Sat, 05 Jul 2008 12:18:06 GMT</pubDate>
      <description>&lt;p&gt;
One of our core products, &lt;a href="http://gama-system.com/Content.aspx?id=20050200"&gt;Gama
System eArchive&lt;/a&gt; was &lt;a href="http://www.merriam-webster.com/dictionary/accredit"&gt;accredited&lt;/a&gt; last
week.
&lt;/p&gt;
&lt;p&gt;
This is &lt;strong&gt;the first accreditation&lt;/strong&gt; of a domestic product and &lt;strong&gt;the
first one&lt;/strong&gt; covering long term electronic document storage in a SOA based system.
&lt;/p&gt;
&lt;blockquote dir=ltr style="MARGIN-RIGHT: 0px"&gt; 
&lt;p&gt;
&lt;em&gt;Every document stored inside the Gama System eArchive product is now legally legal.
No questions asked.&lt;/em&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Accreditation is done by a &lt;a href="http://www.arhiv.gov.si/en/"&gt;national body&lt;/a&gt;&amp;nbsp;and
represents the last step in a formal acknowledgement to holiness.
&lt;/p&gt;
&lt;p align=center&gt;
&lt;img src="http://www.request-response.com/blog/content/binary/archive1.jpg"&gt;
&lt;/p&gt;
&lt;p&gt;
That means a lot to me, even more to &lt;a href="http://www.gama-system.si"&gt;our company&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The following blog entries were (in)directly inspired by the development of this product:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.request-response.com/blog/PermaLink,guid,f37eda08-845c-4b0a-a66c-ea9cec03c06b.aspx"&gt;Laws
and Digital Signatures&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx"&gt;Reliable
Messaging and Retry Timeouts&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx"&gt;Approaches
to Document Style Parameter Models&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx"&gt;XmlSerializer,
Ambient XML Namespaces and Digital Signatures&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.request-response.com/blog/PermaLink,guid,f731e5cc-9490-4f1e-bc7d-efb91f357cd1.aspx"&gt;Security
Sessions and Service Throttling&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.request-response.com/blog/PermaLink,guid,a6cb59e6-cbc2-4ce3-92b2-ea40bc5929f6.aspx"&gt;Reliable
Message Delivery&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.request-response.com/blog/PermaLink,guid,aa617aa7-1073-422c-86f5-deaaa0758e7d.aspx"&gt;Reliable
Message Delivery Continued&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.request-response.com/blog/PermaLink,guid,03fb0e40-b446-42b5-ad90-3be9b0260cb5.aspx"&gt;Durable
Reliable Messaging&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
We've made &lt;strong&gt;a lot of effort&lt;/strong&gt; to get this thing developed and accredited.
The certificate is &lt;a href="http://www.request-response.com/blog/content/binary/e_ars_2007_003.pdf"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.arhiv.gov.si/si/e_hramba_dokumentarnega_gradiva/akreditacija/register_akreditirane_opreme_in_storitev"&gt;This&lt;/a&gt;, &lt;a href="http://www.posta.si/Namizje.aspx?tabid=746"&gt;this&lt;/a&gt;, &lt;a href="http://www.agencijanet.si/gama-system-e-arhiv-inovacija-leta-med-malimi-in-srednjimi-podjetji/"&gt;this&lt;/a&gt;, &lt;a href="http://finance.si/214263"&gt;this&lt;/a&gt;, &lt;a href="http://www.mojmikro.si/mreza/po_slovensko/ucinkovito_upravljanje_dokumentov_in_varna_e-hramba_podatkov"&gt;this&lt;/a&gt;, &lt;a href="http://mladipodjetnik.si/arhiv/novice/clani-tehnoloskega-parka-ljubljana-izbrani-med-10-najbolj-inovativnih-podjetij-v-sloveniji"&gt;this&lt;/a&gt;, &lt;a href="http://www.mojmikro.si/news/gama_system_pricakuje_preboj_med_svetovno_elito"&gt;this&lt;/a&gt;, &lt;a href="http://www.imix.ba/"&gt;this&lt;/a&gt;, &lt;a href="http://www.ashrafcom.com/edoc.htm"&gt;this&lt;/a&gt;&amp;nbsp;and &lt;a href="http://www.si21.com/news.php?id=62696"&gt;t&lt;/a&gt;&lt;a href="http://download.microsoft.com/download/7/D/E/7DE50907-87DD-4FFB-B10F-44A891EB49EC/cs_posta-slovenije-arhiviranje.doc"&gt;h&lt;/a&gt;&lt;a href="http://www.agencijanet.si/slovenska-podjetja-na-cebit-u-2008/"&gt;o&lt;/a&gt;&lt;a href="http://download.microsoft.com/download/F/2/4/F248F674-5D6E-430D-9C31-76546D57C2A3/CS%20Posta%20CEP.DOC"&gt;s&lt;/a&gt;&lt;a href="http://www.agencijanet.si/matevzu-gacniku-ze-tretjic-mandat-microsoftovega-regionalnega-direktorja/"&gt;e&lt;/a&gt; are
direct approvals of our correct decisions.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0.aspx</comments>
      <category>.NET 3.0 - General</category>
      <category>.NET 3.0 - WCF</category>
      <category>.NET 3.5 - WCF</category>
      <category>Other</category>
      <category>Personal</category>
      <category>Work</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As promised, here are the sources from my <a href="http://www.ntk.si">NTK 2008</a> sessions <font size="1">[1]</font>.
</p>
        <p>
          <strong>Talk: Document Style Service Interfaces</strong>
        </p>
        <p>
Read the following <a href="http://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx">blog
entry</a>, I tried to describe the concept in detail. Also, this <a href="http://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx">blog post</a> discusses
issues when using large document parameters with reliable transport  (WS-RM)
channels.
</p>
        <p>
Demo: Document Style Service Interfaces [<a href="http://www.request-response.com/blog/content/binary/NTK2008DocStyleParamModels.zip">Download</a>]
</p>
        <p>
This demo defines a service interface with the document parameter model, ie. <font face="Courier New">Guid
CreatePerson(XmlDocument person)</font>. It shows three different approaches to creation
of the passed document:
</p>
        <ol>
          <li>
Raw XML creation 
</li>
          <li>
XML Serialization of the (attribute annotated) object graph 
</li>
          <li>
XML Serialization using the <em>client object model</em></li>
        </ol>
        <p>
Also, versioned schemas for the <font face="Courier New">Person</font> document are
shown, including the support for document validation and version independence.
</p>
        <p>
          <strong>Talk: Windows Server 2008 and Transactional NTFS</strong>
        </p>
        <p>
This <a href="http://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx">blog
entry</a> describes the concept.
</p>
        <p>
Demo 1: Logging using CLFS (Common Log File System) [<a href="http://www.request-response.com/blog/content/binary/NTK2008TxFCLFS.zip">Download</a>]<br />
Demo 2: NTFS Transactions using the File System, SQL, WCF [<a href="http://www.request-response.com/blog/content/binary/NTK2008TxFFSSQLWCF.zip">Download</a>]<br />
Demo 3: NTFS Transactions using the WCF, MTOM Transport [<a href="http://www.request-response.com/blog/content/binary/NTK2008TxFWCFMTOM.zip">Download</a>] <font size="1">[2]</font></p>
        <p>
          <font size="1">[1] All sources are in VS 2008 solution file format.<br />
[2] This transaction spans from the client, through the service boundary, to the server.</font>
        </p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95" />
      </body>
      <title>Demos from the NT Conference 2008</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95.aspx</link>
      <pubDate>Thu, 15 May 2008 15:24:19 GMT</pubDate>
      <description>&lt;p&gt;
As promised, here are the sources from&amp;nbsp;my &lt;a href="http://www.ntk.si"&gt;NTK 2008&lt;/a&gt; sessions &lt;font size=1&gt;[1]&lt;/font&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Talk: Document Style Service Interfaces&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Read the following &lt;a href="http://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx"&gt;blog
entry&lt;/a&gt;, I tried to describe the concept in detail. Also, this &lt;a href="http://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx"&gt;blog&amp;nbsp;post&lt;/a&gt; discusses
issues when using large document parameters with reliable transport&amp;nbsp; (WS-RM)
channels.
&lt;/p&gt;
&lt;p&gt;
Demo: Document Style Service Interfaces [&lt;a href="http://www.request-response.com/blog/content/binary/NTK2008DocStyleParamModels.zip"&gt;Download&lt;/a&gt;]
&lt;/p&gt;
&lt;p&gt;
This demo defines a service interface with the document parameter model, ie. &lt;font face="Courier New"&gt;Guid
CreatePerson(XmlDocument person)&lt;/font&gt;. It shows three different approaches to creation
of the passed document:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Raw XML creation 
&lt;li&gt;
XML Serialization of the (attribute annotated) object graph 
&lt;li&gt;
XML Serialization using the &lt;em&gt;client object model&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Also, versioned schemas for the &lt;font face="Courier New"&gt;Person&lt;/font&gt; document are
shown, including the support for document validation and version independence.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Talk: Windows Server 2008 and Transactional NTFS&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
This &lt;a href="http://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx"&gt;blog
entry&lt;/a&gt; describes the concept.
&lt;/p&gt;
&lt;p&gt;
Demo 1: Logging&amp;nbsp;using CLFS (Common Log File System)&amp;nbsp;[&lt;a href="http://www.request-response.com/blog/content/binary/NTK2008TxFCLFS.zip"&gt;Download&lt;/a&gt;]&lt;br&gt;
Demo 2:&amp;nbsp;NTFS Transactions using the File System, SQL, WCF&amp;nbsp;[&lt;a href="http://www.request-response.com/blog/content/binary/NTK2008TxFFSSQLWCF.zip"&gt;Download&lt;/a&gt;]&lt;br&gt;
Demo 3:&amp;nbsp;NTFS Transactions using the&amp;nbsp;WCF, MTOM Transport&amp;nbsp;[&lt;a href="http://www.request-response.com/blog/content/binary/NTK2008TxFWCFMTOM.zip"&gt;Download&lt;/a&gt;] &lt;font size=1&gt;[2]&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font size=1&gt;[1] All sources are in VS 2008 solution file format.&lt;br&gt;
[2] This transaction spans from the client, through the service boundary, to the server.&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95.aspx</comments>
      <category>.NET 3.5 - WCF</category>
      <category>Transactions</category>
      <category>XML</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=a510f1dc-23bb-42aa-b683-a70c4740bfe5</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a510f1dc-23bb-42aa-b683-a70c4740bfe5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There is a <em>serious limitation</em> present in the RTM version of WCF 3.0/3.5 regarding
control of WS-RM retry messages during a <strong>reliable session</strong> saga.
</p>
        <p>
Let me try to explain the concept.
</p>
        <p>
We have a sender (communication initiator) and a receiver (service). When a reliable
session is constructed between the two, every message needs to come to the other side.
In a request-reply world, the sender would be a client during the request phase. Then
roles would switch during the response phase.
</p>
        <p>
The problem arises when one of the sides <strong>does not get</strong> the message
acknowledgement in time. WCF reliable messaging implementation retries the sending
process and hopes for the acknowledgement. All is well.
</p>
        <p>
The problem is that there is <em>no way </em>for the sending application to specify <em>how
long the retry timeout should be</em>. There is a way to specify channel opening and
closing timeouts, acknowledgement interval and more, but nothing will define how long
should the initiator wait for message acks.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/wcfreplytimeout1.gif" />
        </p>
        <p>
Let's talk about how WCF acknowledges messages.
</p>
        <p>
During a request-reply exchange every request message is acknowledged <em>in a response
message</em>. WS-RM SOAP headers regarding sequence definition (request) and acknowledgements
(response) look like this:
</p>
        <p>
          <font face="Courier New">a1 &lt;r:Sequence s:mustUnderstand="1" u:Id="_2"&gt;<br />
a2    &lt;r:Identifier&gt;urn:uuid:6c9d...ca90&lt;/r:Identifier&gt;<br />
a3    <strong>&lt;r:MessageNumber&gt;1&lt;/r:MessageNumber&gt;<br /></strong>a4 &lt;/r:Sequence&gt;</font>
        </p>
        <p>
          <font face="Courier New">b1 &lt;r:SequenceAcknowledgement u:Id="_3"&gt;<br />
b2    &lt;r:Identifier&gt;urn:uuid:6c99...ca290&lt;/r:Identifier&gt;<br />
b3    <strong>&lt;r:AcknowledgementRange Lower="1" Upper="1"/&gt;<br />
b4    &lt;netrm:BufferRemaining 
<br />
b5       xmlns:netrm="</strong></font>
          <font face="Courier New">
            <strong>http://schemas.microsoft.com/ws/2006/05/rm"</strong>
          </font>
          <font face="Courier New">
            <strong>&gt;<br />
b6    &lt;/netrm:BufferRemaining&gt;<br /></strong>b7 &lt;/r:SequenceAcknowledgement&gt;</font>
        </p>
        <p>
Request phase defines a sequence and sends the first message (<font face="Courier New">a3</font>).
In response, there is the appropriate acknowledgement present, which acks the first
message (<font face="Courier New">b3</font>) with <font face="Courier New">Lower</font> and <font face="Courier New">Upper</font> attributes.
Lines <font face="Courier New">b4-b6</font> define a benign and super useful WCF implementation
of <em>flow control</em>, which allows the sender to limit the rate of sent messages
if service side <strong>becomes congested</strong>.
</p>
        <p>
When the session is setup, WCF will have a really small time waiting window for acks.
Therefore, if ack is not received during this period, the infrastructure <em>will
retry the message</em>.
</p>
        <p>
Duplex contracts work slightly differently. There, the acknowledgement interval can
be set. This configuration option (config attribute is called <font face="Courier New">acknowledgementInterval</font>)
is named inappropriately, since it controls the service and not the client side.
</p>
        <p>
It does not define the time limit on <em>received acknowledgements</em>, but the necessary
time to <em>send the acknowledgments back</em>. It allows grouping of sent acks, so
that multiple incoming messages can be acked together. Also, the infrastructure will
not necessarily honor the specified value.
</p>
        <p>
Now consider the following scenario:
</p>
        <ol>
          <li>
The client is on a reliable network 
</li>
          <li>
Network bandwidth is so thin that the sending message takes 20s to come through <font face="Courier New">[1]</font></li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,48b65a92-4015-45f2-8fee-78ae5c0e48b8.aspx">Service
instancing</a> is set to <font face="Courier New">Multiple</font></li>
          <li>
The solution uses a request-reply semantics</li>
        </ol>
        <p>
          <font size="1">
            <font face="Courier New">[1]</font> It does not matter whether the
initiator is on a dial up, or the message is huge.</font>
        </p>
        <p>
          <strong>What happens?</strong>
        </p>
        <p>
Service initiator sets up a reliable session, then:
</p>
        <ol>
          <li>
First message is being sent 
</li>
          <li>
Since the retry interval is really small <font face="Courier New">[2]</font>, the
message will not get to the other end and the acknowledgement will not bounce
back in time 
</li>
          <li>
First message is retried, now two messages are being transported 
</li>
          <li>
No acks received yet 
</li>
          <li>
First message is retried again 
</li>
          <li>
Network bandwidth is even thinner 
</li>
          <li>
First message is acknowledged 
</li>
          <li>
First message retry is discarded on the service side 
</li>
          <li>
Second message retry is discarded on the service side</li>
        </ol>
        <p>
          <font size="1">
            <font face="Courier New">[2]</font> Under 3s.</font>
        </p>
        <p>
The number of retry messages depends on the <em>bandwidth</em> and <em>message size</em>.
It can happen that tens of messages will be sent before first acknowledgement will
be received.
</p>
        <p>
          <strong>Adaptability algorithms</strong>
        </p>
        <p>
A good thing is that there are undocumented algorithms implemented for retry timeout.
The implementation increases the reply timeout <em>exponentially</em> when the infrastructure
detects that the network conditions demand more time (slow throughput) and allows
reliable delivery (no losses). If loses are present the reply timeout decreases.
</p>
        <p>
Retry timeout is actually calculated when establishing an RM session. It
is based on the roundtrip time and is bigger if the roundtrip time is long.
</p>
        <p>
So, when first messages in a session are exchanged, don't be too surprised to see
a couple of message retries.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=a510f1dc-23bb-42aa-b683-a70c4740bfe5" />
      </body>
      <title>WCF: Reliable Messaging and Retry Timeouts</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx</link>
      <pubDate>Tue, 08 Apr 2008 22:33:13 GMT</pubDate>
      <description>&lt;p&gt;
There is a &lt;em&gt;serious limitation&lt;/em&gt; present in the RTM version of WCF 3.0/3.5 regarding
control of WS-RM retry messages during a &lt;strong&gt;reliable session&lt;/strong&gt; saga.
&lt;/p&gt;
&lt;p&gt;
Let me try to explain the concept.
&lt;/p&gt;
&lt;p&gt;
We have a sender (communication initiator) and a receiver (service). When a reliable
session is constructed between the two, every message needs to come to the other side.
In a request-reply world, the sender would be a client during the request phase. Then
roles would switch during the response phase.
&lt;/p&gt;
&lt;p&gt;
The problem arises when one of the sides &lt;strong&gt;does not get&lt;/strong&gt; the message
acknowledgement in time. WCF reliable messaging implementation retries the sending
process and hopes for the acknowledgement. All is well.
&lt;/p&gt;
&lt;p&gt;
The problem is that there is &lt;em&gt;no way &lt;/em&gt;for the sending application to specify &lt;em&gt;how
long the retry timeout should be&lt;/em&gt;. There is a way to specify channel opening and
closing timeouts, acknowledgement interval and more, but nothing will define how long
should the initiator wait for message acks.
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.request-response.com/blog/images/wcfreplytimeout1.gif"&gt;
&lt;/p&gt;
&lt;p&gt;
Let's talk about how WCF acknowledges messages.
&lt;/p&gt;
&lt;p&gt;
During a request-reply exchange every request message is acknowledged &lt;em&gt;in a response
message&lt;/em&gt;. WS-RM SOAP headers regarding sequence definition (request) and acknowledgements
(response) look like this:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;a1 &amp;lt;r:Sequence s:mustUnderstand="1" u:Id="_2"&amp;gt;&lt;br&gt;
a2&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;r:Identifier&amp;gt;urn:uuid:6c9d...ca90&amp;lt;/r:Identifier&amp;gt;&lt;br&gt;
a3&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&amp;lt;r:MessageNumber&amp;gt;1&amp;lt;/r:MessageNumber&amp;gt;&lt;br&gt;
&lt;/strong&gt;a4 &amp;lt;/r:Sequence&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;b1 &amp;lt;r:SequenceAcknowledgement u:Id="_3"&amp;gt;&lt;br&gt;
b2&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;r:Identifier&amp;gt;urn:uuid:6c99...ca290&amp;lt;/r:Identifier&amp;gt;&lt;br&gt;
b3&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&amp;lt;r:AcknowledgementRange Lower="1" Upper="1"/&amp;gt;&lt;br&gt;
b4&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;netrm:BufferRemaining 
&lt;br&gt;
b5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:netrm="&lt;/strong&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;http://schemas.microsoft.com/ws/2006/05/rm"&lt;/strong&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;strong&gt;&amp;gt;&lt;br&gt;
b6&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/netrm:BufferRemaining&amp;gt;&lt;br&gt;
&lt;/strong&gt;b7 &amp;lt;/r:SequenceAcknowledgement&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Request phase defines a sequence and sends the first message (&lt;font face="Courier New"&gt;a3&lt;/font&gt;).
In response, there is the appropriate acknowledgement present, which acks the first
message (&lt;font face="Courier New"&gt;b3&lt;/font&gt;) with &lt;font face="Courier New"&gt;Lower&lt;/font&gt; and &lt;font face="Courier New"&gt;Upper&lt;/font&gt; attributes.
Lines &lt;font face="Courier New"&gt;b4-b6&lt;/font&gt; define a benign and super useful WCF implementation
of &lt;em&gt;flow control&lt;/em&gt;, which allows the sender to limit the rate of sent messages
if service side &lt;strong&gt;becomes congested&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
When the session is setup, WCF will have a really small time waiting window for acks.
Therefore, if ack is not received during this period, the infrastructure &lt;em&gt;will
retry the message&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
Duplex contracts work slightly differently. There, the acknowledgement interval can
be set. This configuration option (config attribute is called &lt;font face="Courier New"&gt;acknowledgementInterval&lt;/font&gt;)
is named inappropriately, since it controls the service and not the client side.
&lt;/p&gt;
&lt;p&gt;
It does not define the time limit on &lt;em&gt;received acknowledgements&lt;/em&gt;, but the necessary
time to &lt;em&gt;send the acknowledgments back&lt;/em&gt;. It allows grouping of sent acks, so
that multiple incoming messages can be acked together. Also, the infrastructure will
not necessarily honor the specified value.
&lt;/p&gt;
&lt;p&gt;
Now consider the following scenario:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
The client is on a reliable network 
&lt;li&gt;
Network bandwidth is so thin that the sending message takes 20s to come through &lt;font face="Courier New"&gt;[1]&lt;/font&gt; 
&lt;li&gt;
&lt;a href="http://www.request-response.com/blog/PermaLink,guid,48b65a92-4015-45f2-8fee-78ae5c0e48b8.aspx"&gt;Service
instancing&lt;/a&gt; is set to &lt;font face="Courier New"&gt;Multiple&lt;/font&gt; 
&lt;li&gt;
The solution uses a request-reply semantics&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;font size=1&gt;&lt;font face="Courier New"&gt;[1]&lt;/font&gt; It does not matter whether the initiator
is on a dial up, or the message is huge.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What happens?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Service initiator sets up a reliable session, then:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
First message is being sent 
&lt;li&gt;
Since the retry interval is really small &lt;font face="Courier New"&gt;[2]&lt;/font&gt;, the
message will not get to the other end and&amp;nbsp;the acknowledgement will not bounce
back in time 
&lt;li&gt;
First message is retried, now two messages are being transported 
&lt;li&gt;
No acks received yet 
&lt;li&gt;
First message is retried again 
&lt;li&gt;
Network bandwidth is even thinner 
&lt;li&gt;
First message is acknowledged 
&lt;li&gt;
First message retry is discarded on the service side 
&lt;li&gt;
Second message retry is discarded on the service side&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;font size=1&gt;&lt;font face="Courier New"&gt;[2]&lt;/font&gt; Under 3s.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
The number of retry messages depends on the &lt;em&gt;bandwidth&lt;/em&gt; and &lt;em&gt;message size&lt;/em&gt;.
It can happen that tens of messages will be sent before first acknowledgement will
be received.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Adaptability algorithms&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
A good thing is that there are undocumented algorithms implemented for retry timeout.
The implementation increases the reply timeout &lt;em&gt;exponentially&lt;/em&gt; when the infrastructure
detects that the network conditions demand more time (slow throughput) and allows
reliable delivery (no losses). If loses are present the reply timeout decreases.
&lt;/p&gt;
&lt;p&gt;
Retry timeout is actually calculated&amp;nbsp;when establishing an&amp;nbsp;RM session.&amp;nbsp;It
is based on the roundtrip time and is bigger if the roundtrip time is long.
&lt;/p&gt;
&lt;p&gt;
So, when first messages in a session are exchanged, don't be too surprised to see
a couple of message retries.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=a510f1dc-23bb-42aa-b683-a70c4740bfe5" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx</comments>
      <category>.NET 3.0 - WCF</category>
      <category>.NET 3.5 - WCF</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=ff5fab81-affb-4b2b-aa67-c80bdfc86cbd</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ff5fab81-affb-4b2b-aa67-c80bdfc86cbd</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In WCF, collection data that is passed through the service boundary goes through a <em>type
filter </em>- meaning you will not necessarily get the <em>intrinsic service side
type</em> on the client, even if you're <strong>expecting it</strong>.
</p>
        <p>
No matter if you throw back an <font face="Courier New">int[]</font> or <font face="Courier New">List&lt;int&gt;,</font> you
will get the <font face="Courier New">int[]</font> by default on the client.
</p>
        <p>
The main reason is that there is no representation for <font face="Courier New">System.Collections.Generic.List</font> or <font face="Courier New">System.Collection.Generic.LinkedList</font> in
service metadata. The concept of <font face="Courier New">System.Collection.Generic.List&lt;int&gt;</font> for
example, actually does not have a different semantic meaning from an <em>integer array</em> -
it's still a list of <em>ints</em> - but will allow you to program against it with
ease.
</p>
        <p>
Though, if one asks nicely, <strong>it is possible</strong> to guarantee the preferred
collection type on the client proxy in certain scenarios.
</p>
        <p>
Unidimensional collections, like <font face="Courier New">List&lt;T&gt;</font>, <font face="Courier New">LinkedList&lt;T&gt;</font> or <font face="Courier New">SortedList&lt;T&gt;</font> are
always exposed as <font face="Courier New">T</font> arrays in the client proxy. <font face="Courier New">Dictionary&lt;K,
V&gt;</font>, though, is regened on the client via an annotation hint in WSDL (XSD
if we are precise). More on that later.
</p>
        <p>
Let's look into it.
</p>
        <p>
WCF infrastructure bends over backwards to simplify client development. If the service
side contains a really serializable collection (marked with <font face="Courier New">[Serializable]</font>,
not <font face="Courier New">[DataContract]</font>) that is also concrete (not an
interface), and has an <font face="Courier New">Add</font> method with the following
signatures...
</p>
        <p>
          <font face="Courier New">public void Add(object obj);<br />
public void Add(T item); </font>
        </p>
        <p>
... then WCF will serialize the data to an array of the collections type.
</p>
        <p>
Too complicated? Consider the following:
</p>
        <p>
          <font face="Courier New">[ServiceContract]<br />
interface ICollect<br />
{<br />
   [OperationContract]<br />
   public void AddCoin(Coin coin);</font>
        </p>
        <p>
          <font face="Courier New">   [OperationContract]<br />
   public List&lt;Coin&gt; GetCoins();<br />
}</font>
        </p>
        <p>
Since the <font face="Courier New">List&lt;T&gt;</font> supports a <font face="Courier New">void
Add&lt;T&gt;</font> method and is marked with <font face="Courier New">[Serializable]</font>,
the following wire representation will be passed to the client:
</p>
        <p>
          <font face="Courier New">[ServiceContract]<br />
interface ICollect<br />
{<br />
  [OperationContract]<br />
  void AddCoin(Coin coin);</font>
        </p>
        <p>
          <font face="Courier New">  [OperationContract]<br />
  Coin[] GetCoins();<br />
}<br /></font>
          <font size="1">
            <br />
Note: <font face="Courier New">Coin</font> class should be marked either with a <font face="Courier New">[DataContract]</font> or <font face="Courier New">[Serializable]</font> in
this case.</font>
        </p>
        <p>
So what happens if one wants the same contract <em>on the client proxy and the service</em>?
There is an option in the WCF proxy generator, <font face="Courier New">svcutil.exe</font> to
force generation of class definitions with a specific collection type.
</p>
        <p>
Use the following for <font face="Courier New">List&lt;T&gt;</font>:
</p>
        <p>
          <font face="Courier New">svcutil.exe http://service/metadata/address<br />
  /collectionType:System.Collections.Generic.List`1<br /><br /></font>
          <font size="1">Note: <font face="Courier New">List`1</font> uses back quote,
not normal single quote character.</font>
        </p>
        <p>
What the <font face="Courier New">/collectionType</font> (short <font face="Courier New">/ct</font>)
does, is forces generation of strongly typed collection types. It will generate the
holy grail on the client:
</p>
        <p>
          <font face="Courier New">[ServiceContract]<br />
interface ICollect<br />
{<br />
  [OperationContract]<br />
  void AddCoin(Coin coin);</font>
        </p>
        <p>
          <font face="Courier New">  [OperationContract]<br />
  List&lt;Coin&gt; GetCoins();<br />
}</font>
        </p>
        <p>
In Visual Studio 2008, you will even have an option to specify which types you want
to use as <em>collection types</em> and <em>dictionary collection types</em>, as in
the following picture:
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/vs2008servicereference.jpg" />
        </p>
        <p>
On the other hand, dictionary collections, as in <font face="Courier New">System.Collections.Generic.Dictionary&lt;K,
V&gt;</font> collections, will go through to the client no matter what you specify
as a <font face="Courier New">/ct</font> parameter (or don't at all).
</p>
        <p>
If you define the following on the service side...
</p>
        <p>
          <font face="Courier New">[OperationContract]<br />
Dictionary&lt;string, int&gt; GetFoo();</font>
        </p>
        <p>
... this will get generated on the client:
</p>
        <p>
          <font face="Courier New">[OperationContract]<br />
Dictionary&lt;string, int&gt; GetFoo();</font>
        </p>
        <p>
          <strong>Why?</strong>
        </p>
        <p>
Because using <font face="Courier New">System.Collections.Generic.Dictionary</font> probably
means <strong>you</strong> know there is no guarantee that client side representation
will be possible if you are using an alternative platform. There is no way to meaningfully
convey the semantics of a .NET dictionary class using WSDL/XSD. 
</p>
        <p>
          <strong>So, how does the client know?</strong>
        </p>
        <p>
In fact, the values are serialized as <strong>joined name value pair elements</strong> as
the following schema says:
</p>
        <p>
          <font face="Courier New">&lt;xs:complexType name="ArrayOfKeyValueOfstringint"&gt;<br /><font color="#a52a2a">  &lt;xs:annotation&gt;<br />
    &lt;xs:appinfo&gt;<br />
      &lt;IsDictionary<br />
        xmlns="</font></font>
          <font face="Courier New" color="#a52a2a">http://schemas.microsoft.com/2003/10/Serialization/</font>
          <font face="Courier New">
            <font color="#a52a2a">"&gt;<br />
        true<br />
      &lt;/IsDictionary&gt; 
<br />
    &lt;/xs:appinfo&gt;<br />
  &lt;/xs:annotation&gt;<br /></font>  &lt;xs:sequence&gt;<br />
    &lt;xs:element minOccurs="0" maxOccurs="unbounded"<br />
      name="KeyValueOfstringint"&gt;<br />
      &lt;xs:complexType&gt;<br />
        &lt;xs:sequence&gt;<br />
          &lt;xs:element name="Key" nillable="true"
type="xs:string" /&gt; 
<br />
          &lt;xs:element name="Value"
type="xs:int" /&gt; 
<br />
        &lt;/xs:sequence&gt;<br />
      &lt;/xs:complexType&gt;<br />
    &lt;/xs:element&gt;<br />
  &lt;/xs:sequence&gt;<br />
&lt;/xs:complexType&gt;<br />
&lt;xs:element name="ArrayOfKeyValueOfstringint"<br />
  nillable="true" type="tns:ArrayOfKeyValueOfstringint" /&gt;<br /><br /></font>
          <font size="1">Note: You can find this schema under <font face="Courier New">types</font> definition
of the metadata endpoint. Usually <font face="Courier New">?xsd=xsd2</font>, instead
of <font face="Courier New">?wsdl</font> will suffice.</font>
        </p>
        <p>
As in:
</p>
        <p>
          <font face="Courier New">&lt;GetFooResponse&gt;<br />
  &lt;KeyValueOfstringint&gt;<br />
    &lt;Key&gt;one&lt;/Key&gt;<br />
    &lt;Value&gt;1&lt;/Value&gt;</font>
        </p>
        <p>
          <font face="Courier New">    &lt;Key&gt;two&lt;/Key&gt;<br />
    &lt;Value&gt;2&lt;/Value&gt;</font>
        </p>
        <p>
          <font face="Courier New">    &lt;!-- ... --&gt;</font>
        </p>
        <p>
          <font face="Courier New">    &lt;Key&gt;N&lt;/Key&gt;<br />
    &lt;Value&gt;N&lt;/Value&gt;<br />
  &lt;/KeyValueOfstringint&gt;<br />
&lt;GetFooResponse&gt;</font>
        </p>
        <p>
The meaningful part of type service-to-client-transportation resides in <font face="Courier New">&lt;xs:annotation&gt;</font> element,
specifically in <font face="Courier New">/xs:annotation/xs:appinfo/IsDictionary</font> element,
which defines that this complex type represents a <font face="Courier New">System.Collections.Generic.Dictionary</font> class. <a href="http://www.w3.org/TR/xmlschema-0/#CommVers">Annotation</a> elements
in XML Schema are parser specific and do not convey any structure/data type semantics,
but are there <em>for the receiver to interpret</em>.
</p>
        <p>
This must be one of the <strong>most excellent school cases</strong> of using XML
Schema <a href="http://www.w3.org/TR/xmlschema-0/#CommVers">annotations</a>. It allows
the well-informed client (as in .NET client, VS 2008 or <font face="Courier New">svcutil.exe</font>)
to utilize the semantic meaning if it understands it. If not, no harm is done since
the best possible representation, in a form of joined name value pairs still goes
through to the client.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=ff5fab81-affb-4b2b-aa67-c80bdfc86cbd" />
      </body>
      <title>WCF: Passing Collections Through Service Boundaries, Why and How</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx</link>
      <pubDate>Thu, 27 Sep 2007 21:04:47 GMT</pubDate>
      <description>&lt;p&gt;
In WCF, collection data that is passed through the service boundary goes through a &lt;em&gt;type
filter &lt;/em&gt;- meaning you will not necessarily get the &lt;em&gt;intrinsic service side
type&lt;/em&gt; on the client, even if you're &lt;strong&gt;expecting it&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
No matter if you throw back an &lt;font face="Courier New"&gt;int[]&lt;/font&gt; or &lt;font face="Courier New"&gt;List&amp;lt;int&amp;gt;,&lt;/font&gt; you
will get the &lt;font face="Courier New"&gt;int[]&lt;/font&gt; by default on the client.
&lt;/p&gt;
&lt;p&gt;
The main reason is that there is no representation for &lt;font face="Courier New"&gt;System.Collections.Generic.List&lt;/font&gt; or &lt;font face="Courier New"&gt;System.Collection.Generic.LinkedList&lt;/font&gt; in
service metadata. The concept of &lt;font face="Courier New"&gt;System.Collection.Generic.List&amp;lt;int&amp;gt;&lt;/font&gt; for
example, actually does not have a different semantic meaning from an &lt;em&gt;integer array&lt;/em&gt; -
it's still a list of &lt;em&gt;ints&lt;/em&gt; - but will allow you to program against it with
ease.
&lt;/p&gt;
&lt;p&gt;
Though, if one asks nicely, &lt;strong&gt;it is possible&lt;/strong&gt; to guarantee the preferred
collection type on the client proxy in certain scenarios.
&lt;/p&gt;
&lt;p&gt;
Unidimensional collections, like &lt;font face="Courier New"&gt;List&amp;lt;T&amp;gt;&lt;/font&gt;, &lt;font face="Courier New"&gt;LinkedList&amp;lt;T&amp;gt;&lt;/font&gt; or &lt;font face="Courier New"&gt;SortedList&amp;lt;T&amp;gt;&lt;/font&gt; are
always exposed as &lt;font face="Courier New"&gt;T&lt;/font&gt; arrays in the client proxy. &lt;font face="Courier New"&gt;Dictionary&amp;lt;K,
V&amp;gt;&lt;/font&gt;, though, is regened on the client via an annotation hint in WSDL (XSD
if we are precise). More on that later.
&lt;/p&gt;
&lt;p&gt;
Let's look into it.
&lt;/p&gt;
&lt;p&gt;
WCF infrastructure bends over backwards to simplify client development. If the service
side contains a really serializable collection (marked with &lt;font face="Courier New"&gt;[Serializable]&lt;/font&gt;,
not &lt;font face="Courier New"&gt;[DataContract]&lt;/font&gt;) that is also concrete (not an
interface), and has an &lt;font face="Courier New"&gt;Add&lt;/font&gt; method with the following
signatures...
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;public void Add(object obj);&lt;br&gt;
public void Add(T item); &lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
... then WCF will serialize the data to an array of the collections type.
&lt;/p&gt;
&lt;p&gt;
Too complicated? Consider the following:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;[ServiceContract]&lt;br&gt;
interface ICollect&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp;&amp;nbsp; public void AddCoin(Coin coin);&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp;&amp;nbsp; public List&amp;lt;Coin&amp;gt; GetCoins();&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Since the &lt;font face="Courier New"&gt;List&amp;lt;T&amp;gt;&lt;/font&gt; supports a &lt;font face="Courier New"&gt;void
Add&amp;lt;T&amp;gt;&lt;/font&gt; method and is marked with &lt;font face="Courier New"&gt;[Serializable]&lt;/font&gt;,
the following wire representation will be passed to the client:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;[ServiceContract]&lt;br&gt;
interface ICollect&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp; void AddCoin(Coin coin);&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp; Coin[] GetCoins();&lt;br&gt;
}&lt;br&gt;
&lt;/font&gt;&lt;font size=1&gt;
&lt;br&gt;
Note: &lt;font face="Courier New"&gt;Coin&lt;/font&gt; class should be marked either with a &lt;font face="Courier New"&gt;[DataContract]&lt;/font&gt; or &lt;font face="Courier New"&gt;[Serializable]&lt;/font&gt; in
this case.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
So what happens if one wants the same contract &lt;em&gt;on the client proxy and the service&lt;/em&gt;?
There is an option in the WCF proxy generator, &lt;font face="Courier New"&gt;svcutil.exe&lt;/font&gt; to
force generation of class definitions with a specific collection type.
&lt;/p&gt;
&lt;p&gt;
Use the following for &lt;font face="Courier New"&gt;List&amp;lt;T&amp;gt;&lt;/font&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;svcutil.exe http://service/metadata/address&lt;br&gt;
&amp;nbsp; /collectionType:System.Collections.Generic.List`1&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font size=1&gt;Note: &lt;font face="Courier New"&gt;List`1&lt;/font&gt; uses back quote,
not normal single quote character.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
What the &lt;font face="Courier New"&gt;/collectionType&lt;/font&gt; (short &lt;font face="Courier New"&gt;/ct&lt;/font&gt;)
does, is forces generation of strongly typed collection types. It will generate the
holy grail on the client:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;[ServiceContract]&lt;br&gt;
interface ICollect&lt;br&gt;
{&lt;br&gt;
&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp; void AddCoin(Coin coin);&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp; List&amp;lt;Coin&amp;gt; GetCoins();&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
In Visual Studio 2008, you will even have an option to specify which types you want
to use as &lt;em&gt;collection types&lt;/em&gt; and &lt;em&gt;dictionary collection types&lt;/em&gt;, as in
the following picture:
&lt;/p&gt;
&lt;p&gt;
&lt;img src="http://www.request-response.com/blog/images/vs2008servicereference.jpg"&gt;
&lt;/p&gt;
&lt;p&gt;
On the other hand, dictionary collections, as in &lt;font face="Courier New"&gt;System.Collections.Generic.Dictionary&amp;lt;K,
V&amp;gt;&lt;/font&gt; collections, will go through to the client no matter what you specify
as a &lt;font face="Courier New"&gt;/ct&lt;/font&gt; parameter (or don't at all).
&lt;/p&gt;
&lt;p&gt;
If you define the following on the service side...
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;[OperationContract]&lt;br&gt;
Dictionary&amp;lt;string, int&amp;gt; GetFoo();&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
... this will get generated on the client:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;[OperationContract]&lt;br&gt;
Dictionary&amp;lt;string, int&amp;gt; GetFoo();&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Why?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Because using &lt;font face="Courier New"&gt;System.Collections.Generic.Dictionary&lt;/font&gt; probably
means &lt;strong&gt;you&lt;/strong&gt; know there is no guarantee that client side representation
will be possible if you are using an alternative platform. There is no way to meaningfully
convey the semantics of a .NET dictionary class using WSDL/XSD. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;So, how does the client know?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In fact, the values are serialized as &lt;strong&gt;joined name value pair elements&lt;/strong&gt; as
the following schema says:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;xs:complexType name="ArrayOfKeyValueOfstringint"&amp;gt;&lt;br&gt;
&lt;font color=#a52a2a&gt;&amp;nbsp; &amp;lt;xs:annotation&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:appinfo&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;IsDictionary&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns="&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color=#a52a2a&gt;http://schemas.microsoft.com/2003/10/Serialization/&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color=#a52a2a&gt;"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; true&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/IsDictionary&amp;gt; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:appinfo&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/xs:annotation&amp;gt;&lt;br&gt;
&lt;/font&gt;&amp;nbsp; &amp;lt;xs:sequence&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element minOccurs="0" maxOccurs="unbounded"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;name="KeyValueOfstringint"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:complexType&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:sequence&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element name="Key" nillable="true"
type="xs:string" /&amp;gt; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xs:element name="Value"
type="xs:int" /&amp;gt; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:sequence&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:complexType&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xs:element&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/xs:sequence&amp;gt;&lt;br&gt;
&amp;lt;/xs:complexType&amp;gt;&lt;br&gt;
&amp;lt;xs:element name="ArrayOfKeyValueOfstringint"&lt;br&gt;
&amp;nbsp; nillable="true" type="tns:ArrayOfKeyValueOfstringint" /&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font size=1&gt;Note: You can find this schema under &lt;font face="Courier New"&gt;types&lt;/font&gt; definition
of the metadata endpoint. Usually &lt;font face="Courier New"&gt;?xsd=xsd2&lt;/font&gt;, instead
of &lt;font face="Courier New"&gt;?wsdl&lt;/font&gt; will suffice.&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
As in:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;GetFooResponse&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;KeyValueOfstringint&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Key&amp;gt;one&amp;lt;/Key&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Value&amp;gt;1&amp;lt;/Value&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Key&amp;gt;two&amp;lt;/Key&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Value&amp;gt;2&amp;lt;/Value&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;!-- ... --&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Key&amp;gt;N&amp;lt;/Key&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Value&amp;gt;N&amp;lt;/Value&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/KeyValueOfstringint&amp;gt;&lt;br&gt;
&amp;lt;GetFooResponse&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
The meaningful part of type service-to-client-transportation resides in &lt;font face="Courier New"&gt;&amp;lt;xs:annotation&amp;gt;&lt;/font&gt; element,
specifically in &lt;font face="Courier New"&gt;/xs:annotation/xs:appinfo/IsDictionary&lt;/font&gt; element,
which defines that this complex type represents a &lt;font face="Courier New"&gt;System.Collections.Generic.Dictionary&lt;/font&gt; class. &lt;a href="http://www.w3.org/TR/xmlschema-0/#CommVers"&gt;Annotation&lt;/a&gt; elements
in XML Schema are parser specific and do not convey any structure/data type semantics,
but are there &lt;em&gt;for the receiver to interpret&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
This must be one of the &lt;strong&gt;most excellent school cases&lt;/strong&gt; of using XML
Schema &lt;a href="http://www.w3.org/TR/xmlschema-0/#CommVers"&gt;annotations&lt;/a&gt;. It allows
the well-informed client (as in .NET client, VS 2008 or &lt;font face="Courier New"&gt;svcutil.exe&lt;/font&gt;)
to utilize the semantic meaning if it understands it. If not, no harm is done since
the best possible representation, in a form of joined name value pairs still goes
through to the client.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=ff5fab81-affb-4b2b-aa67-c80bdfc86cbd" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx</comments>
      <category>.NET 3.0 - WCF</category>
      <category>.NET 3.5 - WCF</category>
      <category>Web Services</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=ab874bc2-1546-48d1-a8aa-46f0bf876d93</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ab874bc2-1546-48d1-a8aa-46f0bf876d93</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm a huge fan of document style parameter models when implementing a public, programmatic <a href="http://en.wikipedia.org/wiki/Facade_pattern">façade</a> to
a business functionality that often changes.
</p>
        <p>
          <font face="Courier New">public interface IDocumentParameterModel<br />
{<br />
   [OperationContract]<br />
   [FaultContract(typeof(XmlInvalidException))]<br />
   XmlDocument Process(XmlDocument doc);<br />
}</font>
        </p>
        <p>
This contract defines a simple method, called <font face="Courier New">Process</font>,
which processes the input document. The idea is to define the <a href="http://www.w3.org/TR/xmlschema-1/">document
schema</a> and validate inbound XML documents, while throwing exceptions on <em>validation
errors</em>. The processing semantics is arbitrary and can support any kind of action,
depending on the defined <em>invoke document </em>schema.
</p>
        <p>
A simple instance document which validates against a version 1.0 <em>processing schema</em> could
look like this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0?&gt;<br />
&lt;Process xmlns="http://www.gama-system.com/process10.xsd" version="1.0"&gt;<br />
   &lt;Instruction&gt;Add&lt;/Instruction&gt;<br />
   &lt;Parameter1&gt;10&lt;/Parameter1&gt;<br />
   &lt;Parameter2&gt;21&lt;/Parameter2&gt;<br />
&lt;/Process&gt;</font>
        </p>
        <p>
Another processing instruction, supported in version 1.1 of the <em>processing schema</em>,
with different semantics could be:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0?&gt;<br />
&lt;Process xmlns="http://www.gama-system.com/process11.xsd" version="1.1"&gt;<br />
   &lt;Instruction&gt;Store&lt;/Instruction&gt;<br />
   &lt;Content&gt;77u/PEFwcGxpY2F0aW9uIHhtbG5zPSJod...mdVcCI&lt;/Content&gt;<br />
&lt;/Process&gt;</font>
        </p>
        <p>
Note that the default XML namespace changed, but that is <strong>not a norm</strong>.
It only allows you to automate schema retrieval using the schema repository (think <font face="Courier New">System.Xml.Schema.XmlSchemaSet</font>),
load all supported schemas and validate automatically.
</p>
        <p>
          <font face="Courier New">public class ProcessService : IDocumentParameterModel<br />
{<br />
   public XmlDocument Process(XmlDocument doc)<br />
   {<br />
      XmlReaderSettings sett = new XmlReaderSettings();</font>
        </p>
        <p>
          <font face="Courier New">
            <strong>      sett.Schemas.Add(&lt;document
namespace 1&gt;, &lt;schema uri 1&gt;);<br />
      ...<br />
      sett.Schemas.Add(&lt;document namespace n&gt;, &lt;schema
uri n&gt;);</strong>
          </font>
        </p>
        <p>
          <font face="Courier New">      sett.ValidationType = ValidationType.Schema;<br />
      sett.ValidationEventHandler += new 
<br />
         ValidationEventHandler(XmlInvalidHandler);<br /></font>
          <font face="Courier New">      XmlReader books = XmlReader.Create(doc.OuterXml,
sett);<br /></font>
          <font face="Courier New">      while (books.Read())
{ }</font>
        </p>
        <p>
          <font face="Courier New">      // processing goes here<br />
      ...<br />
   }</font>
        </p>
        <p>
          <font face="Courier New">   static void XmlInvalidHandler(object sender,
ValidationEventArgs e)<br />
   {<br />
      if (e.Severity == XmlSeverityType.Error)<br />
         throw new XmlInvalidException(e.Message);<br />
   }<br />
}</font>
        </p>
        <p>
The main benefit of this approach is <em>decoupling</em> the parameter model and method
processing version from the <em>communication contract</em>. A service maintainer
has an option to change the terms of processing over time, while supporting older
version-aware document instances.
</p>
        <p>
This notion is of course most beneficial in situations where your processing syntax <strong>changes
frequently</strong> and has complex validation schemas. A simple case presented here
is informational only.
</p>
        <p>
So, how do we validate?
</p>
        <ul>
          <li>
We need to check the instance document version first. This is especially true in cases
where the document is <em>not qualified with a different namespace</em> when the version
changes.</li>
          <li>
We grab the appropriate schema or schema set</li>
          <li>
We validate the inbound XML document, throw a typed <font face="Courier New">XmlInvalidException</font> if
invalid</li>
          <li>
We process the call</li>
        </ul>
        <p>
The service side is quite straightforward.
</p>
        <p>
Let's look at the <strong>client</strong> and what are the options for painless generation
of service calls using this mechanism.
</p>
        <p>
Generally, one can always produce an instance <em>invoke document</em> by hand on
the client. <em>By hand</em> meaning using <font face="Courier New">System.Xml</font> classes
and DOM concepts. Since this is higly error prone and gets tedious with increasing
complexity, there is a notion of a schema compiler, which automatically translates
your XML Schema into the CLR type system. <font face="Courier New">Xsd.exe</font> and <font face="Courier New">XmlSerializer</font> are
your friends. 
</p>
        <p>
If your schema requires parts of the instance document to be digitally signed or encrypted,
you will need to adorn the serializer output with some manual DOM work. This might
also be a reason to use the third option.
</p>
        <p>
The third, and easiest option for the general developer, is to provide a <strong>local
object model</strong>, which serializes the requests on the client. This is an example:
</p>
        <p>
          <font face="Courier New">ProcessInstruction pi = new ProcessInstruction();<br />
pi.Instruction = "Add";<br />
pi.Parameter1 = 10;<br />
pi.Parameter2 = 21;<br />
pi.Sign(cert); // pi.Encrypt(cert);<br />
pi.Serialize();<br />
proxy.Process(pi.SerializedForm);</font>
        </p>
        <p>
The main benefit of this approach comes down to having an option on the server and
the client. Client developers have three different levels of complexity for generating
service calls. The model allows them to be as close to the wire as they see fit. Or
they can be abstracted completely from the wire representation if you provide a local
object model to access your services.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=ab874bc2-1546-48d1-a8aa-46f0bf876d93" />
      </body>
      <title>Approaches to Document Style Parameter Models</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx</link>
      <pubDate>Mon, 24 Sep 2007 10:19:10 GMT</pubDate>
      <description>&lt;p&gt;
I'm a huge fan of document style parameter models when implementing a public, programmatic &lt;a href="http://en.wikipedia.org/wiki/Facade_pattern"&gt;façade&lt;/a&gt; to
a business functionality that often changes.
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;public interface IDocumentParameterModel&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp;&amp;nbsp; [FaultContract(typeof(XmlInvalidException))]&lt;br&gt;
&amp;nbsp;&amp;nbsp; XmlDocument Process(XmlDocument doc);&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
This contract defines a simple method, called &lt;font face="Courier New"&gt;Process&lt;/font&gt;,
which processes the input document. The idea is to define the &lt;a href="http://www.w3.org/TR/xmlschema-1/"&gt;document
schema&lt;/a&gt; and validate inbound XML documents, while throwing exceptions on &lt;em&gt;validation
errors&lt;/em&gt;. The processing semantics is arbitrary and can support any kind of action,
depending on the defined &lt;em&gt;invoke document &lt;/em&gt;schema.
&lt;/p&gt;
&lt;p&gt;
A simple instance document which validates against a version 1.0 &lt;em&gt;processing schema&lt;/em&gt; could
look like this:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;?xml version="1.0?&amp;gt;&lt;br&gt;
&amp;lt;Process xmlns="http://www.gama-system.com/process10.xsd" version="1.0"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;Instruction&amp;gt;Add&amp;lt;/Instruction&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;Parameter1&amp;gt;10&amp;lt;/Parameter1&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;Parameter2&amp;gt;21&amp;lt;/Parameter2&amp;gt;&lt;br&gt;
&amp;lt;/Process&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Another processing instruction, supported in version 1.1 of the &lt;em&gt;processing schema&lt;/em&gt;,
with different semantics could be:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;?xml version="1.0?&amp;gt;&lt;br&gt;
&amp;lt;Process xmlns="http://www.gama-system.com/process11.xsd" version="1.1"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;Instruction&amp;gt;Store&amp;lt;/Instruction&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;Content&amp;gt;77u/PEFwcGxpY2F0aW9uIHhtbG5zPSJod...mdVcCI&amp;lt;/Content&amp;gt;&lt;br&gt;
&amp;lt;/Process&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Note that the default XML namespace changed, but that is &lt;strong&gt;not a norm&lt;/strong&gt;.
It only allows you to automate schema retrieval using the schema repository (think &lt;font face="Courier New"&gt;System.Xml.Schema.XmlSchemaSet&lt;/font&gt;),
load all supported schemas and validate automatically.
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;public class ProcessService : IDocumentParameterModel&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp; public XmlDocument Process(XmlDocument doc)&lt;br&gt;
&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlReaderSettings sett = new XmlReaderSettings();&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sett.Schemas.Add(&amp;lt;document
namespace 1&amp;gt;, &amp;lt;schema uri 1&amp;gt;);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sett.Schemas.Add(&amp;lt;document namespace n&amp;gt;, &amp;lt;schema
uri n&amp;gt;);&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sett.ValidationType = ValidationType.Schema;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sett.ValidationEventHandler += new 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ValidationEventHandler(XmlInvalidHandler);&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlReader books = XmlReader.Create(doc.OuterXml,
sett);&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (books.Read())
{ }&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // processing goes here&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;
&amp;nbsp;&amp;nbsp; }&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp; static void XmlInvalidHandler(object sender,
ValidationEventArgs e)&lt;br&gt;
&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (e.Severity == XmlSeverityType.Error)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new XmlInvalidException(e.Message);&lt;br&gt;
&amp;nbsp;&amp;nbsp; }&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
The main benefit of this approach is &lt;em&gt;decoupling&lt;/em&gt; the parameter model and method
processing version from the &lt;em&gt;communication contract&lt;/em&gt;. A service maintainer
has an option to change the terms of processing over time, while supporting older
version-aware document instances.
&lt;/p&gt;
&lt;p&gt;
This notion is of course most beneficial in situations where your processing syntax &lt;strong&gt;changes
frequently&lt;/strong&gt; and has complex validation schemas. A simple case presented here
is informational only.
&lt;/p&gt;
&lt;p&gt;
So, how do we validate?
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
We need to check the instance document version first. This is especially true in cases
where the document is &lt;em&gt;not qualified with a different namespace&lt;/em&gt; when the version
changes.&lt;/li&gt;
&lt;li&gt;
We grab the appropriate schema or schema set&lt;/li&gt;
&lt;li&gt;
We validate the inbound XML document, throw a typed &lt;font face="Courier New"&gt;XmlInvalidException&lt;/font&gt; if
invalid&lt;/li&gt;
&lt;li&gt;
We process the call&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The service side is quite straightforward.
&lt;/p&gt;
&lt;p&gt;
Let's look at the &lt;strong&gt;client&lt;/strong&gt; and what are the options for painless generation
of service calls using this mechanism.
&lt;/p&gt;
&lt;p&gt;
Generally, one can always produce an instance &lt;em&gt;invoke document&lt;/em&gt; by hand on
the client. &lt;em&gt;By hand&lt;/em&gt; meaning using &lt;font face="Courier New"&gt;System.Xml&lt;/font&gt; classes
and DOM concepts. Since this is higly error prone and gets tedious with increasing
complexity, there is a notion of a schema compiler, which automatically translates
your XML Schema into the CLR type system. &lt;font face="Courier New"&gt;Xsd.exe&lt;/font&gt; and &lt;font face="Courier New"&gt;XmlSerializer&lt;/font&gt; are
your friends. 
&lt;/p&gt;
&lt;p&gt;
If your schema requires parts of the instance document to be digitally signed or encrypted,
you will need to adorn the serializer output with some manual DOM work. This might
also be a reason to use the third option.
&lt;/p&gt;
&lt;p&gt;
The third, and easiest option for the general developer, is to provide a &lt;strong&gt;local
object model&lt;/strong&gt;, which serializes the requests on the client. This is an example:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;ProcessInstruction pi = new ProcessInstruction();&lt;br&gt;
pi.Instruction = "Add";&lt;br&gt;
pi.Parameter1 = 10;&lt;br&gt;
pi.Parameter2 = 21;&lt;br&gt;
pi.Sign(cert); // pi.Encrypt(cert);&lt;br&gt;
pi.Serialize();&lt;br&gt;
proxy.Process(pi.SerializedForm);&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
The main benefit of this approach comes down to having an option on the server and
the client. Client developers have three different levels of complexity for generating
service calls. The model allows them to be as close to the wire as they see fit. Or
they can be abstracted completely from the wire representation if you provide a local
object model to access your services.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=ab874bc2-1546-48d1-a8aa-46f0bf876d93" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx</comments>
      <category>.NET 3.0 - WCF</category>
      <category>.NET 3.5 - WCF</category>
      <category>Architecture</category>
      <category>Web Services</category>
      <category>XML</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=bca19fa8-7ba8-43d8-873e-3a8cf03335cb</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=bca19fa8-7ba8-43d8-873e-3a8cf03335cb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Based on my <a href="http://www.request-response.com/blog/PermaLink,guid,c421ff72-d5bc-4b5f-8c52-ed5e73e8dd00.aspx">previous
post</a>, I managed to get <strong>distributed transaction</strong> scenario
working using <a href="http://wcf.netfx3.com/">WCF</a>, <a href="http://www.w3.org/TR/soap12-mtom/">MTOM</a> and <a href="http://www.ibm.com/developerworks/library/specification/ws-tx/">WS-AtomicTransactions</a>.
</p>
        <p>
This means that you have the option to transport <em>arbitrary files</em>, using transactional <strong>ACID</strong> semantics,
from the client, over HTTP and MTOM.
</p>
        <p>
The idea is to integrate a distributed transaction with <a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx">TxF</a>,
or NTFS file system transaction. This only works on Windows Server 2008 (Longhorn
Server) and Windows Vista. 
</p>
        <p>
Download: <a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip">Sample
code</a></p>
        <p>
If the client starts a transaction then <em>all files</em> within it should be stored
on the server. If something fails or client does not commit, <em>no harm is done</em>.
The beauty of this is that it's all seamlessly integrated into the current communication/OS
stack.
</p>
        <p>
This is <strong>shipping technology</strong>; you just have to dive a little deeper
to use it.
</p>
        <p>
Here's the scenario:<br /><br /><img src="http://www.request-response.com/blog/images/txf_wcf1.jpg" /></p>
        <p>
There are a couple of issues that need to be addressed before we move to the implementation:
</p>
        <ul>
          <li>
            <strong>You should use the managed wrapper included <a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip">here</a><br /></strong>There is support for <font face="Courier New">TransactedFile</font> and <font face="Courier New">TransactedDirectory</font> built
it. Next version of <a href="http://msdn2.microsoft.com/en-us/library/ms756482.aspx">VistaBridge</a> samples
will include an updated version of this wrapper.<br /><br /></li>
          <li>
            <strong>Limited distributed transactions support on a system drive<br /></strong>There is no way to get DTC a superior access coordinator<em></em>role for <a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx">TxF</a> on
the system drive (think <font face="Courier New">c:\</font> system drive). This is
a major downside in the current implementation of <a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx">TxF</a>,
since I would prefer that system/boot files would be transaction-locked anyway. You
have two options if you want to run the <a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip">following
sample</a>:<br /><br /><ul><li><strong>Define secondary resource manager for your directory</strong><br />
This allows system drive resource manager to still protect system files, but creates
a secondary resource manager for the specified directory. Do this: 
<ul><li><font face="Courier New">fsutil resource create c:\txf</font></li><li><font face="Courier New">fsutil resource start c:\txf<br /></font>You can query your new secondary resource manager by <font face="Courier New">fsutil
resource info c:\txf</font>.<br /><br /></li></ul></li><li><strong>Use another partition<br /></strong>Any partition outside the system partition is ok. You cannot use network
shares, but <em>USB keys will work</em>. Plug it in and change the paths as defined
at the end of this post.</li></ul></li>
        </ul>
        <p>
OK, here we go.
</p>
        <p>
Here's the service contract:
</p>
        <p>
          <font face="Courier New">[ServiceContract(SessionMode = SessionMode.Allowed)]<br />
interface ITransportFiles<br />
{<br />
   [OperationContract]<br />
   [TransactionFlow(TransactionFlowOption.Allowed)]<br />
   byte[] GetFile(string name);</font>
        </p>
        <p>
          <font face="Courier New">   [OperationContract]<br />
   [TransactionFlow(TransactionFlowOption.Allowed)]<br />
   void PutFile(byte[] data, string name);<br />
} </font>
        </p>
        <p>
We allow the sessionful binding (it's not <em>required</em>, though) and allow transactions
to flow from the client side. Again, transactions are not <em>mandatory</em>, since
client may opt-out of using them and just transport files without a transaction.
</p>
        <p>
The provided transport mechanism uses <a href="http://www.w3.org/TR/soap12-mtom/">MTOM</a>,
since the contract's parameter model is appropriate for it and because it's much more
effective transferring binary data.
</p>
        <p>
So here's the service config:
</p>
        <p>
          <font face="Courier New">&lt;system.serviceModel&gt;<br />
  &lt;bindings&gt;<br />
    &lt;wsHttpBinding&gt;<br /><strong>      &lt;binding name="MTOMBinding"<br />
          transactionFlow="true"<br />
          messageEncoding="Mtom"<br />
          maxReceivedMessageSize="10485760"&gt;<br />
        &lt;readerQuotas maxArrayLength="10485760"/&gt;</strong><br />
      &lt;/binding&gt;<br />
    &lt;/wsHttpBinding&gt;<br />
  &lt;/bindings&gt;<br />
  &lt;services&gt;<br />
    &lt;service name="WCFService.TransportService"&gt;<br />
      &lt;host&gt;<br />
        &lt;baseAddresses&gt;<br />
          &lt;add baseAddress="</font>
          <font face="Courier New">http://localhost:555/transportservice"</font>
          <font face="Courier New">&gt;<br />
        &lt;/baseAddresses&gt;<br />
      &lt;/host&gt;<br />
      &lt;endpoint address=""<br />
          binding="wsHttpBinding"<br /><strong>          bindingConfiguration="MTOMBinding"<br /></strong>          contract="WCFService.ITransportFiles"/&gt;<br />
    &lt;/service&gt;<br />
  &lt;/services&gt;<br />
&lt;/system.serviceModel&gt;</font>
        </p>
        <p>
Here, <font face="Courier New">MTOMBinding</font> is being used to specify <a href="http://www.w3.org/TR/soap12-mtom/">MTOM</a> wire
encoding. Also, quotas and <font face="Courier New">maxReceivedMessageSize</font> attribute
is being adjusted to 10 MB, since we are probably transferring larger binary files.
</p>
        <p>
Service implementation is straight forward:
</p>
        <p>
          <font face="Courier New">[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]<br />
class TransportService : ITransportFiles<br />
{<br />
    [OperationBehavior(TransactionScopeRequired = true)]<br /><strong>    public byte[] GetFile(string name)<br /></strong>    {<br />
        Console.WriteLine("GetFile: {0}", name);<br />
        Console.WriteLine("Distributed Tx ID: {0}",<br />
          Transaction.Current.TransactionInformation.DistributedIdentifier);<br />
        return ReadFully(TransactedFile.Open(@"C:\TxF\Service\"
+ name,<br />
          FileMode.Open, FileAccess.Read,
FileShare.Read), 0);<br />
    }</font>
        </p>
        <p>
          <font face="Courier New">    [OperationBehavior(TransactionScopeRequired
= true)]<br /><strong>    public void PutFile(byte[] data, string filename)<br /></strong>    {<br />
        Console.WriteLine("PutFile: {0}", filename);<br />
        Console.WriteLine("Distributed Tx ID: {0}",<br />
          Transaction.Current.TransactionInformation.DistributedIdentifier);</font>
        </p>
        <p>
          <font face="Courier New">        using (BinaryWriter
bw = new BinaryWriter(<br />
            TransactedFile.Open(@"C:\TxF\Service\"
+ filename,<br />
              FileMode.Create,
FileAccess.Write, FileShare.Write)))<br />
        {<br />
            bw.Write(data,
0, data.Length);<br />
            
<br />
            // clean up<br />
            bw.Flush();<br />
        }<br />
    }<br />
}</font>
        </p>
        <p>
Client does four things:
</p>
        <ol>
          <li>
Sends three files (client - server) - no transaction 
</li>
          <li>
Gets three files (server - client) - no transaction 
</li>
          <li>
Sends three files (client - server) - distributed transaction, all or nothing 
</li>
          <li>
Gets three files (server - client) - distributed transaction, all or nothing</li>
        </ol>
        <p>
Before you run:
</p>
        <ul>
          <li>
Decide on the secondary resource manager option (system drive, enable it using <font face="Courier New">fsutil.exe</font>)
or use another partition (USB key) 
</li>
          <li>
Change the paths to your scenario. The sample uses <font face="Courier New">C:\TxF</font>, <font face="Courier New">C:\TxF\Service</font> and <font face="Courier New">C:\TxF\Client</font> and
a secondary resource manager. Create these directories before running the sample.</li>
        </ul>
        <p>
Download: <a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip">Sample
code</a></p>
        <p>
          <font color="#a9a9a9" size="1">This sample is provided without any warranty. It's
a sample, so don't use it in production environments.</font>
        </p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=bca19fa8-7ba8-43d8-873e-3a8cf03335cb" />
      </body>
      <title>Managed TxF: Distributed Transactions and Transactional NTFS</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx</link>
      <pubDate>Mon, 23 Jul 2007 20:54:13 GMT</pubDate>
      <description>&lt;p&gt;
Based on my &lt;a href="http://www.request-response.com/blog/PermaLink,guid,c421ff72-d5bc-4b5f-8c52-ed5e73e8dd00.aspx"&gt;previous
post&lt;/a&gt;, I&amp;nbsp;managed to get &lt;strong&gt;distributed transaction&lt;/strong&gt; scenario
working using &lt;a href="http://wcf.netfx3.com/"&gt;WCF&lt;/a&gt;, &lt;a href="http://www.w3.org/TR/soap12-mtom/"&gt;MTOM&lt;/a&gt; and &lt;a href="http://www.ibm.com/developerworks/library/specification/ws-tx/"&gt;WS-AtomicTransactions&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
This means that you have the option to transport &lt;em&gt;arbitrary files&lt;/em&gt;, using transactional &lt;strong&gt;ACID&lt;/strong&gt; semantics,
from the client, over HTTP and MTOM.
&lt;/p&gt;
&lt;p&gt;
The idea is to integrate a distributed transaction with &lt;a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx"&gt;TxF&lt;/a&gt;,
or NTFS file system transaction. This only works on Windows Server 2008 (Longhorn
Server) and Windows Vista. 
&lt;/p&gt;
&lt;p&gt;
Download: &lt;a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip"&gt;Sample
code&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
If the client starts a transaction then &lt;em&gt;all files&lt;/em&gt; within it should be stored
on the server. If something fails or client does not commit, &lt;em&gt;no harm is done&lt;/em&gt;.
The beauty of this is that it's all seamlessly integrated into the current communication/OS
stack.
&lt;/p&gt;
&lt;p&gt;
This is &lt;strong&gt;shipping technology&lt;/strong&gt;; you just have to dive a little deeper
to use it.
&lt;/p&gt;
&lt;p&gt;
Here's the scenario:&lt;br&gt;
&lt;br&gt;
&lt;img src="http://www.request-response.com/blog/images/txf_wcf1.jpg"&gt;
&lt;/p&gt;
&lt;p&gt;
There are a couple of issues that need to be addressed before we move to the implementation:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You should use the managed wrapper included &lt;a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip"&gt;here&lt;/a&gt;
&lt;br&gt;
&lt;/strong&gt;There is support for &lt;font face="Courier New"&gt;TransactedFile&lt;/font&gt; and &lt;font face="Courier New"&gt;TransactedDirectory&lt;/font&gt; built
it. Next version of &lt;a href="http://msdn2.microsoft.com/en-us/library/ms756482.aspx"&gt;VistaBridge&lt;/a&gt; samples
will include an updated version of this wrapper.&lt;br&gt;
&lt;br&gt;
&lt;li&gt;
&lt;strong&gt;Limited distributed transactions support on a system drive&lt;br&gt;
&lt;/strong&gt;There is no way to get DTC a superior access coordinator&lt;em&gt; &lt;/em&gt;role for &lt;a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx"&gt;TxF&lt;/a&gt; on
the system drive (think &lt;font face="Courier New"&gt;c:\&lt;/font&gt; system drive). This is
a major downside in the current implementation of &lt;a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx"&gt;TxF&lt;/a&gt;,
since I would prefer that system/boot files would be transaction-locked anyway. You
have two options if you want to run the &lt;a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip"&gt;following
sample&lt;/a&gt;:&lt;br&gt;
&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Define secondary resource manager for your directory&lt;/strong&gt;
&lt;br&gt;
This allows system drive resource manager to still protect system files, but creates
a secondary resource manager for the specified directory. Do this: 
&lt;ul&gt;
&lt;li&gt;
&lt;font face="Courier New"&gt;fsutil resource create c:\txf&lt;/font&gt; 
&lt;li&gt;
&lt;font face="Courier New"&gt;fsutil resource start c:\txf&lt;br&gt;
&lt;/font&gt;You can query your new secondary resource manager by &lt;font face="Courier New"&gt;fsutil
resource info c:\txf&lt;/font&gt;.&lt;br&gt;
&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
&lt;strong&gt;Use another partition&lt;br&gt;
&lt;/strong&gt;Any partition outside the system partition is ok. You cannot use network
shares, but &lt;em&gt;USB keys will work&lt;/em&gt;. Plug it in and change the paths as defined
at the end of this post.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
OK, here we go.
&lt;/p&gt;
&lt;p&gt;
Here's the service contract:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;[ServiceContract(SessionMode = SessionMode.Allowed)]&lt;br&gt;
interface ITransportFiles&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp;&amp;nbsp; [TransactionFlow(TransactionFlowOption.Allowed)]&lt;br&gt;
&amp;nbsp;&amp;nbsp; byte[] GetFile(string name);&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp;&amp;nbsp; [TransactionFlow(TransactionFlowOption.Allowed)]&lt;br&gt;
&amp;nbsp;&amp;nbsp; void PutFile(byte[] data, string name);&lt;br&gt;
}&amp;nbsp;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
We allow the sessionful binding (it's not &lt;em&gt;required&lt;/em&gt;, though) and allow transactions
to flow from the client side. Again, transactions are not &lt;em&gt;mandatory&lt;/em&gt;, since
client may opt-out of using them and just transport files without a transaction.
&lt;/p&gt;
&lt;p&gt;
The provided transport mechanism uses &lt;a href="http://www.w3.org/TR/soap12-mtom/"&gt;MTOM&lt;/a&gt;,
since the contract's parameter model is appropriate for it and because it's much more
effective transferring binary data.
&lt;/p&gt;
&lt;p&gt;
So here's the service config:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;system.serviceModel&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;bindings&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;wsHttpBinding&amp;gt;&lt;br&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;binding name="MTOMBinding"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; transactionFlow="true"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; messageEncoding="Mtom"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; maxReceivedMessageSize="10485760"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;readerQuotas maxArrayLength="10485760"/&amp;gt;&lt;/strong&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/binding&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/wsHttpBinding&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/bindings&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;services&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service name="WCFService.TransportService"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;host&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseAddresses&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add baseAddress="&lt;/font&gt;&lt;font face="Courier New"&gt;http://localhost:555/transportservice"&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/baseAddresses&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/host&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint address=""&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; binding="wsHttpBinding"&lt;br&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bindingConfiguration="MTOMBinding"&lt;br&gt;
&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; contract="WCFService.ITransportFiles"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;/services&amp;gt;&lt;br&gt;
&amp;lt;/system.serviceModel&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Here, &lt;font face="Courier New"&gt;MTOMBinding&lt;/font&gt; is being used to specify &lt;a href="http://www.w3.org/TR/soap12-mtom/"&gt;MTOM&lt;/a&gt; wire
encoding. Also, quotas and &lt;font face="Courier New"&gt;maxReceivedMessageSize&lt;/font&gt; attribute
is being adjusted to 10 MB, since we are probably transferring larger binary files.
&lt;/p&gt;
&lt;p&gt;
Service implementation is straight forward:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]&lt;br&gt;
class TransportService : ITransportFiles&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; [OperationBehavior(TransactionScopeRequired = true)]&lt;br&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public byte[] GetFile(string name)&lt;br&gt;
&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("GetFile: {0}", name);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Distributed Tx ID: {0}",&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Transaction.Current.TransactionInformation.DistributedIdentifier);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ReadFully(TransactedFile.Open(@"C:\TxF\Service\"
+ name,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FileMode.Open, FileAccess.Read,
FileShare.Read), 0);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [OperationBehavior(TransactionScopeRequired
= true)]&lt;br&gt;
&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void PutFile(byte[] data, string filename)&lt;br&gt;
&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("PutFile: {0}", filename);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Distributed Tx ID: {0}",&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Transaction.Current.TransactionInformation.DistributedIdentifier);&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (BinaryWriter
bw = new BinaryWriter(&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; TransactedFile.Open(@"C:\TxF\Service\"
+ filename,&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; FileMode.Create,
FileAccess.Write, FileShare.Write)))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&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; bw.Write(data,
0, data.Length);&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; 
&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; // clean up&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; bw.Flush();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Client does four things:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Sends three files (client - server) - no transaction 
&lt;li&gt;
Gets three files (server - client) - no transaction 
&lt;li&gt;
Sends three files (client - server) - distributed transaction, all or nothing 
&lt;li&gt;
Gets three files (server - client) - distributed transaction, all or nothing&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Before you run:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Decide on the secondary resource manager option (system drive, enable it using &lt;font face="Courier New"&gt;fsutil.exe&lt;/font&gt;)
or use another partition (USB key) 
&lt;li&gt;
Change the paths to your scenario. The sample uses &lt;font face="Courier New"&gt;C:\TxF&lt;/font&gt;, &lt;font face="Courier New"&gt;C:\TxF\Service&lt;/font&gt; and &lt;font face="Courier New"&gt;C:\TxF\Client&lt;/font&gt; and
a secondary resource manager. Create these directories before running the sample.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Download: &lt;a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip"&gt;Sample
code&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#a9a9a9 size=1&gt;This sample is provided without any warranty. It's a sample,
so don't use it in production environments.&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=bca19fa8-7ba8-43d8-873e-3a8cf03335cb" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx</comments>
      <category>.NET 3.5 - WCF</category>
      <category>Transactions</category>
      <category>Web Services</category>
      <category>Windows Vista</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=c6dac5cb-596b-4836-ab83-9802e54d2471</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,c6dac5cb-596b-4836-ab83-9802e54d2471.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,c6dac5cb-596b-4836-ab83-9802e54d2471.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c6dac5cb-596b-4836-ab83-9802e54d2471</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
WS-RM 1.1 is finished. GoodTimes<sup>tm</sup>.
</p>
        <p>
OASIS published two specs:
</p>
        <ul>
          <li>
            <a href="http://docs.oasis-open.org/ws-rx/wsrm/200702/wsrm-1.1-spec-os-01.html">WS-ReliableMessaging
1.1</a>
          </li>
          <li>
            <a href="http://docs.oasis-open.org/ws-rx/wsrmp/200702/wsrmp-1.1-spec-os-01.html">WS-ReliableMessaging
Policy Assertions 1.1</a>
          </li>
        </ul>
        <p>
WCF, as it turns out, will have support for WS-RM 1.1 implementation in Orcas. On
this note, there is a <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e6fd8663-8b77-4649-8d36-3830e18528fa&amp;DisplayLang=en">new
CTP</a> out this week.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=c6dac5cb-596b-4836-ab83-9802e54d2471" />
      </body>
      <title>Out the Door: WS-ReliableMessaging 1.1</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,c6dac5cb-596b-4836-ab83-9802e54d2471.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,c6dac5cb-596b-4836-ab83-9802e54d2471.aspx</link>
      <pubDate>Tue, 03 Jul 2007 14:58:29 GMT</pubDate>
      <description>&lt;p&gt;
WS-RM 1.1 is finished. GoodTimes&lt;sup&gt;tm&lt;/sup&gt;.
&lt;/p&gt;
&lt;p&gt;
OASIS published two specs:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://docs.oasis-open.org/ws-rx/wsrm/200702/wsrm-1.1-spec-os-01.html"&gt;WS-ReliableMessaging
1.1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://docs.oasis-open.org/ws-rx/wsrmp/200702/wsrmp-1.1-spec-os-01.html"&gt;WS-ReliableMessaging
Policy Assertions 1.1&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
WCF, as it turns out, will have support for WS-RM 1.1 implementation in Orcas. On
this note, there is a &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=e6fd8663-8b77-4649-8d36-3830e18528fa&amp;amp;DisplayLang=en"&gt;new
CTP&lt;/a&gt; out this week.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=c6dac5cb-596b-4836-ab83-9802e54d2471" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,c6dac5cb-596b-4836-ab83-9802e54d2471.aspx</comments>
      <category>.NET 3.5 - WCF</category>
      <category>Microsoft</category>
      <category>Web Services</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=bdb761f8-8856-41c8-b4ad-c38338bf6567</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,bdb761f8-8856-41c8-b4ad-c38338bf6567.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,bdb761f8-8856-41c8-b4ad-c38338bf6567.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=bdb761f8-8856-41c8-b4ad-c38338bf6567</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://blogs.msdn.com/nickmalik/archive/2007/05/30/system-reliability-requires-message-durability-immature-wcf.aspx">Nick</a> is
continuing <a href="http://www.request-response.com/blog/PermaLink,guid,03fb0e40-b446-42b5-ad90-3be9b0260cb5.aspx">my
discussion</a> on durable messaging support in modern WS-* based stacks, especially
WCF.
</p>
        <p>
I agree that having a simple channel configuration support to direct messages into
permanent information source (like SQL) would be <em>beneficial</em>.
</p>
        <p>
A simple idea that begs for an alternative implementation of a WCF extensibility
point, has some questions:
</p>
        <ul>
          <li>
What happens when messages are (or should be) exchanged in terms of a transaction
context? 
</li>
          <li>
How can we demand transaction support from the underlying datastore, if we don't want
to put limitations onto anything residing beind the service boundary? 
</li>
          <li>
What about security contexts? How can we acknowledge a secure, durable sessionful
channel after two weeks of service <strike>hibernation</strike> down time? Should
security keys still be valid just because service was down and not responding
all this time? 
</li>
          <li>
Is durability limited to client/service recycling or non-memory message storage? What
about both?</li>
        </ul>
        <p>
Is <font face="Courier New">[DurableService]</font>enough?
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=bdb761f8-8856-41c8-b4ad-c38338bf6567" />
      </body>
      <title>Durable Messaging Continues</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,bdb761f8-8856-41c8-b4ad-c38338bf6567.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,bdb761f8-8856-41c8-b4ad-c38338bf6567.aspx</link>
      <pubDate>Wed, 30 May 2007 20:46:14 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://blogs.msdn.com/nickmalik/archive/2007/05/30/system-reliability-requires-message-durability-immature-wcf.aspx"&gt;Nick&lt;/a&gt; is
continuing &lt;a href="http://www.request-response.com/blog/PermaLink,guid,03fb0e40-b446-42b5-ad90-3be9b0260cb5.aspx"&gt;my
discussion&lt;/a&gt; on durable messaging support in modern WS-* based stacks, especially
WCF.
&lt;/p&gt;
&lt;p&gt;
I agree that having a simple channel configuration support to direct messages into
permanent information source (like SQL) would be &lt;em&gt;beneficial&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
A simple idea that begs for an alternative implementation of a WCF&amp;nbsp;extensibility
point, has some questions:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
What happens when messages are (or should be) exchanged in terms of a transaction
context? 
&lt;li&gt;
How can we demand transaction support from the underlying datastore, if we don't want
to put limitations onto anything residing beind the service boundary? 
&lt;li&gt;
What about security contexts? How can we acknowledge a secure, durable sessionful
channel after two weeks of service &lt;strike&gt;hibernation&lt;/strike&gt; down time? Should
security keys still be valid just&amp;nbsp;because service was down and not responding
all this time? 
&lt;li&gt;
Is durability limited to client/service recycling or non-memory message storage? What
about both?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Is&amp;nbsp;&lt;font face="Courier New"&gt;[DurableService]&lt;/font&gt;enough?
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=bdb761f8-8856-41c8-b4ad-c38338bf6567" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,bdb761f8-8856-41c8-b4ad-c38338bf6567.aspx</comments>
      <category>.NET 3.5 - WCF</category>
      <category>Architecture</category>
      <category>Transactions</category>
      <category>Web Services</category>
    </item>
    <item>
      <trackback:ping>https://www.request-response.com/blog/Trackback.aspx?guid=afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c</trackback:ping>
      <pingback:server>https://www.request-response.com/blog/pingback.aspx</pingback:server>
      <pingback:target>https://www.request-response.com/blog/PermaLink,guid,afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c.aspx</pingback:target>
      <dc:creator>Matevz Gacnik</dc:creator>
      <wfw:comment>https://www.request-response.com/blog/CommentView,guid,afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c.aspx</wfw:comment>
      <wfw:commentRss>https://www.request-response.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://en.wikipedia.org/wiki/Plain_Old_XML">POX</a> (Plain Old XML) support
in Orcas is <em>brilliant</em>.
</p>
        <p>
Consider the following service contract:
</p>
        <p>
          <font face="Courier New">[ServiceContract(Namespace = "")]<br />
interface IPOXService<br />
{<br />
   [OperationContract]<br />
   [HttpTransferContract(Path = "Echo", Method = "GET")]<br />
   string Echo(string strString1, ref string strString2, out string strString3);<br />
}</font>
        </p>
        <p>
And the following service (or, better <font face="Courier New">Echo</font> method)
implementation:
</p>
        <p>
          <font face="Courier New">public class POXService : IPOXService<br />
{<br />
   public string Echo(string strString1, 
<br />
      </font>
          <font face="Courier New">ref string strString2,
out string strString3)<br />
   {<br />
      strString2 = "strString2: " + strString2;<br />
      strString3 = "strString3";<br />
      return "Echo: " + strString1;<br />
   }<br />
}</font>
        </p>
        <p>
Host it using this:
</p>
        <p>
          <font face="Courier New">ServiceMetadataBehavior smb = new ServiceMetadataBehavior();<br />
smb.HttpGetEnabled = true;<br /><br /></font>
          <font face="Courier New">ServiceHost sh = new ServiceHost(typeof(POXService),
new Uri<br />
   ("http://localhost:666</font>
          <font face="Courier New">"));<br />
ServiceEndpoint ep = sh.AddServiceEndpoint(typeof(IPOXService), 
<br />
   new WebHttpBinding(), "POX");<br />
ep.Behaviors.Add(new HttpTransferEndpointBehavior());<br />
sh.Description.Behaviors.Add(smb);</font>
        </p>
        <p>
          <font face="Courier New">sh.Open();<br />
Console.WriteLine("POX Service Running...");<br />
Console.ReadLine();<br />
sh.Close();</font>
        </p>
        <p>
If you open IE and hit the service endpoint (<font face="Courier New">http://localhost:666/POX/Echo</font>)
without URL encoded parameters, you get the following XML back:
</p>
        <p>
          <font face="Courier New">&lt;EchoResponse&gt;<br />
   &lt;EchoResult&gt;Echo:&lt;/EchoResult&gt; 
<br />
   &lt;strString2&gt;strString2:&lt;/strString2&gt; 
<br />
   &lt;strString3&gt;strString3&lt;/strString3&gt; 
<br />
&lt;/EchoResponse&gt;</font>
        </p>
        <p>
Now, drop some parameters in (<font face="Courier New">http://localhost:666/POX/Echo?strString1=boo&amp;strString2=foo&amp;strString3=bar</font>),
this is returned:
</p>
        <p>
          <font face="Courier New">&lt;EchoResponse&gt;<br />
   &lt;EchoResult&gt;Echo: boo&lt;/EchoResult&gt; 
<br />
   &lt;strString2&gt;strString2: foo&lt;/strString2&gt; 
<br />
   &lt;strString3&gt;strString3&lt;/strString3&gt; 
<br />
&lt;/EchoResponse&gt;</font>
        </p>
        <p>
          <strong>Nice.</strong> I especially like the fact that <font face="Courier New">ref</font> and <font face="Courier New">out </font>parameters
are serialized with the metod return value.
</p>
        <p>
Reach in with <font face="Courier New">//EchoResponse/strString2</font> for <font face="Courier New">ref</font> parameter
and <font face="Courier New">//EchoResponse/strString3</font> for <font face="Courier New">out</font> parameter.
Return value is available on <font face="Courier New">//EchoResponse/EchoResult</font>.
Simple and effective.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c" />
      </body>
      <title>Orcas: POX Service Support</title>
      <guid isPermaLink="false">https://www.request-response.com/blog/PermaLink,guid,afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c.aspx</guid>
      <link>https://www.request-response.com/blog/PermaLink,guid,afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c.aspx</link>
      <pubDate>Sat, 10 Mar 2007 20:55:49 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://en.wikipedia.org/wiki/Plain_Old_XML"&gt;POX&lt;/a&gt; (Plain Old XML) support
in Orcas is &lt;em&gt;brilliant&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
Consider the following service contract:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;[ServiceContract(Namespace = "")]&lt;br&gt;
interface IPOXService&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp; [OperationContract]&lt;br&gt;
&amp;nbsp;&amp;nbsp; [HttpTransferContract(Path = "Echo", Method = "GET")]&lt;br&gt;
&amp;nbsp;&amp;nbsp; string Echo(string strString1, ref string strString2, out string strString3);&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
And the following service (or, better &lt;font face="Courier New"&gt;Echo&lt;/font&gt; method)
implementation:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;public class POXService : IPOXService&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp; public string Echo(string strString1, 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;ref string strString2,
out string strString3)&lt;br&gt;
&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strString2 = "strString2: " + strString2;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strString3 = "strString3";&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return "Echo: " + strString1;&lt;br&gt;
&amp;nbsp;&amp;nbsp; }&lt;br&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Host it using this:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;ServiceMetadataBehavior smb = new ServiceMetadataBehavior();&lt;br&gt;
smb.HttpGetEnabled = true;&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;font face="Courier New"&gt;ServiceHost&amp;nbsp;sh = new ServiceHost(typeof(POXService),
new Uri&lt;br&gt;
&amp;nbsp;&amp;nbsp; ("http://localhost:666&lt;/font&gt;&lt;font face="Courier New"&gt;"));&lt;br&gt;
ServiceEndpoint ep = sh.AddServiceEndpoint(typeof(IPOXService), 
&lt;br&gt;
&amp;nbsp;&amp;nbsp; new WebHttpBinding(), "POX");&lt;br&gt;
ep.Behaviors.Add(new HttpTransferEndpointBehavior());&lt;br&gt;
sh.Description.Behaviors.Add(smb);&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;sh.Open();&lt;br&gt;
Console.WriteLine("POX Service Running...");&lt;br&gt;
Console.ReadLine();&lt;br&gt;
sh.Close();&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
If you open IE and hit the service endpoint (&lt;font face="Courier New"&gt;http://localhost:666/POX/Echo&lt;/font&gt;)
without URL encoded parameters, you get the following XML back:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;EchoResponse&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;EchoResult&amp;gt;Echo:&amp;lt;/EchoResult&amp;gt; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;strString2&amp;gt;strString2:&amp;lt;/strString2&amp;gt; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;strString3&amp;gt;strString3&amp;lt;/strString3&amp;gt; 
&lt;br&gt;
&amp;lt;/EchoResponse&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Now, drop some parameters in (&lt;font face="Courier New"&gt;http://localhost:666/POX/Echo?strString1=boo&amp;amp;strString2=foo&amp;amp;strString3=bar&lt;/font&gt;),
this is returned:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;lt;EchoResponse&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;EchoResult&amp;gt;Echo: boo&amp;lt;/EchoResult&amp;gt; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;strString2&amp;gt;strString2: foo&amp;lt;/strString2&amp;gt; 
&lt;br&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;strString3&amp;gt;strString3&amp;lt;/strString3&amp;gt; 
&lt;br&gt;
&amp;lt;/EchoResponse&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Nice.&lt;/strong&gt; I especially like the fact that &lt;font face="Courier New"&gt;ref&lt;/font&gt; and &lt;font face="Courier New"&gt;out &lt;/font&gt;parameters
are serialized with the metod return value.
&lt;/p&gt;
&lt;p&gt;
Reach in with &lt;font face="Courier New"&gt;//EchoResponse/strString2&lt;/font&gt; for &lt;font face="Courier New"&gt;ref&lt;/font&gt; parameter
and &lt;font face="Courier New"&gt;//EchoResponse/strString3&lt;/font&gt; for &lt;font face="Courier New"&gt;out&lt;/font&gt; parameter.
Return value is available on &lt;font face="Courier New"&gt;//EchoResponse/EchoResult&lt;/font&gt;.
Simple and effective.
&lt;/p&gt;
&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c" /&gt;</description>
      <comments>https://www.request-response.com/blog/CommentView,guid,afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c.aspx</comments>
      <category>.NET 3.5 - WCF</category>
    </item>
  </channel>
</rss>