<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Matevz Gacnik's Weblog</title>
  <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/" />
  <link rel="self" href="http://www.request-response.com/blog/SyndicationService.asmx/GetAtom" />
  <logo>http://www.request-response.com/blog/images/favicon.jpg</logo>
  <icon>favicon.ico</icon>
  <updated>2010-08-20T07:41:21.8499912+02:00</updated>
  <author>
    <name>Matevz Gacnik</name>
  </author>
  <subtitle>Technology Philanthropy</subtitle>
  <id>http://www.request-response.com/blog/</id>
  <generator uri="http://dasblog.info/" version="2.1.8102.813">DasBlog</generator>
  <entry>
    <title>P != NP Proof Failing</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,e30eb5c0-f98a-4f4e-ab41-0b7d431baf4f.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,e30eb5c0-f98a-4f4e-ab41-0b7d431baf4f.aspx</id>
    <published>2010-08-19T22:31:28.877+02:00</published>
    <updated>2010-08-20T07:41:21.8499912+02:00</updated>
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the most important steps needed for computer science to get itself to the next
level seems to be fading away.
</p>
        <p>
          <img border="1" src="http://www.request-response.com/blog/images/pnpproof.png" />
        </p>
        <p>
          <a href="http://en.wikipedia.org/wiki/P_versus_NP_problem">P vs NP</a>
        </p>
        <p>
Actually, its proof from is playing <a href="http://rjlipton.wordpress.com/2010/08/15/the-p%e2%89%a0np-proof-is-one-week-old/">hard
to catch</a> again. This question (whether P=NP or P!=NP) does not want to be answered.
It could be, that the problem of proving it is also <a href="http://en.wikipedia.org/wiki/NP-complete">NP-complete</a>.
</p>
        <p>
The (scientific) community <strike>wants</strike> needs closure. If P != NP would
be proven, a lot of orthodox legislature in PKI, cryptography and signature/timestamp
validity would probably become looser. If P=NP is true, well, s*!t hits the fan.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=e30eb5c0-f98a-4f4e-ab41-0b7d431baf4f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Visual Studio 2010 Beta 2: Why this Lack of Pureness Again?</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,535c3bf1-3cd9-4dc8-b555-33cca28b2bd3.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,535c3bf1-3cd9-4dc8-b555-33cca28b2bd3.aspx</id>
    <published>2009-10-24T13:50:47.564+02:00</published>
    <updated>2009-10-24T15:16:58.69+02:00</updated>
    <category term=".NET 4.0 - General" label=".NET 4.0 - General" scheme="http://www.request-response.com/blog/CategoryView,category,NET40General.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Developer pureness is what we should all strive for.
</p>
        <p>
This is not it:
</p>
        <p>
          <img border="1" src="http://www.request-response.com/blog/images/pureness1.png" />
        </p>
        <p>
Conflicting with this:
</p>
        <p>
          <font face="Courier New">[c:\NetFx4\versiontester\bin\debug]corflags VersionTester.exe<br />
Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  3.5.21022.8<br />
Copyright (c) Microsoft Corporation.  All rights reserved.</font>
        </p>
        <p>
          <font face="Courier New">
            <strong>
              <font color="#a52a2a">Version   : v4.0.21006</font>
            </strong>
            <br />
CLR Header: 2.5<br />
PE        : PE32<br />
CorFlags  : 1<br />
ILONLY    : 1<br />
32BIT     : 0<br />
Signed    : 0</font>
        </p>
        <p>
Visual Studio must display version number of <strong>4.0</strong> instead of <strong>4</strong> in
RTM. It needs to display major and minor number of the new framework coherently
with 2.0, 3.0, 3.5.
</p>
        <p>
Otherwise my compulsive disorder kicks in.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=535c3bf1-3cd9-4dc8-b555-33cca28b2bd3" />
      </div>
    </content>
  </entry>
  <entry>
    <title>ServiceModel: Assembly Size in .NET 4.0</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,817da713-56e2-4595-9b39-ce74ff94537f.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,817da713-56e2-4595-9b39-ce74ff94537f.aspx</id>
    <published>2009-10-24T13:39:05.114+02:00</published>
    <updated>2009-10-25T19:44:29.191+01:00</updated>
    <category term=".NET 4.0 - General" label=".NET 4.0 - General" scheme="http://www.request-response.com/blog/CategoryView,category,NET40General.aspx" />
    <category term=".NET 4.0 - WCF" label=".NET 4.0 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET40WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm just poking around the new framework, dealing with corflags and CLR Header versions
(more on that later), but what I found is the following.
</p>
        <p>
Do a <font face="Courier New">dir *.dll /o:-s</font> in the framework directory. You
get this on .NET FX 4.0 beta 2 box:
</p>
        <p>
          <font face="Courier New">[c:\windows\microsoft.net\framework64\v4.0.21006]dir *.dll
/o:-s</font>
        </p>
        <p>
          <font face="Courier New"> Volume in drive C is 7  Serial number is 1ED5:8CA5<br />
 Directory of  C:\Windows\Microsoft.NET\Framework64\v4.0.21006\*.dll</font>
        </p>
        <p>
          <font face="Courier New"> 7.10.2009 3:44   9.833.784  clr.dll<br /><font color="#a52a2a"><strong> 7.10.2009 2:44   6.072.664  System.ServiceModel.dll</strong></font><br />
 7.10.2009 2:44   5.251.928  System.Windows.Forms.dll<br />
 7.10.2009 6:04   5.088.584  System.Web.dll<br />
 7.10.2009 5:31   5.086.024  System.Design.dll<br />
 7.10.2009 3:44   4.927.808  mscorlib.dll<br />
 7.10.2009 3:44   3.529.608  Microsoft.VB.Activities.Compiler.dll<br />
 7.10.2009 2:44   3.501.376  System.dll<br />
 7.10.2009 2:44   3.335.000  System.Data.Entity.dll<br />
 7.10.2009 3:44   3.244.360  System.Data.dll<br />
 7.10.2009 2:44   2.145.096  System.XML.dll<br />
 7.10.2009 5:31   1.784.664  System.Web.Extensions.dll<br />
 7.10.2009 2:44   1.711.488  System.Windows.Forms.DataVis.dll<br />
 7.10.2009 5:31   1.697.128  System.Web.DataVis.dll<br />
 7.10.2009 5:31   1.578.352  System.Workflow.ComponentModel.dll<br />
 7.10.2009 3:44   1.540.928  clrjit.dll<br />
 7.10.2009 3:44   1.511.752  mscordacwks.dll<br />
 7.10.2009 3:44   1.454.400  mscordbi.dll<br />
 7.10.2009 2:44   1.339.248  System.Activities.Presentation.dll<br />
 7.10.2009 5:31   1.277.776  Microsoft.Build.dll<br />
 7.10.2009 2:44   1.257.800  System.Core.dll<br />
 7.10.2009 2:44   1.178.448  System.Activities.dll<br />
 7.10.2009 5:31   1.071.464  System.Workflow.Activities.dll<br />
 7.10.2009 5:31   1.041.256  Microsoft.Build.Tasks.v4.0.dll<br />
 7.10.2009 2:44   1.026.920  System.Runtime.Serialization.dll</font>
        </p>
        <p>
Funny how many engineer dollars are/were spent on middle tier technologies I love.
</p>
        <p>
Proof: <font face="Courier New">System.ServiceModel.dll</font> is bigger then <font face="Courier New">System.dll</font>, <font face="Courier New">System.Windows.Forms.dll</font>, <font face="Courier New">mscorlib.dll</font>,
and <font face="Courier New">System.Data.dll</font>. 
</p>
        <p>
We only bow to <font face="Courier New">clr.dll</font>, a new .NET 4.0 Common
Language Runtime implementation.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=817da713-56e2-4595-9b39-ce74ff94537f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Talk at Interoperability Day 2009</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,ba451d69-fe26-4881-adf2-dbd802ac8845.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,ba451d69-fe26-4881-adf2-dbd802ac8845.aspx</id>
    <published>2009-06-03T15:23:45.224+02:00</published>
    <updated>2009-10-25T19:47:00.959+01:00</updated>
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Work" label="Work" scheme="http://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Interoperability day is focused on, well, interoperability. Especially between major
vendors in government space.
</p>
        <p>
We talked about major issues in long term document preservation formats and the penetration
of Office serialization in real world...
</p>
        <p>
.. and the lack of support from legislature covering long term electronic document
formats and their use.
</p>
        <p>
Here's the <a href="http://www.request-response.com/blog/content/binary/interopday2009.pptx">PPT</a> [Slovenian].
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=ba451d69-fe26-4881-adf2-dbd802ac8845" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Speaking at Document Interop Initiative</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,e75263af-f55d-4b9e-9e70-9c503ae86ce8.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,e75263af-f55d-4b9e-9e70-9c503ae86ce8.aspx</id>
    <published>2009-05-16T20:21:51.331+02:00</published>
    <updated>2009-05-18T12:02:40.905+02:00</updated>
    <category term="Microsoft" label="Microsoft" scheme="http://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <category term="Work" label="Work" scheme="http://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
On Monday, 05/18/2009 I'm speaking at <a href="http://www.documentinteropinitiative.org/">Document
Interop Initiative</a> in London, England.
</p>
        <p>
Title of the talk is: <em>High Fidelity Programmatic Access to Document Content</em>,
which will cover the following topics:
</p>
        <ul>
          <li>
Importance of OOXML as a standards based format, especially in technical issues of
long term storage for document content preservation 
</li>
          <li>
Importance of legal long term storage for document formats 
</li>
          <li>
Signature and timestamp benefits of long term XML formats 
</li>
          <li>
Performance and actual cost analysis of using publicly-parsable formats 
</li>
          <li>
Benefits of having a high fidelity programmatic access to document content, backed
with standardization</li>
        </ul>
        <p>
The event is held at Microsoft Limited, Cardinal Place, 100 Victoria Street SW1E 5JL,
London.
</p>
        <p>
Update: Here's the <a href="http://www.request-response.com/blog/content/binary/london2009_may.zip">presentation</a>.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=e75263af-f55d-4b9e-9e70-9c503ae86ce8" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Designing Clean Object Models with SvcUtil.exe</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,e855a729-04c4-4504-b20d-037bd13f0ec2.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,e855a729-04c4-4504-b20d-037bd13f0ec2.aspx</id>
    <published>2009-04-10T23:06:43.37+02:00</published>
    <updated>2009-04-10T23:06:43.37+02:00</updated>
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Web Services" label="Web Services" scheme="http://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=e855a729-04c4-4504-b20d-037bd13f0ec2" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Bug in XmlSerializer, XmlSerializerNamespaces</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,d27d4672-92f5-4944-8fc9-1f7f098d36e9.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,d27d4672-92f5-4944-8fc9-1f7f098d36e9.aspx</id>
    <published>2009-04-06T14:22:33.315+02:00</published>
    <updated>2009-04-06T14:35:05.772+02:00</updated>
    <category term=".NET 3.5 - General" label=".NET 3.5 - General" scheme="http://www.request-response.com/blog/CategoryView,category,NET35General.aspx" />
    <category term="XML" label="XML" scheme="http://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <font face="Courier New">XmlSerializer</font> is a great peace of technology. Combined
with <font face="Courier New">xsd.exe</font> and friends (<font face="Courier New">XmlSerializerNamespaces</font>,
et al.) it's a powerful tool for one to get around XML instance serialization/deserialization.
</p>
        <p>
But, there is a potentially serious bug present, even in 3.5 SP1 version of the .NET
Framework.
</p>
        <p>
Suppose we have the following XML structure:
</p>
        <p>
          <font face="Courier New">&lt;Envelope xmlns="NamespaceA" 
<br />
          xmlns:B="NamespaceB"&gt;<br />
  &lt;B:Header&gt;&lt;/B:Header&gt;<br />
  &lt;Body&gt;&lt;/Body&gt;<br />
&lt;/Envelope&gt;</font>
        </p>
        <p>
This tells you that <font face="Courier New">Envelope</font>, and <font face="Courier New">Body</font> elements
are in the same namespace (namely <font face="Courier New">'NamespaceA'</font>), while <font face="Courier New">Header</font> is
qualified with <font face="Courier New">'NamespaceB'</font>.
</p>
        <p>
Now suppose we need to programmatically insert <font face="Courier New">&lt;B:Header&gt;</font> element
into an empty, <em>core</em>, document.
</p>
        <p>
Core document:
</p>
        <p>
          <font face="Courier New">&lt;Envelope xmlns="NamespaceA" 
<br />
          xmlns:B="NamespaceB"&gt;<br />
  &lt;Body&gt;&lt;/Body&gt;<br />
&lt;/Envelope&gt;</font>
        </p>
        <p>
Now do an <font face="Courier New">XmlNode.InsertNode()</font> of the following:
</p>
        <p>
          <font face="Courier New">&lt;B:Header&gt;...&lt;/B:Header&gt;</font>
        </p>
        <p>
We should get:
</p>
        <p>
          <font face="Courier New">&lt;Envelope xmlns="NamespaceA" 
<br />
          xmlns:B="NamespaceB"&gt;<br />
  &lt;B:Header&gt;...&lt;/B:Header&gt;<br />
  &lt;Body&gt;&lt;/Body&gt;<br />
&lt;/Envelope&gt;</font>
        </p>
        <p>
To get the <em>to be inserted part</em> one would serialize (using <font face="Courier New">XmlSerializer</font>)
the following <font face="Courier New">Header</font> document:
</p>
        <p>
          <font face="Courier New">&lt;B: Header xmlns:B="NamespaceB"&gt;<br />
  ...<br />
&lt;/B:Header&gt;</font>
        </p>
        <p>
To do this, a simple <font face="Courier New">XmlSerializer</font> magic will do the
trick:
</p>
        <p>
          <font face="Courier New">XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();<br />
xsn.Add("B", "NamespaceB");</font>
        </p>
        <p>
          <font face="Courier New">XmlSerializer xSer = new XmlSerializer(typeof(Header));<br />
XmlTextWriter tw = new XmlTextWriter(ms, null);<br />
xSer.Serialize(tw, h, xsn);</font>
        </p>
        <p>
          <font face="Courier New">ms.Seek(0, SeekOrigin.Begin);</font>
        </p>
        <p>
          <font face="Courier New">XmlDocument doc = new XmlDocument()<br />
doc.Load(ms);<br />
ms.Close();</font>
        </p>
        <p>
This would generate exactly what we wanted. A prefixed namespace based XML document,
with the <font face="Courier New">B</font> prefix bound to <font face="Courier New">'NamespaceB'</font>.
</p>
        <p>
Now, if we would import this document fragment into our core document using <font face="Courier New">XmlNode.ImportNode()</font>,
we would get:
</p>
        <p>
          <font face="Courier New">&lt;Envelope xmlns="NamespaceA" 
<br />
          xmlns:B="NamespaceB"&gt;<br />
  &lt;B:Header <font color="#ff0000">xmlns:B="NamespaceB"</font>&gt;...&lt;/B:Header&gt;<br />
  &lt;Body&gt;&lt;/Body&gt;<br />
&lt;/Envelope&gt;</font>
        </p>
        <p>
Which is valid and actually, from an XML Infoset view, an <em>isomorphic</em> document
to the original. So what if it's got the same namespace declared twice, right?
</p>
        <p>
Right - until you involve digital signatures. I have described a specific problem
with ambient namespaces in length in this blog entry: <a href="http://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx">XmlSerializer,
Ambient XML Namespaces and Digital Signatures</a>.
</p>
        <p>
When importing a node from another context, <font face="Courier New">XmlNode</font> and
friends do a resolve against all namespace declarations in scope. So, when importing
such a header, <strong>we shouldn't get</strong> a duplicate namespace declaration.
</p>
        <p>
The problem is, we don't get a duplicate namespace declaration, since <font face="Courier New">XmlSerializer</font> actually
inserts a normal XML attribute into the <font face="Courier New">Header</font> element.
That's why we <strong>seem to get</strong> another namespace declaration. It's actually
not a declaration but a plain old attribute. It's even visible (in this
case in <font face="Courier New">XmlElement.Attributes</font>), and it definitely
shouldn't be there.
</p>
        <p>
So if you hit this special case, remove all attributes before importing the node into
your core document. Like this:
</p>
        <p>
          <font face="Courier New">XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();<br />
xsn.Add("B", "NamespaceB");</font>
        </p>
        <p>
          <font face="Courier New">XmlSerializer xSer = new XmlSerializer(typeof(Header));<br />
XmlTextWriter tw = new XmlTextWriter(ms, null);<br />
xSer.Serialize(tw, h, xsn);</font>
        </p>
        <p>
          <font face="Courier New">ms.Seek(0, SeekOrigin.Begin);</font>
        </p>
        <p>
          <font face="Courier New">XmlDocument doc = new XmlDocument()<br />
doc.Load(ms);<br />
ms.Close();<br /><font color="#ff0000">doc.DocumentElement.Attributes.RemoveAll();</font></font>
        </p>
        <p>
Note that the <strong>serialized document representation will not change</strong>,
since an ambient namespace declaration (B linked to 'NamespaceB') still exists in
the XML Infoset of <font face="Courier New">doc</font> XML document.<br /></p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=d27d4672-92f5-4944-8fc9-1f7f098d36e9" />
      </div>
    </content>
  </entry>
  <entry>
    <title>DOW(n)</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,98b65bd1-31fc-4a88-88d4-b8276d119ea1.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,98b65bd1-31fc-4a88-88d4-b8276d119ea1.aspx</id>
    <published>2008-10-09T22:29:37.728+02:00</published>
    <updated>2008-10-09T22:30:13.656+02:00</updated>
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://en.wikipedia.org/wiki/Dow_Jones_Industrial_Average">DOW</a> is down
almost 700, again. And...
</p>
        <p>
... I just have to post this. Especially when almost everything (besides devaluation
of <em>the safe currency</em>) has already been done.
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>If you had bought $1,000.00 of </em>
            <a href="http://nortel.com/" target="beer">
              <em>Nortel</em>
            </a>
            <em> stock
one year ago, it would now be worth $49.00.<br /><br />
With </em>
            <a href="http://www.enron.com/" target="beer">
              <em>Enron</em>
            </a>
            <em>, you
would have $16.50 of the original $1,000.00.<br /><br />
With </em>
            <a href="http://www.mci.com/" target="beer">
              <em>MCI/Worldcom</em>
            </a>
            <em>,
you would have less than $5.00 left.<br /><br />
If you had bought $1,000.00 worth of </em>
            <a href="http://www.mgd.com/" target="beer">
              <em>Miller
Genuine Draft</em>
            </a>
            <em> (the beer, not the stock) one year ago, drunk all the beer
then turned in the cans for the 10-cent deposit, you would have $214.00.<br /><br />
Based on the above, 401KegPlan.com's current investment advice is to take that $5.00
you have left over and </em>
            <a href="http://www.sotallytober.com/beer/" target="morebeer">
              <em>drink
lots and lots of beer</em>
            </a>
            <em> and recycle.</em>
          </p>
          <p>
            <em>
              <font color="#808080" size="1">Via: </font>
              <a href="http://401kegplan.com/keg/">
                <font color="#808080" size="1">http://401kegplan.com/keg/</font>
              </a>
            </em>
          </p>
        </blockquote>
        <p>
We are going over the edge. <em>We</em> as a world economy.
</p>
        <p>
And yea, I opened a keg of Guinness.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=98b65bd1-31fc-4a88-88d4-b8276d119ea1" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Bleeding Edge 2008: Postback</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,3e45c176-f86b-4b60-b0a5-9425631e2438.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,3e45c176-f86b-4b60-b0a5-9425631e2438.aspx</id>
    <published>2008-10-09T21:42:02.568+02:00</published>
    <updated>2008-10-09T21:42:02.568+02:00</updated>
    <category term="CLR" label="CLR" scheme="http://www.request-response.com/blog/CategoryView,category,CLR.aspx" />
    <category term="Conferences" label="Conferences" scheme="http://www.request-response.com/blog/CategoryView,category,Conferences.aspx" />
    <category term="Microsoft" label="Microsoft" scheme="http://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <category term="Web Services" label="Web Services" scheme="http://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <category term="Work" label="Work" scheme="http://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm sorry it took a week, but here we go.
</p>
        <p>
This is my exit content from <a href="http://www.bleedingedge.si/">Bleeding Edge 2008</a>.
I'm also posting complete conference contents, just in case.
</p>
        <p>
          <img src="http://www.request-response.com/blog/content/binary/be2008.jpg" />
        </p>
        <p>
Thanks go out to <a href="http://blogs.solidq.com/EN/dzupancic/default.aspx">Dušan</a>, <a href="http://blogs.solidq.com/EN/dsarka/default.aspx">Dejan</a>, <a href="http://www.mihavalencic.com/?p=124">Miha</a>, <a href="http://cs.rthand.com/blogs/blog_with_righthand/archive/2008/10/03/Material-from-my-_2200_Make-ORM-applications-more-secure_2F00_Naredimo-ORM-aplikacije-varnej_6101_e_2200_-presentation.aspx">Miha</a> and <a href="http://www.krneki.net/blog/">Miha</a>.
</p>
        <p>
Downloads:
</p>
        <ul>
          <li>
Middle Tier Design Unleashed: <a href="http://downloads.request-response.com/BleedingEdge2008_MiddleTier.zip">PPT
&amp; Code</a></li>
          <li>
Complete Conference: <a href="http://downloads.request-response.com/BleedingEdge2008.zip">PPT
&amp; Code</a></li>
        </ul>
        <p>
          <font color="#808080" size="1">Remark: PPT in Slovene only. Code international.</font>
        </p>
        <p>
Thank you for attending. Hope to see you next year!
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=3e45c176-f86b-4b60-b0a5-9425631e2438" />
      </div>
    </content>
  </entry>
  <entry>
    <title>XmlSerializer: Serialized Syntax and How to Override It</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,efa4e231-ddf1-48f4-9a26-54363e799d42.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,efa4e231-ddf1-48f4-9a26-54363e799d42.aspx</id>
    <published>2008-08-29T20:38:07.673+02:00</published>
    <updated>2008-08-29T21:03:06.694+02:00</updated>
    <category term="XML" label="XML" scheme="http://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Recently I needed to specify exactly how I would like a <em>specific class</em> serialized.
Suppose we have the following simple schema:
</p>
        <p>
          <font face="Courier New">&lt;xs:schema targetNamespace="</font>
          <font face="Courier New">http://my.favourite.ns/person.xsd</font>
          <font face="Courier New">"<br />
   elementFormDefault="qualified"<br />
   xmlns:xs="</font>
          <font face="Courier New">http://www.w3.org/2001/XMLSchema</font>
          <font face="Courier New">"<br />
   </font>
          <font face="Courier New">xmlns="</font>
          <font face="Courier New">http://my.favourite.ns/person.xsd"</font>
          <font face="Courier New">&gt;<br /><strong>  &lt;xs:complexType name="Person"&gt;</strong><br />
    &lt;xs:sequence&gt;<br />
      &lt;xs:element name="Name" type="xs:string" /&gt;<br />
      &lt;xs:element name="Surname" type="xs:string" /&gt;<br />
      &lt;xs:element name="Age" type="xs:int" minOccurs="0"
/&gt;<br />
    &lt;/xs:sequence&gt;<br /><strong>  &lt;/xs:complexType&gt;<br /></strong>&lt;/xs:schema&gt;</font>
        </p>
        <p>
Let's call this schema <font face="Courier New">President.xsd</font>.
</p>
        <p>
A valid XML instance against this schema would be, for example:
</p>
        <p>
          <font face="Courier New">&lt;Person xmlns="http://my.favourite.ns/person.xsd"&gt;<br />
   &lt;Name&gt;Barrack&lt;/Name&gt;<br />
   &lt;Surname&gt;Obama&lt;/Surname&gt;<br />
   &lt;Age&gt;47&lt;/Age&gt;<br />
&lt;/Person&gt;</font>
        </p>
        <p>
Since we are serializing against a specific <a href="http://www.w3.org/XML/Schema">XML
schema</a> (XSD), we have an option of schema compilation:
</p>
        <p>
          <font face="Courier New">xsd /c President.xsd</font>
        </p>
        <p>
This, obviously, yields a programmatic type system result in a form of a C# class.
All well and done.
</p>
        <p>
Now.
</p>
        <p>
If we serialize the filled up class instance back to XML, we get a valid XML instance.
It's valid against <font face="Courier New">President.xsd</font>.
</p>
        <p>
There is a case where your schema changes ever so slightly - read, the namespaces
change, and you don't want to recompile the entire solution to support this, but you
still want to use XML serialization. Who doesn't - what do you do?
</p>
        <p>
Suppose we want to get <strong>the following back</strong>, when serializing:
</p>
        <p>
          <font face="Courier New">&lt;PresidentPerson xmlns="</font>
          <font face="Courier New">http://schemas.gama-system.com/<br />
      president.xsd"</font>
          <font face="Courier New">&gt;<br />
   &lt;Name&gt;Barrack&lt;/Name&gt;<br />
   &lt;Surname&gt;Obama&lt;/Surname&gt;<br />
   &lt;Age&gt;47&lt;/Age&gt;<br />
&lt;/PresidentPerson&gt;</font>
        </p>
        <p>
There is an option to override the default serialization technique of <font face="Courier New">XmlSerializer</font>.
Enter  the world of <font face="Courier New">XmlAttributes</font> and <font face="Courier New">XmlAttributeOverrides</font>:
</p>
        <p>
          <font face="Courier New">private XmlSerializer GetOverridedSerializer()<br />
{<br />
   // set overrides for person element<br />
   XmlAttributes attrsPerson = new XmlAttributes();<br />
   XmlRootAttribute rootPerson = 
<br />
      new XmlRootAttribute("<strong>PresidentPerson</strong>");<br />
   rootPerson.Namespace = "</font>
          <font face="Courier New">
            <strong>http://schemas.gama-system.com/<br />
      president.xsd</strong>
          </font>
          <font face="Courier New">";<br />
   attrsPerson.XmlRoot = rootPerson;</font>
        </p>
        <p>
          <font face="Courier New">   // create overrider<br />
   XmlAttributeOverrides xOver = new XmlAttributeOverrides();<br />
   xOver.Add(typeof(Person), attrsPerson);</font>
        </p>
        <p>
          <font face="Courier New">   XmlSerializer xSer = new XmlSerializer(typeof(Person),
xOver);<br />
   return xSer;<br />
}</font>
        </p>
        <p>
Now serialize normally:
</p>
        <p>
          <font face="Courier New">Stream ms = new MemoryStream();<br />
XmlTextWriter tw = new XmlTextWriter(ms, null);<br />
xSer.Serialize(tw, person);</font>
        </p>
        <p>
This will work even if you only have a compiled version of your object graph, and
you don't have any sources. <font face="Courier New">System.Xml.Serialization.XmlAttributeOverrides</font> class
allows you to adorn any XML serializable class with your own XML syntax - element
names, attribute names, namespaces and types.
</p>
        <p>
Remember - you can override them all and <em>still</em> serialize <em>your</em> angle
brackets.<br /></p>
        <br />
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=efa4e231-ddf1-48f4-9a26-54363e799d42" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Bleeding Edge 2008</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,b6565ebe-4d35-4676-a09e-08b84b6554b1.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,b6565ebe-4d35-4676-a09e-08b84b6554b1.aspx</id>
    <published>2008-07-17T15:50:06.688+02:00</published>
    <updated>2008-07-28T19:37:27.603+02:00</updated>
    <category term="Architecture" label="Architecture" scheme="http://www.request-response.com/blog/CategoryView,category,Architecture.aspx" />
    <category term="Conferences" label="Conferences" scheme="http://www.request-response.com/blog/CategoryView,category,Conferences.aspx" />
    <category term="MVP" label="MVP" scheme="http://www.request-response.com/blog/CategoryView,category,MVP.aspx" />
    <category term="Work" label="Work" scheme="http://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm happy to announce <a href="http://blogs.solidq.com/EN/dsarka/Lists/Posts/Post.aspx?ID=119">our</a> organization
work is coming to fruition.
</p>
        <p>
          <a href="http://www.bleedingedge.si">Bleeding Edge 2008</a> is taking the stage for
the autumn season.
</p>
        <p>
          <strong>
            <img src="http://www.request-response.com/blog/content/binary/be2008.jpg" />
            <br />
          </strong>
          <strong>Portorož, Slovenia, October 1<sup>st</sup>, 9:00</strong>
        </p>
        <p>
          <a href="http://www.bleedingedge.si">Official site</a>, <a href="http://www.bleedingedge.si/prijava.html">Registration</a>, <a href="http://www.bleedingedge.si/sponzorji.html">Sponsors</a></p>
        <p>
Go for the early bird registration (till September 12<sup>th</sup>). The time is now.
</p>
        <p>
Potential sponsor? <a href="http://www.bleedingedge.si/sponzorji.html">Here</a>'s
the offering.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=b6565ebe-4d35-4676-a09e-08b84b6554b1" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Accreditus: Gama System eArchive</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0.aspx</id>
    <published>2008-07-05T14:18:06.428+02:00</published>
    <updated>2008-07-07T10:40:20.4687479+02:00</updated>
    <category term=".NET 3.0 - General" label=".NET 3.0 - General" scheme="http://www.request-response.com/blog/CategoryView,category,NET30General.aspx" />
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <category term="Work" label="Work" scheme="http://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Sysinternals Live</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,40794232-f39b-4068-a536-23c5b56a9216.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,40794232-f39b-4068-a536-23c5b56a9216.aspx</id>
    <published>2008-06-19T19:52:52.954+02:00</published>
    <updated>2008-06-19T19:56:17.398+02:00</updated>
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is <strong>brilliant</strong>.
</p>
        <p>
          <a href="http://technet.microsoft.com/en-us/sysinternals">Sysinternals</a> tools are
now (actually were already when I left for vacation) available live via a web (http
and <strong>WebDAV</strong>) based resource on <font face="Courier New"><a href="http://live.sysinternals.com">http://live.sysinternals.com</a></font><font face="Verdana">and </font><font face="Courier New">\\live.sysinternals.com</font>.
</p>
        <p>
This means I can do the following:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <font face="Courier New">[c:\]dir </font>
            <font face="Courier New">\\live.sysinternals.com\tools</font>
          </p>
          <p>
            <font face="Courier New"> Directory of  </font>
            <font face="Courier New">\\live.sysinternals.com\tools\</font>
            <font face="Courier New">*</font>
          </p>
          <p>
            <font face="Courier New"> 2.06.2008   1:16        
&lt;DIR&gt;    .<br />
 2.06.2008   1:16         &lt;DIR&gt;   
..<br />
 2.06.2008   1:16         &lt;DIR&gt;   
WindowsInternals<br />
30.05.2008  17:55            
668  About_This_Site.txt<br />
13.05.2008  19:00         225.320 
accesschk.exe<br />
 1.11.2006  15:06         174.968 
AccessEnum.exe<br />
 1.11.2006  23:05         121.712 
accvio.EXE<br />
12.07.2007   7:26         
50.379  AdExplorer.chm<br />
26.11.2007  14:21         422.952 
ADExplorer.exe<br />
 7.11.2007  11:13         401.616 
ADInsight.chm<br />
20.11.2007  14:25       1.049.640  ADInsight.exe<br />
 1.11.2006  15:05         150.328 
adrestore.exe<br />
 1.11.2006  15:06         154.424 
Autologon.exe<br />
 8.05.2008  10:20         
48.476  autoruns.chm<br />
12.05.2008  17:31         622.632 
autoruns.exe 1.11.2006  <br />
...<br />
 1.11.2006  15:06         207.672 
Winobj.exe<br />
30.12.1999  12:26          
7.653  WINOBJ.HLP<br />
27.05.2008  16:21         142.376 
ZoomIt.exe<br />
     24.185.901 bytes in 103 files and 3 dirs<br />
109.442.727.936 bytes free</font>
          </p>
        </blockquote>
        <p dir="ltr">
Or, I can fire up a Windows Explorer window (or <strong>press the start key</strong>,
then type) and just type: <font face="Courier New">\\live.sysinternals.com\tools</font>.
</p>
        <p dir="ltr">
Or:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p dir="ltr">
            <font face="Courier New">[c:\]copy </font>
            <font face="Courier New">\\live.sysinternals.com\tools\Procmon.exe</font>
            <font face="Courier New">
              <br />
        C:\Windows\System32<br /></font>
            <font face="Courier New">\\live.sysinternals.com\tools\Procmon.exe</font>
            <font face="Courier New"> =&gt; 
<br />
        C:\Windows\System32\Procmon.exe<br />
     1 file copied</font>
          </p>
        </blockquote>
        <p dir="ltr">
Brilliant and useful.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=40794232-f39b-4068-a536-23c5b56a9216" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Demos from the NT Conference 2008</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95.aspx</id>
    <published>2008-05-15T17:24:19.828+02:00</published>
    <updated>2008-05-21T17:08:27.3461229+02:00</updated>
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Transactions" label="Transactions" scheme="http://www.request-response.com/blog/CategoryView,category,Transactions.aspx" />
    <category term="XML" label="XML" scheme="http://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Laws and Digital Signatures</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,f37eda08-845c-4b0a-a66c-ea9cec03c06b.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,f37eda08-845c-4b0a-a66c-ea9cec03c06b.aspx</id>
    <published>2008-04-16T19:32:29.84+02:00</published>
    <updated>2008-04-16T19:55:33.058875+02:00</updated>
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="XML" label="XML" scheme="http://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Suppose we have a document like this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;root xmlns="urn-foo-bar"&gt;<br />
  &lt;subroot&gt;<br />
    &lt;value1&gt;value1&lt;/value1&gt;<br />
    &lt;value2&gt;value2&lt;/value2&gt;<br />
  &lt;/subroot&gt;<br />
  &lt;Signature xmlns="h</font>
          <font face="Courier New">ttp://www.w3.org/2000/09/xmldsig</font>
          <font face="Courier New">#"&gt;<br />
    &lt;SignedInfo&gt;<br />
      &lt;CanonicalizationMethod 
<br />
        Algorithm="</font>
          <font face="Courier New">http://www.w3.org/TR/2001/REC-xml-c14n-20010315</font>
          <font face="Courier New">"
/&gt;<br />
      &lt;SignatureMethod<br />
        Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#rsa-sha1</font>
          <font face="Courier New">"
/&gt;<br />
      &lt;Reference URI=""&gt;<br />
        &lt;Transforms&gt;<br />
          &lt;Transform <br />
            Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/<br />
              xmldsig#enveloped-signature</font>
          <font face="Courier New">"/&gt;<br />
        &lt;/Transforms&gt;<br />
        &lt;DigestMethod<br />
          Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#sha1</font>
          <font face="Courier New">"
/&gt;<br />
        &lt;DigestValue&gt;1Xp...EOko=&lt;/DigestValue&gt;<br />
      &lt;/Reference&gt;<br />
    &lt;/SignedInfo&gt;<br />
    &lt;SignatureValue&gt;nls...cH0k=&lt;/SignatureValue&gt;<br />
    &lt;KeyInfo&gt;<br />
      &lt;KeyValue&gt;<br />
        &lt;RSAKeyValue&gt;<br />
          &lt;Modulus&gt;9f3W...fxG0E=&lt;/Modulus&gt;<br />
          &lt;Exponent&gt;AQAB&lt;/Exponent&gt;<br />
        &lt;/RSAKeyValue&gt;<br />
      &lt;/KeyValue&gt;<br />
      &lt;X509Data&gt;<br />
        &lt;X509Certificate&gt;MIIEi...ktYgN&lt;/X509Certificate&gt;<br />
      &lt;/X509Data&gt;<br />
    &lt;/KeyInfo&gt;<br />
  &lt;/Signature&gt;<br />
&lt;/root&gt;</font>
        </p>
        <p>
This document represents data and an <em>enveloped digital signature</em> over the
complete XML document. The <em>digital signature completeness</em> is defined in the <font face="Courier New">Reference</font> element,
which has <font face="Courier New">URI</font> attribute set to empty string (<font face="Courier New">Reference
Uri=""</font>).
</p>
        <p>
          <strong>Checking the Signature</strong>
        </p>
        <p>
The following should always be applied during signature validation:
</p>
        <ol>
          <li>
Validating the digital signature 
</li>
          <li>
Validating the certificate(s) used to create the signature 
</li>
          <li>
Validating the certificate(s) chain(s)</li>
        </ol>
        <p>
          <strong>
            <em>Note:</em>
          </strong> In most situations this is the optimal validation
sequence. Why? Signatures are broken far more frequently then certificates are revoked/expired.
And certificates are revoked/expired far more frequently then their chains.
</p>
        <p>
          <em>1. Validating the digital signature</em>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
First, get it out of there:
</p>
          <p>
            <font face="Courier New">XmlNamespaceManager xmlns = new XmlNamespaceManager(xdkDocument.NameTable);
[1]<br />
xmlns.AddNamespace("ds", "</font>
            <font face="Courier New">http://www.w3.org/2000/09/xmldsig</font>
            <font face="Courier New">#");<br />
XmlNodeList nodeList = xdkDocument.SelectNodes("//ds:Signature", xmlns);<br /></font> <br /><font size="1">[1] <font face="Courier New">xdkDocument </font>should be an <font face="Courier New">XmlDocument</font> instance
representing your document.</font></p>
          <p>
Second, construct a <font face="Courier New">SignedXml</font> instance:
</p>
          <p>
            <font face="Courier New">foreach (XmlNode xmlNode in nodeList)<br />
{<br />
  // create signed xml object<br />
  SignedXml signedXml = new SignedXml(xdkDocument); [2]</font>
          </p>
          <p>
            <font face="Courier New">  // verify signature<br />
  signedXml.LoadXml((XmlElement)xmlNode);<br />
}</font>
          </p>
          <p>
            <font size="1">[2] Note that we are constructing the <font face="Courier New">SignedXml</font> instance
from a complete document, not only the signature. Read this.</font>
          </p>
          <p>
Third, validate:
</p>
          <p>
            <font face="Courier New">bool booSigValid = signedXml.CheckSignature();</font>
          </p>
          <p>
If <font face="Courier New">booSigValid</font> is <font face="Courier New">true</font>,
proceed.
</p>
        </blockquote>
        <p>
          <em>2. Validating the certificate(s) used to create the signature</em>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
First, get it out of there:
</p>
          <p>
            <font face="Courier New">XmlNode xndCert = xmlNode.SelectSingleNode(".//ds:X509Certificate",
xmlns); [3]</font>
          </p>
          <p>
            <font size="1">[3] There can be multiple <font face="Courier New">X509Certificate</font> elements
qualified with <font face="Courier New">h</font></font>
            <font face="Courier New" size="1">ttp://www.w3.org/2000/09/xmldsig</font>
            <font size="1">
              <font face="Courier New">#</font> namespace
in there. Xml Digital Signature specification is allowing the serialization of a complete
certificate chain of the certificate used to sign the document. Normally, the signing
certificate should be the first to be serialized.</font>
          </p>
          <p>
Second, get the <font face="Courier New">X509Certificate2</font> instance:
</p>
          <p>
            <font face="Courier New">byte[] bytCert = Convert.FromBase64String(xndCert.InnerText);<br />
X509Certificate2 x509cert = new X509Certificate2(bytCert);</font>
          </p>
          <p>
Third, validate:
</p>
          <p>
            <font face="Courier New">bool booCertValid = x509cert.Verify();</font>
          </p>
          <p>
If <font face="Courier New">booCertValid</font> is <font face="Courier New">true</font>,
proceed.
</p>
        </blockquote>
        <p>
          <em>3. Validating the certificate(s) chain(s)</em>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
Building and validating the chain:
</p>
          <p>
            <font face="Courier New">X509Chain certChain = new X509Chain();<br />
bool booChainValid = certChain.Build(x509cert);<br />
int intChainLength = certChain.ChainElements.Count; [4]</font>
          </p>
          <p>
If <font face="Courier New">booChainValid</font> is <font face="Courier New">true</font>,
your signature is <strong>valid</strong>.
</p>
        </blockquote>
        <p dir="ltr">
          <strong>Some Rules and Some Laws</strong>
        </p>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
We have three booleans:
</p>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
        </p>
        <ul>
          <li>
            <font face="Courier New">booSigValid</font> - signature validity 
</li>
          <li>
            <font face="Courier New">booCertValid</font> - certificate validity 
</li>
          <li>
            <font face="Courier New">booChainValid</font> - certificate's chain validity</li>
        </ul>
        <p>
        </p>
        <p>
If <font face="Courier New">booSigValid</font> evaluates to <font face="Courier New">false</font>,
there is no discussion. Someone <strong>changed the document</strong>.
</p>
        <p>
What happens if one of the following two expressions evaluates to <font face="Courier New">true</font>:
</p>
        <p>
1. <font face="Courier New">((booSigValid) &amp;&amp; (!booCertValid) &amp;&amp; (!booChainValid))<br /></font>2. <font face="Courier New">((booSigValid) &amp;&amp; (booCertValid) &amp;&amp;
(!booChainValid))</font></p>
        <p>
This normally means that either the certificate is not valid (CRLed or expired) [4],
or one of the chain's certificate is not valid/expired.
</p>
        <p>
          <font size="1">[4] The premise is that one checked the signature according to 1, 2,
3 schema described above.</font>
        </p>
        <p>
          <strong>The Question</strong>
        </p>
        <p>
Is digital signature valid even if CA revoked the certificate after the
signature has already been done? Is it valid even after the certificate expires? If
signature is valid and certificate has been revoked, what is the legal validity of
the signature?
</p>
        <p>
In legal terms, the signature would be <strong>invalid</strong> on both upper assertions,
1 and 2. 
</p>
        <p>
This means, that once the generator of the signature is dead, or one of his predecessors
is dead, all his children die too.
</p>
        <p>
          <strong>Timestamps to the Rescue</strong>
        </p>
        <p>
According to most country's digital signature laws the signature is valid only during
the validity of the signing certificate and validity of the signing certificate's
chain, both being checked for revocation and expiry date ... if you don't timestamp
it.
</p>
        <p>
If the source document has <em>another signature</em> from a trusted authority, and
that authority is a timestamp authority, it would look like this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;root xmlns="urn-foo-bar"&gt;<br />
  &lt;subroot&gt;<br />
    &lt;value1&gt;value1&lt;/value1&gt;<br />
    &lt;value2&gt;value2&lt;/value2&gt;<br />
  &lt;/subroot&gt;<br />
  &lt;Signature xmlns="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig</font>
          <font face="Courier New">#"&gt;<br />
    ...<br />
  &lt;/Signature&gt;<br />
  &lt;dsig:Signature Id="TimeStampToken"<br />
    </font>
          <font face="Courier New">xmlns:dsig="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig</font>
          <font face="Courier New">#"&gt;<br />
    &lt;dsig:SignedInfo&gt;<br />
      &lt;dsig:CanonicalizationMethod<br />
        Algorithm="</font>
          <font face="Courier New">http://www.w3.org/TR/2001/REC-xml-c14n-20010315</font>
          <font face="Courier New">"
/&gt;<br />
      &lt;dsig:SignatureMethod<br />
        Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#rsa-sha1"</font>
          <font face="Courier New"> /&gt;<br />
      &lt;dsig:Reference<br />
        URI="#TimeStampInfo-113D2EEB158BBB2D7CC000000000004DF65"&gt;<br />
        &lt;dsig:DigestMethod<br />
          Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#sha1"</font>
          <font face="Courier New"> /&gt;<br />
          &lt;dsig:DigestValue&gt;y+xw...scKg=&lt;/dsig:DigestValue&gt;<br />
      &lt;/dsig:Reference&gt;<br />
      &lt;dsig:Reference URI="#TimeStampAuthority"&gt;<br />
        &lt;dsig:DigestMethod<br />
          Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#sha1"</font>
          <font face="Courier New"> /&gt;<br />
        &lt;dsig:DigestValue&gt;KhFIr...Sv4=&lt;/dsig:DigestValue&gt;<br />
      &lt;dsig:/Reference&gt;<br />
    &lt;/dsig:SignedInfo&gt;<br />
    &lt;dsig:SignatureValue&gt;R4m...k3aQ==&lt;/dsig:SignatureValue&gt;<br />
    &lt;dsig:KeyInfo Id="TimeStampAuthority"&gt;<br />
      &lt;dsig:X509Data&gt;<br />
        &lt;dsig:X509Certificate&gt;MII...Osmg==&lt;/dsig:X509Certificate&gt;<br />
      &lt;/dsig:X509Data&gt;<br />
    &lt;/dsig:KeyInfo&gt;<br />
    &lt;dsig:Object<br />
      Id="TimeStampInfo-113D2EEB158BBB2D7CC000000000004DF65"&gt;<br />
      &lt;ts:TimeStampInfo<br />
         xmlns:ts="</font>
          <font face="Courier New">http://www.provider.com/schemas<font color="#003300"><br />
           </font>/timestamp-protocol-20020207</font>
          <font face="Courier New">"<br />
         xmlns:ds="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig</font>
          <font face="Courier New">#"&gt;<br />
        &lt;ts:Policy id="</font>
          <font face="Courier New">http://provider.tsa.com/documents"</font>
          <font face="Courier New"> /&gt;<br />
          &lt;ts:Digest&gt;<br />
            &lt;ds:DigestMethod
Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/<br />
              09/xmldsig#sha1"</font>
          <font face="Courier New"> /&gt;<br />
            &lt;ds:DigestValue&gt;V7+bH...Kmsec=&lt;/ds:DigestValue&gt;<br />
          &lt;/ts:Digest&gt;<br />
          &lt;ts:SerialNumber&gt;938...045&lt;/ts:SerialNumber&gt;<br />
          &lt;ts:CreationTime&gt;2008-04-13T11:31:42.004Z&lt;/ts:CreationTime&gt;<br />
          &lt;ts:Nonce&gt;121...780&lt;/ts:Nonce&gt;<br />
      &lt;/ts:TimeStampInfo&gt;<br />
    &lt;/dsig:Object&gt;<br />
  &lt;/dsig:Signature&gt;<br />
&lt;/root&gt;</font>
        </p>
        <p>
The second signature would be performed by an out-of-band authority, normally a <strong>TSA
authority</strong>. It would only sign a <em>hash value</em> (in this case SHA1 hash)
which was constructed by hashing the original document and the included digital signature.
</p>
        <p>
This (second) signature should be checked using the same 1, 2, 3 steps. For the purpose
of this mind experiment, let's say it would generate a <font face="Courier New">booTimestampValid</font> boolean.
</p>
        <p>
Now, let's reexamine the booleans:
</p>
        <ol>
          <li>
            <font face="Courier New">((booSigValid) &amp;&amp; (!booCertValid) &amp;&amp; (!booChainValid)
&amp;&amp; (booTimestampValid))</font>
          </li>
          <li>
            <font face="Courier New">((booSigValid) &amp;&amp; (booCertValid) &amp;&amp; (!booChainValid)
&amp;&amp; (booTimestampValid))</font>
          </li>
        </ol>
        <p>
In this case, <em>even though the signature's certificate (or its chain) is invalid,
the signature would pass legal validity</em> if the timesamp's signature is valid,
together with its certificate and certificate chain. Note that the TSA signature is
generated with a different set of keys than the original digital signature.
</p>
        <p>
Actually <font face="Courier New">booTimestampValid</font> is defined as <font face="Courier New">((booSigValid)
&amp;&amp; (booCertValid) &amp;&amp; (booChainValid))</font> for the timestamp signature/certificate/certificate
chain [5].
</p>
        <p>
          <font size="1">[5] Legal validity is guaranteed only in cases where 1 or 2 are true.</font>
        </p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=f37eda08-845c-4b0a-a66c-ea9cec03c06b" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WCF: Reliable Messaging and Retry Timeouts</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx</id>
    <published>2008-04-09T00:33:13.159+02:00</published>
    <updated>2008-04-16T17:20:00.887+02:00</updated>
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=a510f1dc-23bb-42aa-b683-a70c4740bfe5" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Calculating Outsourcing Project Cost</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,fff35773-9d2b-4ffc-9795-4e2b62fc61a4.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,fff35773-9d2b-4ffc-9795-4e2b62fc61a4.aspx</id>
    <published>2008-02-18T23:01:39.53125+01:00</published>
    <updated>2008-02-18T23:01:39.53125+01:00</updated>
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Wow, <a href="http://www.stephenforte.net/PermaLink,guid,48917fe9-ab8a-4d98-8d49-c70cb53a82ef.aspx">Stephen</a>. 
</p>
        <p>
This is one of the best ideas I've heard of hedging against the dollar in terms if
IT outsourcing cost. And I mean it.
</p>
        <p>
I'm not in a position of valueing the description made, but I am willing to take the
pill, no matter what.
</p>
        <p>
What everybody needs is only to get to one million sterling project,
taking half a year. 
</p>
        <p>
That's it, hedging done or not.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=fff35773-9d2b-4ffc-9795-4e2b62fc61a4" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Happy Birthday XML</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,b8fa5b93-1d54-4cdb-a353-5febb4232890.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,b8fa5b93-1d54-4cdb-a353-5febb4232890.aspx</id>
    <published>2008-02-13T20:36:09.046875+01:00</published>
    <updated>2008-02-13T20:36:09.046875+01:00</updated>
    <category term="XML" label="XML" scheme="http://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This week XML is <a href="http://www.tbray.org/ongoing/When/200x/2008/02/10/XML-People">ten
years old</a>. The core XML 1.0 specification was released in February 1998. 
</p>
        <p>
It's a nice anniversary to have.
</p>
        <p>
The XML + Namespaces specification has a built in namespace declaration of <font face="Courier New">http://www.w3.org/XML/1998/namespace</font>.
That's an implicit namespace declaration, a special one, governing all other. One
namespace declaration to rule them all. Bound to <font face="Courier New"><a href="http://www.w3.org/XML/1998/namespace">xml:</a></font> prefix.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/originalxmlnamespace.jpg" />
        </p>
        <p>
XML was born and published as a W3C Recommendation on 10<sup>th</sup> of February
1998.
</p>
        <p>
So, well done XML. You did <strong>a lot</strong> for IT industry in the past decade.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=b8fa5b93-1d54-4cdb-a353-5febb4232890" />
      </div>
    </content>
  </entry>
  <entry>
    <title>European Silverlight Challenge</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,3990a494-ac6f-4314-978b-39a459c36759.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,3990a494-ac6f-4314-978b-39a459c36759.aspx</id>
    <published>2008-01-04T10:33:22.60225+01:00</published>
    <updated>2008-01-04T10:33:22.60225+01:00</updated>
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://www.request-response.com/blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you're into <a href="http://silverlight.net/Default.aspx">Silverlight</a>, and
you should be, check out <a href="http://www.silverlightchallenge.eu">http://www.silverlightchallenge.eu</a>,
and especially sign up on <a href="http://slovenia.silverlightchallenge.eu">http://slovenia.silverlightchallenge.eu</a> and
join one of our many developers who will participate in this competition.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/silverlightchallenge2008.jpg" />
        </p>
        <p>
More <a href="http://www.slodug.si/blogs/system/archive/2007/12/20/1.-evropski-nate_0D01_aj-Silverlight.aspx">here</a>.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=3990a494-ac6f-4314-978b-39a459c36759" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Mr. Larry Lessig</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,3b183ab0-9506-470b-807a-e9f39a40aa12.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,3b183ab0-9506-470b-807a-e9f39a40aa12.aspx</id>
    <published>2007-11-09T23:59:24.083+01:00</published>
    <updated>2007-11-09T23:59:24.083+01:00</updated>
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Mr. <a href="http://www.lessig.org/blog/">Lawrence Lessig</a> is a founder of <a href="http://cyberlaw.stanford.edu/">Stanford
Center for Internet and Society</a>. He's also a chairman for the <a href="http://creativecommons.org/">Creative
Commons</a> organization.
</p>
        <p>
Lessig is one of the most effective speakers in the world, a professor at
Stanford, who tries to make this world a better place from a standpoint of stupidity
in terms of the copyright law.
</p>
        <p>
The following is published on the <a href="http://creativecommons.org/">CC</a>'s site:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>We use <strong>private rights</strong> to create <strong>public goods</strong>:
creative works set free for certain uses. ... We work to offer creators a best-of-both-worlds
way to protect their works while encouraging certain uses of them — to declare <strong>“some
rights reserved.”</strong></em>
          </p>
        </blockquote>
        <p>
Therefore Creative Commons stands for the mantra of <em>some rights reserved</em> and
not <em>all rights reserved</em> in terms of meaningful usage of digital technology.
</p>
        <p>
Being a <a href="http://en.wikipedia.org/wiki/Libertarianism">libertarian</a> myself,
I cannot oppose these stands. <em>Balance</em> and <em>compromise </em>are good things for
content and intellectual products, such as software.
</p>
        <p>
Watch <a href="http://www.ted.com/index.php/talks/view/id/187">his masterpiece</a>,
delivered at <a href="http://www.ted.com">TED</a>.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=3b183ab0-9506-470b-807a-e9f39a40aa12" />
      </div>
    </content>
  </entry>
  <entry>
    <title>On Instance and Static Method Signatures</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,634a58b1-13e5-4b7a-b2ac-010965235bcb.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,634a58b1-13e5-4b7a-b2ac-010965235bcb.aspx</id>
    <published>2007-11-03T22:04:38.531+01:00</published>
    <updated>2007-11-04T09:03:14.390625+01:00</updated>
    <category term="CLR" label="CLR" scheme="http://www.request-response.com/blog/CategoryView,category,CLR.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
We talked today, with <a href="http://cs.rthand.com/blogs/blog_with_righthand/">Miha</a>,
a C# <a href="http://en.wikipedia.org/wiki/Yoda">Yoda</a>. Via IM, everything seemed
pointless. Couldn't find a good case for the cause of the following mind experiment:
</p>
        <p>
          <font face="Courier New">using System;<br />
class Tubo<br />
{<br />
  public static void Test() {}<br />
  private void Test() {} <br />
}<br /></font>
          <font size="1">
            <br />
Note: I'm using Miha's syntax in this post.</font>
        </p>
        <p>
We have a <strong>static method</strong> called <font face="Courier New">Test</font> and
an <strong>instance method</strong>, also called <font face="Courier New">Test</font>.
Parameter models of both methods are the same, <em>empty</em>.
</p>
        <p>
Would this compile?
</p>
        <p>
          <em>It does not.</em>
        </p>
        <p>
The question is why and who/what causes this. There is actually <strong>no rationale </strong>behind
not allowing this thing to compile since both, the compiler and the runtime know the
method info upfront.
</p>
        <p>
Since the runtime has all the information it needs, it is strange that this would
not be allowed at compile time. However, a (C#) compiler has to determine whether
you, <strong>the programmer </strong>meant to access a <em>static</em> or an <em>instance</em> method.
</p>
        <p>
          <em>Here lie the dragons.</em>
        </p>
        <p>
It is illegal in most virtual machine based languages to have the same method name
and signature for a static/instance method.
</p>
        <p>
The following is an excerpt from a <a href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.2">Java
specification</a>:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>8.4.2 Method Signature</em>
          </p>
        </blockquote>
        <blockquote>
          <p>
            <em>Two methods have the <strong>same signature</strong> if they have the same name
and argument types.</em>
          </p>
          <p>
            <em>Two method or constructor declarations M and N have the same argument types if
all of the following conditions hold: </em>
          </p>
          <p>
            <em>
            </em>
          </p>
          <ul>
            <a name="299803">
            </a>
            <li>
              <em>They have the same number of formal parameters (possibly zero) </em>
              <a name="299804">
              </a>
            </li>
            <li>
              <em>They have the same number of type parameters (possibly zero) </em>
              <a name="324473">
              </a>
            </li>
            <li>
              <em>Let &lt;A<sub>1</sub>,...,A<sub>n</sub>&gt; be the formal type parameters of M
and let &lt;B<sub>1</sub>,...,B<sub>n</sub>&gt; be the formal type parameters of N.
After renaming each occurrence of a B<sub>i</sub> in N's type to A<sub>i</sub> the
bounds of corresponding type variables and the argument types of M and N are the same. </em>
            </li>
          </ul>
        </blockquote>
        <p>
Java (and also C#) does not allow two methods with the same name and parameter model
no matter what the access modifier is (public, private, internal, protected ...) and
whether the method is static or instance based.
</p>
        <p>
          <em>Why?</em>
        </p>
        <p>
Simple. <strong>Programmer ambiguity.</strong> There is no technical reason not to
allow it.
</p>
        <p>
Consider the following:
</p>
        <p>
          <font face="Courier New">using System;<br />
class Tubo<br />
{ 
<br />
  public static void Test(); 
<br />
  private void Test(); 
<br />
  public void AmbiguousCaller() { Test(); } 
<br />
}</font>
        </p>
        <p>
What would method <font face="Courier New">AmbiguousCaller</font> call? A static <font face="Courier New">Test</font> or
instance <font face="Courier New">Test</font> method? 
</p>
        <p>
          <em>Can't decide? </em>
        </p>
        <p>
That's why this is not allowed. 
</p>
        <p>
And yes, it would call the instance method if this would be allowed, since statics
in C# <em>should</em> be called using a class name, as in <font face="Courier New">Test.Test()</font>.
Note that the preceding example <em>does not compile</em>. Also note, that
it <em>is legal</em> to have a <font face="Courier New">AmbiguousCaller</font> body
as <font face="Courier New">Test()</font> or <font face="Courier New">Tubo.Test()</font>.
</p>
        <p>
There is another ambiguous reason. Local variables in C# <strong>cannot</strong> be
named <em>the same as the enclosing class</em>. Therefore, this is illegal:
</p>
        <p>
          <font face="Courier New">using System;<br />
class Tubo<br />
{<br />
  private int Tubo;<br />
}</font>
        </p>
        <p>
It is. Do a <font face="Courier New">csc /t:library</font> on it.
</p>
        <p>
Since you confirmed this fact, consider the following:
</p>
        <p>
          <font face="Courier New">using System;<br />
public class Tubo<br />
{ 
<br />
  public static void StaticMethod() {} 
<br />
  public void InstanceMethod() {} 
<br />
}</font>
        </p>
        <p>
          <font face="Courier New">public class RunMe<br />
{<br />
  public static void Main()<br />
  { 
<br />
    Tubo Tubo = new Tubo();<br />
    Tubo.InstanceMethod();<br />
    Tubo.StaticMethod();<br />
  }<br />
}</font>
        </p>
        <p>
Focus on the <font face="Courier New">Main</font> method <em>body</em>. In <font face="Courier New">Tubo.InstanceMethod()</font> an
instance method is called and a reference (namely <font face="Courier New">Tubo</font>)
is used. In <font face="Courier New">Tubo.StaticMethod()</font> a static method is
called and <font face="Courier New">Tubo</font> is not an instance reference, but
class name.
</p>
        <p>
It all comes down to <em>programmer ambiguity</em>. Given a chance, I would support
this design decision too.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=634a58b1-13e5-4b7a-b2ac-010965235bcb" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WCF: Passing Collections Through Service Boundaries, Why and How</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx</id>
    <published>2007-09-27T23:04:47.328+02:00</published>
    <updated>2007-09-27T23:28:02.546875+02:00</updated>
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Web Services" label="Web Services" scheme="http://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=ff5fab81-affb-4b2b-aa67-c80bdfc86cbd" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Approaches to Document Style Parameter Models</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx</id>
    <published>2007-09-24T12:19:10.09375+02:00</published>
    <updated>2007-09-24T12:19:10.09375+02:00</updated>
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Architecture" label="Architecture" scheme="http://www.request-response.com/blog/CategoryView,category,Architecture.aspx" />
    <category term="Web Services" label="Web Services" scheme="http://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <category term="XML" label="XML" scheme="http://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=ab874bc2-1546-48d1-a8aa-46f0bf876d93" />
      </div>
    </content>
  </entry>
  <entry>
    <title>XmlSerializer, Ambient XML Namespaces and Digital Signatures</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx</id>
    <published>2007-09-19T22:57:57.468+02:00</published>
    <updated>2007-09-20T09:57:43.3125+02:00</updated>
    <category term="CLR" label="CLR" scheme="http://www.request-response.com/blog/CategoryView,category,CLR.aspx" />
    <category term="XML" label="XML" scheme="http://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you use <font face="Courier New">XmlSerializer</font> type to perform serialization
of documents which are digitally signed later on, you should be <strong>careful</strong>.
</p>
        <p>
XML namespaces which are included in the serialized form could cause trouble for anyone
signing the document after serialization, especially in the case of normalized signature
checks.
</p>
        <p>
Let's go step by step.
</p>
        <p>
Suppose we have this simple schema, let's call it <font face="Courier New">problem.xsd</font>:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;xs:schema targetNamespace="</font>
          <font face="Courier New">http://www.gama-system.com/problems.xsd</font>
          <font face="Courier New">" 
<br />
           elementFormDefault="qualified"<br />
           xmlns="</font>
          <font face="Courier New">http://www.gama-system.com/problems.xsd</font>
          <font face="Courier New">"<br />
           xmlns:xs="</font>
          <font face="Courier New">http://www.w3.org/2001/XMLSchema</font>
          <font face="Courier New">"&gt;<br />
  &lt;xs:element name="Problem" type="ProblemType"/&gt;<br />
  &lt;xs:complexType name="<font color="#a52a2a">ProblemType</font>"&gt;<br />
    &lt;xs:sequence&gt;<br />
      &lt;xs:element name="Name" type="xs:string" /&gt;<br />
      &lt;xs:element name="Severity" type="xs:int" /&gt;<br />
      &lt;xs:element name="Definition" type="DefinitionType"/&gt;<br />
      &lt;xs:element name="Description" type="xs:string"
/&gt;<br />
    &lt;/xs:sequence&gt;<br />
  &lt;/xs:complexType&gt;<br />
  &lt;xs:complexType name="<font color="#a52a2a">DefinitionType</font>"&gt;<br />
    &lt;xs:simpleContent&gt;<br />
      &lt;xs:extension base="xs:base64Binary"&gt;<br />
        &lt;xs:attribute name="Id" type="GUIDType"
use="required"/&gt;<br />
      &lt;/xs:extension&gt;<br />
    &lt;/xs:simpleContent&gt;<br />
  &lt;/xs:complexType&gt;<br />
  &lt;xs:simpleType name="<font color="#a52a2a">GUIDType</font>"&gt;<br />
    &lt;xs:restriction base="xs:string"&gt;<br />
      &lt;xs:pattern value="Id-[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-<br />
                        
[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"/&gt;<br />
    &lt;/xs:restriction&gt;<br />
  &lt;/xs:simpleType&gt;<br />
&lt;/xs:schema&gt;</font>
        </p>
        <p>
This schema describes <em>a problem</em>, which is defined by a <strong>name</strong> (typed
as <font face="Courier New">string</font>), <strong>severity</strong> (typed as <font face="Courier New">integer</font>), <strong>definition</strong> (typed
as <font face="Courier New">byte array</font>) and <strong>description</strong> (typed
as <font face="Courier New">string</font>). The schema also says that the definition
of a problem has an <font face="Courier New">Id</font> attribute, which we will use
when digitally signing a specific problem definition. This <font face="Courier New">Id</font> attribute
is defined as GUID, as the simple type <font face="Courier New">GUIDType</font> defines.
</p>
        <p>
Instance documents validating against this schema would look like this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem xmlns="</font>
          <font face="Courier New">http://www.gama-system.com/problems.xsd</font>
          <font face="Courier New">"&gt;<br />
  &lt;Name&gt;Specific problem&lt;/Name&gt;<br />
  &lt;Severity&gt;4&lt;/Severity&gt;<br />
  &lt;Definition Id="c31dd112-dd42-41da-c11d-33ff7d2112s2"&gt;MD1sDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;This is a specific problem.&lt;/Description&gt;<br />
&lt;/Problem&gt;</font>
        </p>
        <p>
Or this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem xmlns="http://www.gama-system.com/problems.xsd"&gt;<br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br />
&lt;/Problem&gt;</font>
        </p>
        <p>
Mark this one as <strong>exhibit A</strong>.
</p>
        <p>
Only a few of you out there are still generating XML documents by hand, since there
exists a notion of schema compilers. In the .NET Framework world, there is <font face="Courier New">xsd.exe</font>,
which bridges the gap between the XML type system and the CLR type system.
</p>
        <p>
          <font face="Courier New">xsd.exe /c problem.xsd</font>
        </p>
        <p>
The tool compiles <font face="Courier New">problem.xsd</font> schema into the CLR
type system. This allows you to use in-schema defined classes and serialize them later
on with the <font face="Courier New">XmlSerializer</font> class. The second instance
document (exhibit A) serialization program would look like this:
</p>
        <p>
          <font face="Courier New">// generate problem<br />
ProblemType problem = new ProblemType();<br />
problem.Name = "XML DigSig Problem";<br />
problem.Severity = 5;<br />
DefinitionType dt = new DefinitionType();<br />
dt.Id = Guid.NewGuid().ToString();<br />
dt.Value = new byte[] { 0xa, 0xb, 0xc, 0xd, 0xf };<br />
problem.Definition = dt;<br />
problem.Description = "Ambient namespaces break digsigs.";</font>
        </p>
        <p>
          <font face="Courier New">// serialize problem<br />
XmlSerializer ser = new XmlSerializer(typeof(ProblemType));<br />
FileStream stream = new FileStream("Problem.xml", FileMode.Create, FileAccess.Write);<br />
ser.Serialize(stream, problem);<br />
stream.Close();<br /></font>            
<br />
Here <strong>lie </strong>the dragons.
</p>
        <p>
          <font face="Courier New">XmlSerializer</font> class default serialization mechanism
would output this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem <font color="#a52a2a">xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</font><br />
         <font color="#a52a2a">xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br /></font><font color="#000000">         xmlns="http://www.gama-system.com/problems.xsd"&gt;</font><br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br />
&lt;/Problem&gt;</font>
        </p>
        <p>
Mark this one as <strong>exhibit B</strong>.
</p>
        <p>
If you look closely, you will notice two additional prefix namespace declarations
in exhibit B bound to <font face="Courier New">xsi</font> and <font face="Courier New">xsd</font> prefixes,
against exhibit A.
</p>
        <p>
The fact is, that both documents (exhibit B, and exhibit A) are valid against the <font face="Courier New">problem.xsd</font> schema.
</p>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
          <font face="Courier New">&lt;theory&gt;</font>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p dir="ltr" style="MARGIN-RIGHT: 0px">
Prefixed namespaces are part of the <a href="http://www.w3.org/TR/xml-infoset/">XML
Infoset</a>. All XML processing is done on XML Infoset level. Since only declarations
(look at prefixes <font face="Courier New">xsi</font> and <font face="Courier New">xsd</font>)
are made in exhibit B, the document itself is not semantically different from exhibit
A. That stated, instance documents are equivalent and should validate against the
same schema.
</p>
        </blockquote>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
          <font face="Courier New">&lt;/theory&gt;</font>
        </p>
        <p>
What happens if we sign the <font face="Courier New">Definition</font> element of
exhibit B (<font face="Courier New">XmlSerializer</font> generated, prefixed namespaces
present)?
</p>
        <p>
We get this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem <font color="#a52a2a">xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</font><br />
         <font color="#a52a2a">xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br /></font><font color="#000000">         xmlns="http://www.gama-system.com/problems.xsd"&gt;</font><br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition <font color="#a52a2a"><strong>Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"</strong></font>&gt;CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br /><font color="#000000"><strong>  &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;<br />
    &lt;SignedInfo&gt;<br />
      &lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/...20010315"
/&gt;<br />
      &lt;SignatureMethod Algorithm="http://www.w3.org/...rsa-sha1"
/&gt;<br />
      &lt;Reference <font color="#a52a2a">URI="#Id-b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;</font><br />
        &lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"
/&gt;<br />
        &lt;DigestValue&gt;k3gbdFVJEpv4LWJAvvHUZZo/VUQ=&lt;/DigestValue&gt;<br />
      &lt;/Reference&gt;<br />
    &lt;/SignedInfo&gt;<br />
    &lt;SignatureValue&gt;K8f...p14=&lt;/SignatureValue&gt;<br />
    &lt;KeyInfo&gt;<br />
      &lt;KeyValue&gt;<br />
        &lt;RSAKeyValue&gt;<br />
          &lt;Modulus&gt;eVs...rL4=&lt;/Modulus&gt;<br />
          &lt;Exponent&gt;AQAB&lt;/Exponent&gt;<br />
        &lt;/RSAKeyValue&gt;<br />
      &lt;/KeyValue&gt;<br />
      &lt;X509Data&gt;<br />
        &lt;X509Certificate&gt;MIIF...Bw==&lt;/X509Certificate&gt;<br />
      &lt;/X509Data&gt;<br />
    &lt;/KeyInfo&gt;<br />
  &lt;/Signature&gt;</strong><br /></font>&lt;/Problem&gt;</font>
        </p>
        <p>
Let's call this document <strong>exhibit D</strong>.
</p>
        <p>
This document is the same as exhibit B, but has the <font face="Courier New">Definition</font> element
digitally signed. Note the <font face="Courier New">/Problem/Signature/SingedInfo/Reference[@URI]</font> value.
Digital signature is performed only on the <font face="Courier New">Definition</font> element
and not the complete document.
</p>
        <p>
Now, if one would validate the same document without the prefixed namespace declarations,
as in:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem xmlns="http://www.gama-system.com/problems.xsd"&gt;<br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition <strong>Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;</strong>CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br /><strong>  &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;<br />
    ...<br />
  &lt;/Signature&gt;</strong><br />
&lt;/Problem&gt;</font>
        </p>
        <p>
... the signature verification <strong>would fail</strong>. Let's call this document <strong>exhibit
C</strong>.
</p>
        <p>
          <font face="Courier New">&lt;theory&gt;</font>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
As said earlier, all XML processing is done on the XML Infoset level. Since ambient
prefixed namespace declarations are visible in all child elements of the declaring
element, exhibits C and D are different. Explicitly, element contexts are different
for element <font face="Courier New">Definition</font>, since exhibit C does not have
ambient declarations present and exhibit D does. The signature verification <strong>fails</strong>.
</p>
        </blockquote>
        <p>
          <font face="Courier New">&lt;/theory&gt;</font>
        </p>
        <p>
Solution?
</p>
        <p>
Much simpler than what's written above. Force <font face="Courier New">XmlSerializer</font> class
to serialize what should be serialized in the first place. We need to declare the
namespace definition of the serialized document and prevent <font face="Courier New">XmlSerializer</font> to
be too smart. The .NET Framework serialization mechanism contains a <font face="Courier New">XmlSerializerNamespaces</font> class
which can be specified during serialization process.
</p>
        <p>
Since we know the only (and by the way, default) namespace of the serialized document,
this makes things work out OK:
</p>
        <p>
          <font face="Courier New">// generate problem<br />
ProblemType problem = new ProblemType();<br />
problem.Name = "XML DigSig Problem";<br />
problem.Severity = 5;<br />
DefinitionType dt = new DefinitionType();<br />
dt.Id = Guid.NewGuid().ToString();<br />
dt.Value = new byte[] { 0xa, 0xb, 0xc, 0xd, 0xf };<br />
problem.Definition = dt;<br />
problem.Description = "Ambient namespaces break digsigs.";</font>
        </p>
        <p>
          <font face="Courier New">// serialize problem<br /><strong><font color="#a52a2a">XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();<br />
xsn.Add(String.Empty, "http://www.gama-system.com/problem.xsd");</font></strong></font>
        </p>
        <p>
          <font face="Courier New">XmlSerializer ser = new XmlSerializer(typeof(ProblemType));<br />
FileStream stream = new FileStream("Problem.xml", FileMode.Create, FileAccess.Write);<br />
ser.Serialize(stream, problem, <strong><font color="#a52a2a">xsn</font></strong>);<br />
stream.Close();</font>
        </p>
        <p>
This will force <font face="Courier New">XmlSerializer</font> to produce a valid document
- with valid XML element contexts, without any ambient namespaces.
</p>
        <p>
The question is, why does <font face="Courier New">XmlSerialzer</font> produce this
namespaces by default? That should be a topic for another post.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=26149053-63bc-495e-bab0-8d14e7e46190" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Oh my God: 1.1</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,d66f26c7-eb42-46f7-bd99-29b9a1062c9c.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,d66f26c7-eb42-46f7-bd99-29b9a1062c9c.aspx</id>
    <published>2007-08-29T18:40:16.15625+02:00</published>
    <updated>2007-08-29T18:40:16.15625+02:00</updated>
    <category term="Apple" label="Apple" scheme="http://www.request-response.com/blog/CategoryView,category,Apple.aspx" />
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Shame? Nokia?
</p>
        <p>
Same sentence, as in <a href="http://www.engadget.com/2007/08/29/nokias-iphone-no-seriously/">Shame and
Nokia</a>?
</p>
        <p>
There is just no pride in IT anymore. Backbones are long gone too.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=d66f26c7-eb42-46f7-bd99-29b9a1062c9c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Oh my God: 1.0</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,b01fbfe1-6db1-45ad-bf57-0c4dce869053.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,b01fbfe1-6db1-45ad-bf57-0c4dce869053.aspx</id>
    <published>2007-08-29T18:35:38.90625+02:00</published>
    <updated>2007-08-29T18:35:38.90625+02:00</updated>
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This <a href="http://vidmar.net/weblog/archive/2007/08/29/what-you-dont-want-to-see-when-you-open-your.aspx">post</a> puts
shame to a new level.
</p>
        <p>
There is no excuse for having Microsoft Access database serving <strong>any </strong>kind
of content in an online banking solution.
</p>
        <p>
The funny thing is, that even the comment excuses seem fragile. They obviously just
don't get it. The bank should not defend their position, but focus on changing it
immediately.
</p>
        <p>
So, they should fix this ASAP, then fire PR, then apologize.
</p>
        <p>
Well-done David, for exposing what should never reach a production environment. 
</p>
        <p>
Never. Ever.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=b01fbfe1-6db1-45ad-bf57-0c4dce869053" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Apple vs. Dell</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,3bda30c6-654b-4d98-8788-d2eeeafe4943.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,3bda30c6-654b-4d98-8788-d2eeeafe4943.aspx</id>
    <published>2007-08-08T20:37:18.97+02:00</published>
    <updated>2007-08-08T20:40:54.627+02:00</updated>
    <category term="Apple" label="Apple" scheme="http://www.request-response.com/blog/CategoryView,category,Apple.aspx" />
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is why one should buy best of both worlds. Mac <strong>rules</strong> on a client.
Dell is quite competitive on the (home) server market.
</p>
        <p>
We don't care about cables around servers. Yet.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/applevsdell.jpg" />
        </p>
        <p>
So? <a href="http://www.apple.com/imac">'nuff said</a>.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=3bda30c6-654b-4d98-8788-d2eeeafe4943" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Windows Vista Performance and Reliability Updates</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,3bb7bfca-61a4-40de-863f-5e8114cd8f9f.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,3bb7bfca-61a4-40de-863f-5e8114cd8f9f.aspx</id>
    <published>2007-08-08T08:13:20.455+02:00</published>
    <updated>2007-08-08T08:22:14.97075+02:00</updated>
    <category term="Windows Vista" label="Windows Vista" scheme="http://www.request-response.com/blog/CategoryView,category,WindowsVista.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
These have been brewing for a couple of months. They're out today.
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
            <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
              <p>
                <img src="http://www.request-response.com/blog/images/vista_logo_small_fixed.jpg" />
              </p>
            </blockquote>
          </blockquote>
        </blockquote>
        <p>
They contain a number of patches that <strike>improve</strike> fix Vista. You
can get them here:
</p>
        <p>
          <a href="http://support.microsoft.com/?kbid=938979" target="_blank">Windows Vista
Performance Update</a>:
</p>
        <ul>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=3FB80BB9-D832-425B-B42C-D3EB2071BBEC" target="_blank">x86
Download</a>
          </li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=24EAD3A0-77F6-4196-8A3F-78C1470AC18E" target="_blank">x64
Download</a>
          </li>
        </ul>
        <p>
          <a href="http://support.microsoft.com/?kbid=938194" target="_blank">Windows Vista
Reliability Update</a>:
</p>
        <ul>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=AE2F819D-C33D-48DB-A7E3-62EEF7C1F7C2" target="_blank">x86
Download</a>
          </li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=5B7F1544-FEF3-4C80-AF1A-8B732DCB2756" target="_blank">x64
Download</a>
          </li>
        </ul>
        <p>
Go get them. Now.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=3bb7bfca-61a4-40de-863f-5e8114cd8f9f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Midyear Reader Profile</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,0f69303d-0a93-4d04-a7de-d76208f4b77c.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,0f69303d-0a93-4d04-a7de-d76208f4b77c.aspx</id>
    <published>2007-07-26T22:58:25.203125+02:00</published>
    <updated>2007-07-26T22:58:25.203125+02:00</updated>
    <category term="Blogging" label="Blogging" scheme="http://www.request-response.com/blog/CategoryView,category,Blogging.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Since it's summer here in Europe, and thus roughly middle of the year, here comes
your, Dear Reader, profile. 
</p>
        <p>
Mind you, only last years data (June 2006 - June 2007) is included, according to <a href="http://www.google.com/analytics">Google
Analytics</a>.
</p>
        <p>
          <strong>Browser Versions:</strong>
          <br />
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_1.jpg" />
        </p>
        <p>
          <strong>Operating Systems:<br /></strong>
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_2.jpg" />
        </p>
        <p>
          <strong>Browser Versions and Operating Systems:</strong>
          <br />
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_3.jpg" />
        </p>
        <p>
          <strong>Screen Resolutions:<br /><br /><img src="http://www.request-response.com/blog/images/readerprofile2007_4.jpg" /></strong>
        </p>
        <p>
          <strong>Adobe Flash Support:</strong>
          <br />
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_5.jpg" />
        </p>
        <p>
          <strong>And finally, most strangely, Java Support:</strong>
          <br />
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_6.jpg" />
        </p>
        <p>
The last one surprised me.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=0f69303d-0a93-4d04-a7de-d76208f4b77c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Managed TxF: Distributed Transactions and Transactional NTFS</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx</id>
    <published>2007-07-23T22:54:13.156+02:00</published>
    <updated>2007-07-24T09:21:23.75+02:00</updated>
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Transactions" label="Transactions" scheme="http://www.request-response.com/blog/CategoryView,category,Transactions.aspx" />
    <category term="Web Services" label="Web Services" scheme="http://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <category term="Windows Vista" label="Windows Vista" scheme="http://www.request-response.com/blog/CategoryView,category,WindowsVista.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=bca19fa8-7ba8-43d8-873e-3a8cf03335cb" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WS-Management: Windows Vista and Windows Server 2008</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,e4ad0d8c-6fb6-40b8-9b52-7ab9092ccc7c.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,e4ad0d8c-6fb6-40b8-9b52-7ab9092ccc7c.aspx</id>
    <published>2007-07-22T20:48:22.421+02:00</published>
    <updated>2007-07-22T21:01:09.078125+02:00</updated>
    <category term="Web Services" label="Web Services" scheme="http://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <category term="Windows Vista" label="Windows Vista" scheme="http://www.request-response.com/blog/CategoryView,category,WindowsVista.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I dived into <a href="http://specs.xmlsoap.org/ws/2005/06/management/ws-management.pdf">WS-Management</a> support
in Vista / <strike>Longhorn Server</strike> Windows Server 2008 this weekend. There
are a couple of caveats if you want to enable remote WS-Management based access to
these machines. Support for remote management is also built into Windows Server 2003 <strong>R2</strong>.
</p>
        <p>
WS-Management specification allows remote access to any resource that implements the
specification. Everything accessed in a WS-Management world is a resource, which is
identifiable by a URI. The spec uses WS-Eventing, WS-Enumeration, WS-Transfer and
SOAP 1.2 via HTTP.
</p>
        <p>
Since remote management implementation in Windows acknowledges all the work done in
the <a href="http://www.microsoft.com/whdc/system/pnppwr/wmi/default.mspx">WMI</a> space,
you can simply issue commands in terms of URIs that incorporate WMI namespaces.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/ws-management1.jpg" />
        </p>
        <p>
For example, the WMI class or action (method) is identified by a URI, just as any
other WS-Management based resource. You can construct access to any WMI class / action
using the following semantics:
</p>
        <ul>
          <li>
            <font face="Courier New">http://schemas.microsoft.com/wbem/wsman/1/wmi</font> denotes
a <strong>default WMI namespace</strong> accessible via WS-Management 
</li>
          <li>
            <font face="Courier New">http://schemas.microsoft.com/wbem/wsman/1/wmi/root/default</font> denotes
access to <font face="Courier New"><strong>root/default</strong></font> namespace</li>
        </ul>
        <p>
Since the majority of WMI classes are in <font face="Courier New">root/cimv2</font> namespace,
you should use the following URI to access those:
</p>
        <p>
          <font face="Courier New">http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2</font>
        </p>
        <p>
OK, back to WS-Management and its implementation in Vista / Windows Server 2008.
</p>
        <p>
First, Windows Server 2008 has the <strong>Windows Remote Management</strong> service
started up by default. Vista doesn't. So <em>start it up</em>, if you're on a Vista
box.
</p>
        <p>
Second, depending on your network configuration, if you're in a workgroup environment
(not joined to a domain) you should tell your client to <em>trust the server side</em>.
</p>
        <p>
Trusting the server side involves executing a command on a client. Remote management
tools included in Windows Server 2008 / Windows Vista are capable of configuring the
local machine and issuing commands to remote machine. There are basically two
tools which allow you to setup the infrastructure and issue remote commands to the
destination. They are:
</p>
        <ul>
          <li>
            <font face="Courier New">winrm.cmd</font> (uses <font face="Courier New">winrm.vbs</font>),
defines configuration of local machine 
</li>
          <li>
            <font face="Courier New">winrs.exe</font> (<font face="Courier New">winrscmd.dll</font> and
friends), Windows Remote Shell client, issues commands to a remote machine</li>
        </ul>
        <p>
As said, WS-Management support is enabled by default in Windows Server 2008. This
means that the appropriate service is running, but one should still define basic configuration
on it. Nothing is enabled by default; you have to <strong>opt-in</strong>. 
</p>
        <p>
Since Microsoft is progressing to a more admin friendly environment, this is done
by issuing the following command (server command):
</p>
        <p>
          <font face="Courier New">winrm quickconfig</font>
          <font face="Verdana"> (or <font face="Courier New">winrm
qc</font>)</font>
        </p>
        <p>
This enables the obvious:
</p>
        <ul>
          <li>
Starts the <strong>Windows Remote Management</strong> service (if not stared; in Windows
Vista case) 
</li>
          <li>
Enables <strong>autostart</strong> on the Windows Remote Management service 
</li>
          <li>
Starts up a <strong>listener</strong> for all machine's IP addresses 
</li>
          <li>
Configures appropriate <strong>firewall</strong> exceptions</li>
        </ul>
        <p>
You should get the following output:
</p>
        <p>
          <font face="Courier New">[c:\windows\system32]winrm quickconfig<br /></font>
          <font face="Courier New">
            <br />
WinRM is not set up to allow remote access to this machine for management.<br />
The following changes must be made:</font>
        </p>
        <p>
          <font face="Courier New">Create a WinRM listener on HTTP://* to accept WS-Man requests
to any IP on this machine.<br />
Enable the WinRM firewall exception.</font>
        </p>
        <p>
          <font face="Courier New">Make these changes [y/n]? y</font>
        </p>
        <p>
          <font face="Courier New">WinRM has been updated for remote management.<br /></font>
          <font face="Courier New">Created a WinRM listener on HTTP://* to accept WS-Man
requests to any IP on this machine.<br />
WinRM firewall exception enabled.</font>
        </p>
        <p>
There are options in <font face="Courier New">winrm.cmd</font> to fine tune anything,
including the listening ports and / or SSL (HTTPS) support. In a trusted environment
you probably don't want to issue commands using HTTP based mechanism, since you are
located behind the trust boundary and have complete control over available (allowed)
TCP ports.
</p>
        <p>
You can now issue remote management commands against the configured server, but only
if the communication <strong>is trusted</strong>. So in case you are in a workgroup
environment (client and server in a workgroup), this should get you started (client
command):
</p>
        <p>
          <font face="Courier New">winrm set winrm/config/client @{TrustedHosts="&lt;server
ip or hostname&gt;"}</font>
        </p>
        <p>
You can specify multiple trusted servers using a comma:
</p>
        <p>
          <font face="Courier New">winrm set winrm/config/client @{TrustedHosts="10.10.10.108,
10.10.10.109"}</font>
        </p>
        <p>
This trusts the server(s) no matter what. Even over HTTP only.
</p>
        <p>
Enumerating the configured listeners - remember, listener is located on the destination
side - is done via: 
</p>
        <p>
          <font face="Courier New">winrm enumerate winrm/config/listener</font>
        </p>
        <p>
OK, now we're able to issue commands to the remote side using WS-Management infrastructure.
You can, for example, try this (client command):
</p>
        <p>
          <font face="Courier New">winrs -r:http://&lt;server ip&gt; -u:&lt;username&gt; -p:&lt;password&gt;
&lt;shell command&gt;<font face="Verdana">, ie.<br /></font>winrs -r:http://10.10.10.108 -u:administrator -p:p$38E0jjW! dir -s</font>
        </p>
        <p>
or
</p>
        <p>
          <font face="Courier New">winrs -r:http://10.10.10.108 -u:administrator -p:p$38E0jjW!
hostname</font>
        </p>
        <p>
You can even explose HTTP based approach through your firewall if you're crazy enough.
But using HTTPS would be the smart way out. What you need is a valid certificate with
server authentication capability and a matching CN. Self-signed certs won't work.
</p>
        <p>
Simple and effective.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=e4ad0d8c-6fb6-40b8-9b52-7ab9092ccc7c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Managed TxF: Support in Windows Vista and Windows Server 2008</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,c421ff72-d5bc-4b5f-8c52-ed5e73e8dd00.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,c421ff72-d5bc-4b5f-8c52-ed5e73e8dd00.aspx</id>
    <published>2007-07-20T16:59:16.281+02:00</published>
    <updated>2007-07-23T20:35:56.625+02:00</updated>
    <category term="Transactions" label="Transactions" scheme="http://www.request-response.com/blog/CategoryView,category,Transactions.aspx" />
    <category term="Windows Vista" label="Windows Vista" scheme="http://www.request-response.com/blog/CategoryView,category,WindowsVista.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you happen to be on a Windows Vista or Windows Server 2008 box, there is some goodness
going your way.
</p>
        <p>
There is a basic managed <a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx">TxF</a> (Transactional
NTFS) wrapper available (unveiled by <a href="http://geekswithblogs.net/jolson/Default.aspx">Jason
Olson</a>).
</p>
        <p>
What this thing gives you is this:
</p>
        <p>
          <font face="Courier New">try<br />
{<br />
   using (TransactionScope tsFiles = new TransactionScope<br />
      </font>
          <font face="Courier New">TransactionScopeOption.RequiresNew))<br />
   {<br />
      WriteFile("TxFile1.txt");<br />
      <strong>throw new FileNotFoundException();<br /></strong>      WriteFile("TxFile2.txt");<br />
      tsFiles.Complete();<br />
   }<br />
}<br />
catch (Exception ex)<br />
{<br />
   Console.WriteLine(ex.Message);<br />
}</font>
        </p>
        <p>
          <font face="Courier New">WriteFile</font> method that does, well, file writing, is
here:
</p>
        <p>
          <font face="Courier New">using (TransactionScope tsFile = new TransactionScope<br />
      (TransactionScopeOption.Required))<br />
{<br />
   Console.WriteLine("Creating transacted file '{0}'.", filename);</font>
        </p>
        <p>
          <font face="Courier New">   using (StreamWriter tFile = new StreamWriter(TransactedFile.Open(filename, <br />
          FileMode.Create, 
<br />
          FileAccess.Write, 
<br />
          </font>
          <font face="Courier New">FileShare.None)))<br />
   {<br />
      tFile.Write(String.Format("Random data. My filename
is '{0}'.", 
<br />
          filename));<br />
   }</font>
        </p>
        <p>
          <font face="Courier New">   tsFile.Complete();<br />
   Console.WriteLine("File '{0}' written.", filename);<br />
}</font>
        </p>
        <p>
So we have a nested <font face="Courier New"><a href="http://msdn2.microsoft.com/en-us/library/system.transactions.transactionscope.aspx">TransactionScope</a></font> with
a curious type - <font face="Courier New">TransactedFile</font>. Mind you, there is
support for <font face="Courier New">TransactedDirectory</font> built in.
</p>
        <p>
What's happening underneath is awesome. The wrapper talks to unmanaged implementation
of TxF, which is built in on every Vista / Longhorn Server box. 
</p>
        <p>
What you get is transactional file system support with <a href="http://msdn2.microsoft.com/en-us/library/system.transactions.aspx">System.Transactions</a>.
And it's going to go far beyond that.
</p>
        <p>
I wrote some sample code, go get it. Oh, BTW, remove the exception line to see the
real benefit.
</p>
        <p>
Download: <a href="http://www.request-response.com/blog/content/binary/TxF_TransactedFile.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="http://www.request-response.com/blog/aggbug.ashx?id=c421ff72-d5bc-4b5f-8c52-ed5e73e8dd00" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Problem: Adding custom properties to document text in Word 2007</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,839bd119-ae37-45d1-9652-a02006342aa9.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,839bd119-ae37-45d1-9652-a02006342aa9.aspx</id>
    <published>2007-07-09T22:44:50.53125+02:00</published>
    <updated>2007-07-09T22:44:50.53125+02:00</updated>
    <category term="Microsoft" label="Microsoft" scheme="http://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <category term="Work" label="Work" scheme="http://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
There is some serious pain going on when you need to add a simple <em>custom document
property</em> into multiple Word 2007 text areas.
</p>
        <p>
Say you have a <strong>version property</strong> that you would need to update using
the document property mechanics. And say you use it in four different locations inside
your document.
</p>
        <ul>
          <li>
There is no <em>ribbon command</em> for it. There was a menu option in Word 2003 days.</li>
          <li>
There is no simple way of adding to <em>The Ribbon</em>. You have to customize
the Quick Access Toolbar and stick with ugly, limited use icons forever or so.</li>
          <ul>
            <li>
You need to choose <font face="Courier New">All commands</font> in <font face="Courier New">Customize
Quick Access Toolbar</font> to find <font face="Courier New">Insert Field</font> option.</li>
          </ul>
          <li>
This is not the only limiting option for a power user. The number of simplifications
for the casual user is equal to the number of limitations for the power user. And
yes, I know, casual users win the number battle.</li>
        </ul>
        <p>
          <img src="http://www.request-response.com/blog/images/wordinsertfield.jpg" />
        </p>
        <p>
So:
</p>
        <ol>
          <li>
Right click <em>The Ribbon</em> and select <font face="Courier New">Customize Quick
Access Toolbar</font></li>
          <li>
Select <font face="Courier New">All Commands</font> and <font face="Courier New">Insert
Field</font></li>
          <li>
Add it to <font face="Courier New">Custom Quick Access Toolbar</font></li>
          <li>
Click the new icon</li>
          <li>
In <font face="Courier New">Field names</font> select <font face="Courier New">DocProperty</font></li>
          <li>
Select your value, in this example <font face="Courier New">Version</font></li>
        </ol>
        <p>
Yes. <strong>Ease of use.</strong></p>
        <p>
Please, give me an option to get my menus and keyboard shortcuts back.
</p>
        <p>
Pretty please.
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=839bd119-ae37-45d1-9652-a02006342aa9" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Apple iPhone Hacking</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,1a5a6211-f6bd-4b5a-89d5-2ac6abbff7f2.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,1a5a6211-f6bd-4b5a-89d5-2ac6abbff7f2.aspx</id>
    <published>2007-07-08T15:20:10.953+02:00</published>
    <updated>2007-07-08T15:24:07.234375+02:00</updated>
    <category term="Apple" label="Apple" scheme="http://www.request-response.com/blog/CategoryView,category,Apple.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
There's some serious <a href="http://www.apple.com/iphone">iPhone</a> hacking going
on during the last week or so.
</p>
        <p>
          <a href="http://iphone.fiveforty.net/wiki/index.php/Main_Page">Here</a>'s the wiki
page, that has lots of information on the project. Main devs, working on the unlock
problem are from US and Hungary as it seems.
</p>
        <p>
The forum is <a href="http://hackint0sh.org/forum/forumdisplay.php?f=123">here</a>.
Deliverables <a href="http://iphonesvn.halifrag.com/svn/iPhone">here</a>.
</p>
        <p>
The progress is steady. There is a <a href="http://iphone.fiveforty.net/wiki/index.php/Latest_Progress_Report">now
a way</a> to issue commands to the system, including moving of files, activation (which
was achieved in three days) and directory listing inside the sandboxed filesystem.
</p>
        <p>
I'm following the progress (with <a href="http://hana.request-response.com">Hana</a> -
she's cheering along), because it's fun to know the internals of a locked down Apple
device.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=1a5a6211-f6bd-4b5a-89d5-2ac6abbff7f2" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Out the Door: WS-ReliableMessaging 1.1</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,c6dac5cb-596b-4836-ab83-9802e54d2471.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,c6dac5cb-596b-4836-ab83-9802e54d2471.aspx</id>
    <published>2007-07-03T16:58:29.796875+02:00</published>
    <updated>2007-07-03T16:58:29.796875+02:00</updated>
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Microsoft" label="Microsoft" scheme="http://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <category term="Web Services" label="Web Services" scheme="http://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=c6dac5cb-596b-4836-ab83-9802e54d2471" />
      </div>
    </content>
  </entry>
  <entry>
    <title>All Things Digital: Jobs + Gates</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,f4b0538e-b90e-4c6e-abd4-c4903d21fa4f.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,f4b0538e-b90e-4c6e-abd4-c4903d21fa4f.aspx</id>
    <published>2007-05-31T14:14:25.348+02:00</published>
    <updated>2007-05-31T15:31:07.5379931+02:00</updated>
    <category term="Apple" label="Apple" scheme="http://www.request-response.com/blog/CategoryView,category,Apple.aspx" />
    <category term="Microsoft" label="Microsoft" scheme="http://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Microsoft Windows Vista Ultimate, $499.
</p>
        <p>
Apple iPhone, $599.
</p>
        <p>
Jobs and Gates sitting <a href="http://d5.allthingsd.com/20070530/steve-jobs-and-bill-gates-together-part-1-of-7/">together</a>.
Priceless.
</p>
        <p>
        </p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=f4b0538e-b90e-4c6e-abd4-c4903d21fa4f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Durable Messaging Continues</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,bdb761f8-8856-41c8-b4ad-c38338bf6567.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,bdb761f8-8856-41c8-b4ad-c38338bf6567.aspx</id>
    <published>2007-05-30T22:46:14.77+02:00</published>
    <updated>2007-07-23T18:54:43.28125+02:00</updated>
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Architecture" label="Architecture" scheme="http://www.request-response.com/blog/CategoryView,category,Architecture.aspx" />
    <category term="Transactions" label="Transactions" scheme="http://www.request-response.com/blog/CategoryView,category,Transactions.aspx" />
    <category term="Web Services" label="Web Services" scheme="http://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=bdb761f8-8856-41c8-b4ad-c38338bf6567" />
      </div>
    </content>
  </entry>
  <entry>
    <title>NTK 2007: About Being Better</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,747a878d-5bd5-4365-9899-5358d54695cc.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,747a878d-5bd5-4365-9899-5358d54695cc.aspx</id>
    <published>2007-05-22T00:13:24.281+02:00</published>
    <updated>2007-05-22T00:28:32.359375+02:00</updated>
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Having posted a <a href="http://www.request-response.com/blog/PermaLink,guid,944cefdc-7630-4033-b4f5-4f9635936d2c.aspx">disturbing</a> post
last year, I have a moral obligation to repost my current state of mind.
</p>
        <p>
This year's <a href="http://www.ntk2007.si">NT conference</a> was <em>way better</em>,
especially regarding fun-activating activities. It's not my cup of tea, when <em>things
are being <strong>cut</strong></em>, but I was impressed by the plethora of activities
that were <strong>not</strong> present this year.
</p>
        <p>
Yeah, I know. When you've got activities that are <strong>not present</strong>, you're
in it deep.
</p>
        <p>
Clarifying it, here it goes.
</p>
        <p>
I like it when things are not there (regarding fun during the NT conference).
</p>
        <ul>
          <li>
I like the fact that sponsors and partners were not given a <em><a href="http://en.wikipedia.org/wiki/Blank_check">carte
blache</a>.</em></li>
          <li>
I like the fact that there were no naked ladies running around. Doh! 
</li>
          <li>
I like the fact that I like the fact that there were no naked ladies running around. 
</li>
          <li>
I like the fact that there was not enough free beer. 
</li>
          <li>
I like the fact that parties were not too <em>'lomaniac</em>. 
</li>
          <li>
I like the fact that we, speakers, were pressured again. 
</li>
          <li>
I like the fact that, above all, this was a step forward.</li>
        </ul>
        <p>
What I don't I like (in 2007 incarnation):
</p>
        <ul>
          <li>
I don't like keynotes that have (almost, sorry) no content. 
</li>
          <li>
I don't like keynotes that have no cues, allowing people to leave with no impression. 
</li>
          <li>
I especially don't like keynotes that, having a plethora of technology to show, don't
make attendees drool their asses off. 
</li>
          <li>
I don't like 30 minute breaks. Sorry, too long. 
</li>
          <li>
I don't like that attendees have no free evenings. It's just to reflect on what they've
heard.</li>
        </ul>
        <p>
And, as stated <a href="http://www.request-response.com/blog/PermaLink,guid,944cefdc-7630-4033-b4f5-4f9635936d2c.aspx">previously</a> (and
again) I don't like parties happening every evening on a technical conference. But
that might just be the rule I have.
</p>
        <p>
If NTK continues in this year's fashion, we all did a good job. If only next
year, they would get some pre/post conference options <em>(hint)</em> for the technical
savvy.
</p>
        <p>
          <a href="http://www.ntk2007.si/sites/main/blog/default.aspx">Luke, Kamenko</a>, this
is a major contribution to being on the right track again. Kudos.
</p>
        <p>
          <font color="#808080" size="1">[This post can and probably will, position me into
the nerd crowd. It is not my intention. For you, who know me personally, you know
what I'm talking about. At a certain point of fun, everybody has enough.]</font>
        </p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=747a878d-5bd5-4365-9899-5358d54695cc" />
      </div>
    </content>
  </entry>
  <entry>
    <title>CoreCLR Exposed</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,53aa79e4-b540-49b3-b502-a87b97c5a223.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,53aa79e4-b540-49b3-b502-a87b97c5a223.aspx</id>
    <published>2007-05-12T22:42:30.5+02:00</published>
    <updated>2007-05-30T22:49:51.7931167+02:00</updated>
    <category term="Architecture" label="Architecture" scheme="http://www.request-response.com/blog/CategoryView,category,Architecture.aspx" />
    <category term="CLR" label="CLR" scheme="http://www.request-response.com/blog/CategoryView,category,CLR.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://www.request-response.com/blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://weblogs.asp.net/nunitaddin/default.aspx">Jamie Cansdale</a> of
TestDriven.NET fame just posted an intro <a href="http://weblogs.asp.net/nunitaddin/archive/2007/05/10/silverlight-console-applications.aspx">post</a> describing
the hosting of Silverlight's CLR - CoreCLR.
</p>
        <p>
Having the ability to host the runtime inside a Win32/.NET process brings up new possibilities,
especially running Silverlight apps outside the browser or developing test harnesses/unit
tests for Silverlight intended object models.
</p>
        <p>
          <a href="http://msdn.microsoft.com/vstudio/eula.aspx?id=e2c1a44f-0b5c-face-28c8-08a26f2e0b3c">Silverlight
1.1 alpha</a> and CoreCLR currently expose a very trimmed down version of the Framework's
BCL. This will change by RTM, but be aware that its sweet spot is still the browser.
</p>
        <p>
I can imagine a world where Silverlight apps will not only be media/presentation related.
Currently, the <a href="http://www.adobe.com/products/flex/">competing platform</a>,
though having a strong install base, has not reached into that space. 
</p>
        <p>
You could arm Flash developers with rocket launchers, but they would still lose a <strike>battle</strike> war
against .NET developers armed with chopsticks. Every day of the week and twice on
Sunday. I believe the number of souls will significantly influence the outcome in
this case.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=53aa79e4-b540-49b3-b502-a87b97c5a223" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Silverlight Already on Microsoft.com</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,516d1fcf-1b1d-4194-a107-ce2c69050f71.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,516d1fcf-1b1d-4194-a107-ce2c69050f71.aspx</id>
    <published>2007-05-12T22:05:11.59375+02:00</published>
    <updated>2007-05-12T22:05:11.59375+02:00</updated>
    <category term="Silverlight" label="Silverlight" scheme="http://www.request-response.com/blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today, Microsoft.com put a <a href="http://www.silverlight.net">Silverlight</a> enabled
video of <a href="http://www.xbox.com/en-US/community/news/2007/0327-microsoftunveilsxbox360elite.htm">XBox
360 Elite</a> on the site <a href="http://www.microsoft.com/en/us/default.aspx">front
page</a>.
</p>
        <p>
This must be one of the earliest technology adoptions for Microsoft.com. They host
a 1.0 beta version of the Silverlight app and it got me thinking why would a high
traffic site want to do this.
</p>
        <p>
My conclusion? 
</p>
        <p>
Answer this: What's the quickest way to install the Silverlight runtime to a
broad user base without using a ship vehicle?
</p>
        <p>
Admittedly, installing the runtime is quick, painless and benign for your machine.
As it <a href="http://www.request-response.com/blog/PermaLink,guid,90c93e85-16da-4ac6-9d35-d5d8a993a186.aspx">should
be</a>.
</p>
        <p>
Try it out. Then visit some <a href="http://silverlight.net/community/communitygallery.aspx">sample
galleries</a>.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=516d1fcf-1b1d-4194-a107-ce2c69050f71" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Microsoft NT Conference 2007: Talks</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,9129c0f2-9302-4e33-9472-96ab5dc4662a.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,9129c0f2-9302-4e33-9472-96ab5dc4662a.aspx</id>
    <published>2007-05-12T21:20:38.531+02:00</published>
    <updated>2007-05-12T22:46:03.6875+02:00</updated>
    <category term="Conferences" label="Conferences" scheme="http://www.request-response.com/blog/CategoryView,category,Conferences.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
It's the time of the year again when the <a href="http://www.ntk2007.si">biggest local
show</a> gets going.
</p>
        <p>
This year, I'm going to deliver three talks:
</p>
        <p>
          <u>Tuesday, 15.5.2007, 18:00, Room D, <strong>WCF+Workflow: Et tu, Orcas?</strong></u>
        </p>
        <p>
Drilldown of: WCF support for syndication, POX, JSON, WCF + WF integration and WF
instance correlation support.
</p>
        <p>
          <u>Wednesday, 16.5.2007, 09:00, Emerald 1, <strong>MythBusters: Fat Clients and
Thin Servers</strong></u> (with <a href="http://blogs.solidq.com/EN/dzupancic/default.aspx">Dušan</a>)
</p>
        <p>
Drilldown of: Will not disclose. Stop by (if you dare). :)
</p>
        <p>
          <u>Wednesday, 16.5.2007, 15:00, Emerald 2, <strong>WCF: About Messaging Sessions</strong></u>
        </p>
        <p>
Drilldown of: WCF messaging sessions, what they are, how to handle them, what's the
underlying story.
</p>
        <p>
Also, if you are a <strong>journalist</strong>, stop by for a press conference
on Tuesday, 15.5.2007 at 12<sup>00</sup> in the Press Center. Together with a
client, we have a discussion on digital document archives, legislature and best practices.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=9129c0f2-9302-4e33-9472-96ab5dc4662a" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Resizing Image Attachments in Outlook 2007</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,2005010a-e143-4228-864f-96e526a296db.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,2005010a-e143-4228-864f-96e526a296db.aspx</id>
    <published>2007-05-05T23:59:10.465+02:00</published>
    <updated>2007-05-06T00:00:18.63725+02:00</updated>
    <category term="Microsoft" label="Microsoft" scheme="http://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Well, it took me awhile to figure out, but here's a way to bring back the dialog
which allows you to resize image attachments you send in Outlook 2007.
</p>
        <p>
It's hidden the behind right arrow of the Include box. Right here:
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/outlookresize1.jpg" />
        </p>
        <p>
I knew it must be there somewhere. And it is, it's just a <strong><em>click away</em></strong>.
</p>
        <p>
It must be me, but I was looking for this option for a couple of months. It was one
of my beloved features in Outlook 2003, since sending snapshots of something allowed
me to get them down from 5MB to 100kb by just clicking an option.
</p>
        <p>
There is a special checkbox called 'Show when attaching files' there.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/outlookresize2.jpg" />
        </p>
        <p>
Turn it on. Now.
</p>
        <p>
Who decided it's a good thing to leave this thing off by default?
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=2005010a-e143-4228-864f-96e526a296db" />
      </div>
    </content>
  </entry>
  <entry>
    <title>IIS6: Changing the Locale ID when Regional Settings Won't Work</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,e6ba0263-8825-4a6d-91e8-f5ce7f92111e.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,e6ba0263-8825-4a6d-91e8-f5ce7f92111e.aspx</id>
    <published>2007-04-18T13:04:31.593+02:00</published>
    <updated>2008-02-05T08:03:50.01475+01:00</updated>
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Work" label="Work" scheme="http://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I noticed an awkwardness on my IIS6 server installation today.
</p>
        <p>
All my sites were running with a US locale, thus invalidating the currency/date time/decimal
calculations by an order of magnitude.
</p>
        <p>
The problem was that the server was installed using the default settings, and also
applied those to the <font face="Courier New">Network Service</font> account under
which most of my sites work.
</p>
        <p>
How do you fix this?
</p>
        <ol>
          <li>
Login (RDP is OK) 
</li>
          <li>
Change the locale to your preference on the logged in account, use Control Panel's
Regional Settings UI, you may need to reboot 
</li>
          <li>
Go to <font face="Courier New">HKEY_CURRENT_USER\Control Panel\International</font></li>
          <li>
Right click, choose <font face="Courier New">Export</font></li>
          <li>
Open the file in Notepad, replace <font face="Courier New">"HKEY_CURRENT_USER"</font> with <font face="Courier New">"HKEY_USERS\S-1-5-20"</font>,
this is the Network Service account 
</li>
          <li>
Save the .reg file 
</li>
          <li>
Double click the .reg file and import the settings 
</li>
          <li>
Restart IIS</li>
        </ol>
        <p>
You should have your locale set.
</p>
        <p>
Oh, on the other side, while investigating this, here's a scoop on how to get to clear
text passwords of <font face="Courier New">IUSR_MACHINENAME</font> and <font face="Courier New">IWAM_MACHINENAME</font> accounts:
</p>
        <ol>
          <li>
Go to <font face="Courier New">C:\InetPub\AdminScripts</font> and open <font face="Courier New">adsutil.vbs</font> script
in Notepad 
</li>
          <li>
Change the only occurrence of <font face="Courier New">"IsSecureProperty = True"</font> to <font face="Courier New">"IsSecureProperty
= False"</font>. Save. 
</li>
          <li>
Run <font face="Courier New">"cscript adsutil.vbs get w3svc/anonymoususerpass"</font> in
command prompt 
</li>
          <li>
Run <font face="Courier New">"cscript adsutil.vbs get w3svc/wamuserpass"</font> in
command prompt 
</li>
          <li>
Don't forget to revert to <font face="Courier New">"IsSecureProperty = True"</font> in <font face="Courier New">adsutil.vbs</font></li>
          <li>
Don't forget to save the file again</li>
        </ol>
        <p>
You should have both passwords now. This comes handy when you need to fine tune the
settings of both built-in accounts.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=e6ba0263-8825-4a6d-91e8-f5ce7f92111e" />
      </div>
    </content>
  </entry>
  <entry>
    <title>INETA Talk: About WCF Messaging Sessions</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,1104ee60-c0ea-461b-b711-a289664e1f16.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,1104ee60-c0ea-461b-b711-a289664e1f16.aspx</id>
    <published>2007-03-27T20:39:27.7465+02:00</published>
    <updated>2007-03-27T20:39:27.7465+02:00</updated>
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just came back from today's talk on WCF session support.
</p>
        <p>
Deliverables:
</p>
        <ul>
          <li>
            <a href="http://www.request-response.com/blog/content/binary/inetamarch2007ppt.zip">PPT</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/content/binary/inetamarch2007.zip">Code</a>
          </li>
        </ul>
        <p>
Remember: <font face="Courier New">proxy.Close()</font> is <a href="http://www.request-response.com/blog/PermaLink,guid,f731e5cc-9490-4f1e-bc7d-efb91f357cd1.aspx">your
friend</a>.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=1104ee60-c0ea-461b-b711-a289664e1f16" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Hana Re</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,9c276d8e-7540-4429-9b51-7a2900e782bf.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,9c276d8e-7540-4429-9b51-7a2900e782bf.aspx</id>
    <published>2007-03-16T09:05:36.905+01:00</published>
    <updated>2007-03-21T20:44:47.27675+01:00</updated>
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Our <a href="http://hana.request-response.com">gift</a> came yesterday evening. Baby
girl. Hana Re.
</p>
        <p>
As perfect as possible, mom included.
</p>
        <p>
0.003255 tons, 0.00052 kilometers
</p>
        <p>
          <a href="http://hana.request-response.com">
            <img src="http://www.request-response.com/blog/images/hanare1.jpg" border="1" />
          </a>
        </p>
        <p>
 
</p>
        <p>
 
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=9c276d8e-7540-4429-9b51-7a2900e782bf" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Using Dark Room</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,9ec78873-f699-4ed8-b6f4-b6927d663606.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,9ec78873-f699-4ed8-b6f4-b6927d663606.aspx</id>
    <published>2007-03-11T22:19:35.233+01:00</published>
    <updated>2007-03-11T22:22:29.577+01:00</updated>
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <category term="Work" label="Work" scheme="http://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you need a distraction free writing environment, grab a copy of <a href="http://they.misled.us/dark-room">Dark
Room</a>. I found it after a few years of using <a href="http://www.hogbaysoftware.com/product/writeroom">WriteRoom</a>,
the original, on a Mac.
</p>
        <p>
          <img src="http://they.misled.us/images/dark_room.gif" />
        </p>
        <p>
I write most of my draft documents in it. Then I move them to Word and apply formatting.
I write <em>all </em>blog entries - exclusively in Dark Room - <em>every post</em>.
</p>
        <p>
It does what every text editor should be doing first. It makes you concentrate on
the subject.
</p>
        <p>
And, best of all - it's small footprint, single .exe app. Xcopy it to your
path. Bam.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=9ec78873-f699-4ed8-b6f4-b6927d663606" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Hassle Free Setups and Market Penetration</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,90c93e85-16da-4ac6-9d35-d5d8a993a186.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,90c93e85-16da-4ac6-9d35-d5d8a993a186.aspx</id>
    <published>2007-03-11T21:37:09.717+01:00</published>
    <updated>2007-03-11T21:39:38.530125+01:00</updated>
    <category term="CLR" label="CLR" scheme="http://www.request-response.com/blog/CategoryView,category,CLR.aspx" />
    <category term="Other" label="Other" scheme="http://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://devhawk.net/">Harry Pierson</a> is <a href="http://feeds.feedburner.com/~r/Devhawk/~3/99827836/The+Virtuous+Cycle+Of+Virtual+Platforms.aspx">discussing</a> the
correlation between market penetration and hassle free installation experience and <em>hits
the nail on its head</em>.
</p>
        <p>
Big market success of <a href="http://en.wikipedia.org/wiki/Macromedia_Flash">Adobe
Flash</a>, its omnipresence and high install base can definitely be traced back to
flawless install experience. In fact, it's so perfect, that <em>most users don't even
know which version they're running</em>. They don't care (me included). And they shouldn't
care.
</p>
        <p>
The first thing any platform needs to achieve is simple and effective installation
experience. I don't want to manually download platform installers to use certain
web services. It has to auto-install and has to be safe. This is what Flash does perfectly.
</p>
        <p>
All current virtual machine based platforms can be installed independently. Or they
can be flawlessly smuggled in by a host application setup program. The problem is,
that we can't compare CLR (or JVM) based platforms to Windows (as a platform), since
the user can't run five of the latter at the same time.
</p>
        <p>
Flash 9 market penetration is currently at <strong>~40%</strong>. Flash 8 penetration
is <strong>~90%</strong>, while Flash 6 penetration is <strong>~96%</strong>.
</p>
        <p>
          <a href="http://msdn2.microsoft.com/en-us/asp.net/bb187358.aspx">WPF/E</a> will have
the same install experience. Bet on it. If it wants to succeed, it will also have
to allow multiple versions to coexist gracefully.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=90c93e85-16da-4ac6-9d35-d5d8a993a186" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Orcas: POX Service Support</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c.aspx</id>
    <published>2007-03-10T21:55:49.077+01:00</published>
    <updated>2007-03-10T21:57:18.2026062+01:00</updated>
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <content type="xhtml">
      <div 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="http://www.request-response.com/blog/aggbug.ashx?id=afaee5c3-df3e-4341-ac5d-b7ac70e6cd3c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Rebuilding Success</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,5d5cc5a8-93c9-4a38-a09e-6b73ec0b083d.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,5d5cc5a8-93c9-4a38-a09e-6b73ec0b083d.aspx</id>
    <published>2007-03-05T21:59:12.1875+01:00</published>
    <updated>2007-03-05T21:59:12.1875+01:00</updated>
    <category term="Personal" label="Personal" scheme="http://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Well, my site was down a couple of times during the weekend. Had to buy a new server,
since my old machine's power supply tanked and took the motherboard with it.
</p>
        <p>
So, this week started on some serious hardware, a <a href="http://www.dell.com/content/products/productdetails.aspx/pedge_2900?c=us&amp;cs=555&amp;l=en&amp;s=biz&amp;~section=specs#tabtop">Dell
PowerEdge 2900</a>. The migration took a couple of tries, but it was mostly due to
reconfiguration of RAID arrays. This beast has 10 <a href="http://en.wikipedia.org/wiki/Serial_Attached_SCSI">SAS</a> drive
bays, so I opted for two RAID 5 arrays, mostly due to expandability.
</p>
        <p>
Kudos go out to <a href="http://www.alldea.si">Alldea</a> guys who suggested, tested,
configured and helped me get the server in time (actually, I got it in 12 hours).
Their service is flawless and if you are buying a Dell in Slovenia, give them a <a href="http://www.alldea.si/html/kontakt.html">call</a>.
</p>
        <p>
We configured the machine with a quad core Xeon and left another processor slot empty.
There are still two hard drive bays unattended and 8 RAM slots available. And since
my old machine faulted because its power supply tanked, this one has two. Redundant
ones.
</p>
        <p>
It should give at least 5 years of service, me thinks.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=5d5cc5a8-93c9-4a38-a09e-6b73ec0b083d" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WCF: Security Sessions and Service Throttling</title>
    <link rel="alternate" type="text/html" href="http://www.request-response.com/blog/PermaLink,guid,f731e5cc-9490-4f1e-bc7d-efb91f357cd1.aspx" />
    <id>http://www.request-response.com/blog/PermaLink,guid,f731e5cc-9490-4f1e-bc7d-efb91f357cd1.aspx</id>
    <published>2007-02-27T17:04:52.774+01:00</published>
    <updated>2007-05-30T22:49:21.3993797+02:00</updated>
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="http://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <category term="Architecture" label="Architecture" scheme="http://www.request-response.com/blog/CategoryView,category,Architecture.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
WCF includes support for establishing a security session through a simple configuration
attribute. The primary reason of a security session is a <em>shared security context</em> which
enables clients and services to use a faster, <strong>symmetric</strong> cryptographic
exchange.
</p>
        <p>
WCF sessions should not be thought of in terms of HTTP based sessions, since the former
are initiated by clients and the latter by the servers. In other terms, WCF sessions
are there to support some kind of shared context between a particular client and a
service. This context can be anything, and is not limited to security contexts.
</p>
        <p>
The attribute that establishes a security session and shared context is called, well, <font face="Courier New">establishSecurityContext</font> and
is present in binding configuration. An example of such a binding would be:
</p>
        <p>
          <font face="Courier New">&lt;bindings&gt;<br />
  &lt;wsHttpBinding&gt;<br />
    &lt;binding name="SecureBinding"&gt;<br />
      &lt;security mode ="Message"&gt;<br />
        &lt;message clientCredentialType="Certificate"
establishSecurityContext="true"/&gt;<br />
      &lt;/security&gt;<br />
    &lt;/binding&gt;<br />
  &lt;/wsHttpBinding&gt;<br />
&lt;bindings&gt;</font>
        </p>
        <p>
This binding allows HTTP based communication, demands message based security (think
WS-Security) and uses certificates to sign/encrypt the message content. The attribute <font face="Courier New">establishSecurityContext</font> is
set to <font face="Courier New">true</font>, which actually <em>enforces a WS-SecureConversation
session</em> between the client and the service.
</p>
        <p>
The following is a simplified version of what is going on under the covers:
</p>
        <ul>
          <li>
            <strong>Client instantiates the service proxy<br /></strong>No message exchange is taking place yet. 
</li>
          <li>
            <strong>Client requests a SCT (Secure Context Token)<br /></strong>This is done by the infrastructure, when the first service method is called.
SCT (again simplified) represents a secure context, which includes the symmetric key.
The message which demands it is (per WS-SecureConversation spec) called RST (Request
Secure Token). 
</li>
          <li>
            <strong>Service responds with RSTR (Request Secure Token Response) message<br /></strong>Session bootstraps and is ready to piggyback all further message exchanges.</li>
        </ul>
        <p>
What is not well known is that <em>there is a very low limit on the number of sessions</em> a
service is willing to accept. The default is set to 10 sessions and this was changed
(from 64) late in the WCF development cycle (summer 2006). So RTM ships with this
default.
</p>
        <p>
Service session count is greatly influenced by the instancing scheme the service is
using. Since instancing is a completely different beast, let's leave this for another
post (uhm, I already wrote something <a href="http://www.request-response.com/blog/PermaLink,guid,48b65a92-4015-45f2-8fee-78ae5c0e48b8.aspx">here</a>).
Let's just say that hitting the session problem is a non-issue when using singleton
instancing (<font face="Courier New">InstanceContextMode = InstanceContextMode.Single</font>).
</p>
        <p>
The main issue is, that most developers think of <strike>Indigo</strike> WCF services
in terms of simple request-response semantics and forget that such sessions get queued
up on the service side if you do not terminate them appropriately.
</p>
        <p>
This is the default service throttling behavior in the shipping version of WCF:
</p>
        <p>
          <font face="Courier New">&lt;behaviors&gt;<br />
  &lt;serviceBehaviors&gt;<br />
    &lt;behavior name="DefaultThrottlingBehavior"&gt;<br />
      &lt;serviceThrottling maxConcurrentCalls="16"<br />
                        
maxConcurrentSessions="10"<br />
                        
maxConcurrentInstances="&lt;Int32.MaxValue&gt;" /&gt;<br />
    &lt;/behavior&gt;<br />
  &lt;/serviceBehaviors&gt;<br />
&lt;/behaviors&gt;</font>
        </p>
        <p>
Every service is throttled, even if you don't specify it. You can, of course, <em>override
all three throttling parameters</em>.
</p>
        <p>
Sessions can only be initiated by the client. They can be explicitly terminated only
by the client. There are three ways a session can get terminated:
</p>
        <ul>
          <li>
Explicitly by the client 
</li>
          <li>
Implicitly by a timeout 
</li>
          <li>
Implicitly by errors</li>
        </ul>
        <p>
Timeout can pass on a client or a service and, if the timeout happens, the transport
channel that ensured communication gets faulted (<font face="Courier New">Channel.State
= CommunicationState.Faulted</font>). Session is also terminated if an error is detected,
thus invalidating the possibility to continue.
</p>
        <p>
Remember that every service proxy you use will demand a new session on the service
side (when using 
<br />
sessionful services). If you spawn <strong>11 threads</strong> and use a non-singleton
proxy you will cause <strong>10 sessions</strong> on the service side. The <strong>11<sup>th</sup></strong> will
not get setup and will block the client thread until the timeout expires. In this
case, the WCF infrastructure on the service side will issue a <em>warning in the trace
log</em>, but <strong>nothing will be returned to the client</strong>. It
seems as if the service would stop working. Nada.
</p>
        <p>
There is a method on every service proxy and it's there for a reason. The method is
called <font face="Courier New">Close()</font>. It closes the transport channel graciously
and terminates the security session, thus freeing up service resources. The same happens
for reliable messaging session or a combination of both.
</p>
        <p>
          <strong>Note:</strong> Another message (pair) is exchanged on <font face="Courier New">Close()</font>.
This message is saying <em>"We are done."</em> to the service. Thus, one should be
cautious when calling <font face="Courier New">Close()</font> for any exceptions,
like <font face="Courier New">CommunicationObjectFaultedException</font>.
</p>
        <p>
The best practice is to catch any <font face="Courier New">CommunicationException</font> exceptions
when closing the channel.
</p>
        <p>
To illustrate this, consider the following. You call a single method on a sessionful
service. Then hang on to the service proxy instance for an hour. The inactivity timeout
(attribute <font face="Courier New">inactivityTimeout</font> on a RM binding) is set
to 10 minutes. So, ten minutes after the first call the channel gets faulted. Then
you call <font face="Courier New">Close()</font>. This call <em>will fail</em> and
throw an exception.
</p>
        <p>
The following is the expected way of communication with sessionful services:
</p>
        <p>
          <font face="Courier New">ServiceClient proxy = new ServiceClient("&lt;Configuration&gt;");<br />
try<br />
{<br />
  // call service methods<br />
  int intSum = proxy.Add(1, 2);<br /><br /></font>
          <font face="Courier New">  // ... call all other methods ...<br /><br />
  </font>
          <font face="Courier New">// call service methods<br />
  int intSum = proxy.Subtract(1, 2);<br /><br />
  // close session<br />
  proxy.Close();<br />
}<br />
catch (TimeoutException ex)<br />
{<br />
  // handle timeout exceptions<br />
  proxy.Abort();<br />
}<br />
catch (FaultException&lt;T1&gt; ex)<br />
{<br />
  // handle typed exception T1<br />
  proxy.Close();<br />
}<br />
...<br />
catch (FaultException&lt;Tn&gt; ex)<br />
{<br />
  // handle typed exception Tn<br />
  proxy.Close();<br />
}<br />
catch (FaultException ex)<br />
{<br />
  // handle all other typed exceptions<br />
  proxy.Close();<br />
}<br />
catch (CommunicationException ex)<br />
{<br />
  // handle communication exceptions<br />
  proxy.Abort();<br />
}</font>
        </p>
        <p>
Note that using the <font face="Courier New">using</font> statement is not recommended.
The problem of <font face="Courier New">using</font> statement in this case is that
CLR automatically calls <font face="Courier New">Dispose()</font> method on the using
variable when exiting the statement. Since <font face="Courier New">Close()</font> can
fail (remember, another message is exchanged), you can miss this important exception.
</p>
        <p>
Everything in this post is true for all kinds of WCF sessions. It is <em>not limited
to security or RM sessions</em> only.
</p>
        <img width="0" height="0" src="http://www.request-response.com/blog/aggbug.ashx?id=f731e5cc-9490-4f1e-bc7d-efb91f357cd1" />
      </div>
    </content>
  </entry>
</feed>