<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>All About Interop : WSDL</title><link>http://blogs.msdn.com/dotnetinterop/archive/tags/WSDL/default.aspx</link><description>Tags: WSDL</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>WSDL-First in WCF, versus WSDL-First in ASMX</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/09/25/wsdl-first-in-wcf-versus-wsdl-first-in-asmx.aspx</link><pubDate>Thu, 25 Sep 2008 18:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8964013</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8964013.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8964013</wfw:commentRss><description>&lt;P&gt;I wanted to point something out regarding &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/09/24/wsdl-first-development-with-wcf.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/09/24/wsdl-first-development-with-wcf.aspx"&gt;the WSDL-First item I posted yesterday&lt;/A&gt;.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;This is a look at the interface generated by the SvcUtil.exe tool for WCF.&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.CodeDom.Compiler.GeneratedCodeAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"System.ServiceModel"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"3.0.0.0"&lt;/SPAN&gt;)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.ServiceModel.ServiceContractAttribute(Namespace=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConfigurationName=&lt;SPAN style="COLOR: #a31515"&gt;"Ionic.Samples.Webservices.Sep21.IResearchServiceSoap"&lt;/SPAN&gt;)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;interface&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IResearchServiceSoap&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [System.ServiceModel.OperationContractAttribute(Action=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search/Registration"&lt;/SPAN&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReplyAction=&lt;SPAN style="COLOR: #a31515"&gt;""&lt;/SPAN&gt;)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [System.ServiceModel.XmlSerializerFormatAttribute()]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; Registration(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; registrationXml);&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [System.ServiceModel.OperationContractAttribute(Action=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search/Query"&lt;/SPAN&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReplyAction=&lt;SPAN style="COLOR: #a31515"&gt;""&lt;/SPAN&gt;)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [System.ServiceModel.XmlSerializerFormatAttribute()]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; Query(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; queryXml);&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [System.ServiceModel.OperationContractAttribute(Action=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search/Status"&lt;/SPAN&gt;,&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReplyAction=&lt;SPAN style="COLOR: #a31515"&gt;""&lt;/SPAN&gt;)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [System.ServiceModel.XmlSerializerFormatAttribute()]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; Status();&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks quite similar to the interface that you can generate using the appropriate wsdl.exe tool if you would prefer to use the ASMX (or System.Web.Services) stack that first shipped in .NET v1.1, and continues to be available in .NET 3.5. &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;
&lt;P style="MARGIN: 0px"&gt;[System.CodeDom.Compiler.GeneratedCodeAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"wsdl"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"2.0.50727.42"&lt;/SPAN&gt;)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;[System.Web.Services.WebServiceBindingAttribute(Name=&lt;SPAN style="COLOR: #a31515"&gt;"ResearchServiceSoap"&lt;/SPAN&gt;, Namespace=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;interface&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IResearchServiceSoap&lt;/SPAN&gt; {&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;remarks/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Web.Services.WebMethodAttribute()]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Web.Services.Protocols.SoapDocumentMethodAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search/Registration"&lt;/SPAN&gt;, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; RequestNamespace=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ResponseNamespace=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Use=System.Web.Services.Description.SoapBindingUse.Literal, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; Registration(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; registrationXml);&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;remarks/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Web.Services.WebMethodAttribute()]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Web.Services.Protocols.SoapDocumentMethodAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search/Query"&lt;/SPAN&gt;, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; RequestNamespace=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ResponseNamespace=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Use=System.Web.Services.Description.SoapBindingUse.Literal, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; Query(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; queryXml);&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;remarks/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Web.Services.WebMethodAttribute()]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [System.Web.Services.Protocols.SoapDocumentMethodAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search/Status"&lt;/SPAN&gt;, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; RequestNamespace=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ResponseNamespace=&lt;SPAN style="COLOR: #a31515"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Use=System.Web.Services.Description.SoapBindingUse.Literal, &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; Status();&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;So as you can see, it is a very similar model. Different attributes support the different runtimes (System.Web.Services versus WCF), but it is very parallel. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8964013" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WSDL/default.aspx">WSDL</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/ASMX/default.aspx">ASMX</category></item><item><title>WSDL-First development with WCF</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/09/24/wsdl-first-development-with-wcf.aspx</link><pubDate>Wed, 24 Sep 2008 18:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8961888</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>11</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8961888.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8961888</wfw:commentRss><description>&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/09/05/using-the-wsdl-first-design-approach-with-wcf-services.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/09/05/using-the-wsdl-first-design-approach-with-wcf-services.aspx"&gt;A couple weeks ago I mentioned&lt;/A&gt; that you could do WSDL-First development with WCF, but I didn't go into detail as to how that would work.&amp;nbsp; Somebody asked, so I guess I'll describe the specific steps. I want to use a real scenario, so for a WSDL, I will use the WSDL that Microsoft defines for &lt;A class="" href="http://msdn.microsoft.com/en-us/library/aa295420(office.11).aspx" mce_href="http://msdn.microsoft.com/en-us/library/aa295420(office.11).aspx"&gt;Microsoft Office Research Services&lt;/A&gt;. &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Did you get that? Microsoft Office defines a WSDL for Research Services. Any Microsoft Office program, Office 2003 or Office 2007, can call out to any service that implements the given Research Service wire contract. Office programs are web services clients. Ok, we're all clear on that, right? &lt;/P&gt;
&lt;P&gt;And this it may be &lt;I&gt;counter intuitive&lt;/I&gt; for some people. The &lt;I&gt;client&lt;/I&gt; application, in this case, Microsoft Office, specifies the on-the-wire contract, the WSDL. Lots of people have a server-centric design perspective, and assume that the server defines the contract. That often makes sense, but not in this case. Because there are so many deployments of Microsoft Office out there, it makes sense for the client to define the contract. &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Back to the WSDL. But let me be straight with you: on the website I referenced, I did not actually see a WSDL specifically defined for the Office Research Service.&amp;nbsp; I'd expect to find it in the &lt;A class="" href="http://msdn.microsoft.com/en-us/library/aa295420(office.11).aspx" mce_href="http://msdn.microsoft.com/en-us/library/aa295420(office.11).aspx"&gt;Schema Reference&lt;/A&gt;, but that reference includes XML Schema, not web services contracts. On the other hand, the Research Service SDK includes sample applications built on .NET and ASMX, and running those you can generate the WSDL that is being used.&amp;nbsp; So... effectively the WSDL &lt;EM&gt;is implicitly published&lt;/EM&gt;.&amp;nbsp; I took some liberties with the WSDL available in that way and I came up with my own WSDL, like so: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;&lt;PRE&gt;&amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;definitions&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #da70d6"&gt;xmlns&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;http&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"http://schemas.xmlsoap.org/wsdl/http/"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #da70d6"&gt;xmlns&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;soap&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"http://schemas.xmlsoap.org/wsdl/soap/"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #da70d6"&gt;xmlns&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;s&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"http://www.w3.org/2001/XMLSchema"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #da70d6"&gt;xmlns&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;s0&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #da70d6"&gt;xmlns&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;soapenc&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"http://schemas.xmlsoap.org/soap/encoding/"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #da70d6"&gt;xmlns&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;wsaw&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"http://www.w3.org/2006/05/addressing/wsdl"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #b8860b"&gt;targetNamespace&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #b8860b"&gt;xmlns&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"http://schemas.xmlsoap.org/wsdl/"&lt;/SPAN&gt;
&amp;gt;

  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;types&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;schema&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;elementFormDefault&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"qualified"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;targetNamespace&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;&amp;gt;

      &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Registration"&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
          &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
            &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;minOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;maxOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"registrationXml"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s:string"&lt;/SPAN&gt; /&amp;gt;
          &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
        &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"RegistrationResponse"&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
          &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
            &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;minOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;maxOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"RegistrationResult"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s:string"&lt;/SPAN&gt; /&amp;gt;
          &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
        &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt;&amp;gt;

      &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Query"&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
          &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
            &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;minOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;maxOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"queryXml"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s:string"&lt;/SPAN&gt; /&amp;gt;
          &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
        &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"QueryResponse"&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
          &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
            &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;minOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;maxOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"QueryResult"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s:string"&lt;/SPAN&gt; /&amp;gt;
          &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
        &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt;&amp;gt;

      &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Status"&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"StatusResponse"&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
          &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
            &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;minOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"0"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;maxOccurs&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"StatusResult"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s:string"&lt;/SPAN&gt; /&amp;gt;
          &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;sequence&lt;/SPAN&gt;&amp;gt;
        &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;complexType&lt;/SPAN&gt;&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;element&lt;/SPAN&gt;&amp;gt;

    &amp;lt;/&lt;SPAN style="COLOR: #da70d6"&gt;s&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;schema&lt;/SPAN&gt;&amp;gt;
  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;types&lt;/SPAN&gt;&amp;gt;


  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"RegistrationSoapIn"&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;part&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"parameters"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;element&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:Registration"&lt;/SPAN&gt; /&amp;gt;
  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt;&amp;gt;
  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"RegistrationSoapOut"&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;part&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"parameters"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;element&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:RegistrationResponse"&lt;/SPAN&gt; /&amp;gt;
  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt;&amp;gt;

  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"QuerySoapIn"&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;part&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"parameters"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;element&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:Query"&lt;/SPAN&gt; /&amp;gt;
  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt;&amp;gt;
  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"QuerySoapOut"&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;part&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"parameters"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;element&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:QueryResponse"&lt;/SPAN&gt; /&amp;gt;
  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt;&amp;gt;

  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"StatusSoapIn"&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;part&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"parameters"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;element&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:Status"&lt;/SPAN&gt; /&amp;gt;
  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt;&amp;gt;
  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"StatusSoapOut"&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;part&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"parameters"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;element&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:StatusResponse"&lt;/SPAN&gt; /&amp;gt;
  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;message&lt;/SPAN&gt;&amp;gt;

  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;portType&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"IResearchServiceSoap"&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Registration"&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;input&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b8860b"&gt;message&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:RegistrationSoapIn"&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #da70d6"&gt;wsaw&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;Action&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search/Registration"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;output&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;message&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:RegistrationSoapOut"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #da70d6"&gt;wsaw&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;Action&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;""&lt;/SPAN&gt; /&amp;gt;
    &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt;&amp;gt;

    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Query"&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;input&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b8860b"&gt;message&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:QuerySoapIn"&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #da70d6"&gt;wsaw&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;Action&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search/Query"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;output&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;message&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:QuerySoapOut"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #da70d6"&gt;wsaw&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;Action&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;""&lt;/SPAN&gt; /&amp;gt;
    &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt;&amp;gt;

    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Status"&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;input&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b8860b"&gt;message&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:StatusSoapIn"&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #da70d6"&gt;wsaw&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;Action&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search/Status"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;output&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;message&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:StatusSoapOut"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #da70d6"&gt;wsaw&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #b8860b"&gt;Action&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;""&lt;/SPAN&gt; /&amp;gt;
    &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt;&amp;gt;

    &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt;&amp;gt;

  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;portType&lt;/SPAN&gt;&amp;gt;

  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;binding&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"ResearchServiceSoap"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"s0:IResearchServiceSoap"&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;binding&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;transport&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"http://schemas.xmlsoap.org/soap/http"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"document"&lt;/SPAN&gt; /&amp;gt;

    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Registration"&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;soapAction&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search/Registration"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"document"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;input&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;body&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;use&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"literal"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;input&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;output&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;body&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;use&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"literal"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;output&lt;/SPAN&gt;&amp;gt;
    &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt;&amp;gt;

    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Query"&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;soapAction&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search/Query"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"document"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;input&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;body&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;use&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"literal"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;input&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;output&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;body&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;use&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"literal"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;output&lt;/SPAN&gt;&amp;gt;
    &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt;&amp;gt;

    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Status"&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;soapAction&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search/Status"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;style&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"document"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;input&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;body&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;use&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"literal"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;input&lt;/SPAN&gt;&amp;gt;
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;output&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="COLOR: #da70d6"&gt;soap&lt;/SPAN&gt;:&lt;SPAN style="COLOR: #0000ff"&gt;body&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;use&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"literal"&lt;/SPAN&gt; /&amp;gt;
      &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;output&lt;/SPAN&gt;&amp;gt;
    &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;operation&lt;/SPAN&gt;&amp;gt;


  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;binding&lt;/SPAN&gt;&amp;gt;

&amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;definitions&lt;/SPAN&gt;&amp;gt;
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;Ok, starting with that WSDL, given to us by Microsoft Office, we now want to build a service that implements that WSDL, and we want to build it in WCF. We start with the &lt;A href="http://msdn.microsoft.com/en-us/library/aa347733.aspx"&gt;svcutil.exe tool&lt;/A&gt;, which is shipped with the .NET SDK v3.0 , or later. &lt;/P&gt;
&lt;P&gt;Continuing on with the thought from above: most people have a server-centric design perspective when it comes to web services; most people think the server comes first, then you build the clients...The svcutil.exe tool is also guilty of that.&amp;nbsp; In fact there is &lt;A class="" href="http://msdn.microsoft.com/en-us/library/aa751905.aspx" mce_href="http://msdn.microsoft.com/en-us/library/aa751905.aspx"&gt;documentation that describes how to build a client using the svcutil.exe tool&lt;/A&gt;, but as far as I know there is no doc that describes how to create a WCF service from&amp;nbsp;a WSDL file&amp;nbsp;using the&amp;nbsp;svcutil.exe tool. We're going to fix that. Despite the fact that there is no doc for this, it is in fact a supported scenario.&amp;nbsp; Constructing the service starting from the WSDL works. &lt;/P&gt;
&lt;P&gt;Here's how you generate a server-side "stub" and the interface for that WSDL:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Consolas; Courier: "&gt;c:\netsdk3.0\bin\svcutil.exe /language:C# /out:IResearchService.cs /n:*,Ionic.Samples.Webservices.Sep24 ResearchService.wsdl &lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;On the command line, I specify the output file, the language, and also the WSDL file itself.&amp;nbsp; If there are external XSD files, you will need to specify those, too.&amp;nbsp;In this case, the entire contract is contained within a single WSDL file.&amp;nbsp; The last interesting bit is the /n switch, which I use to specify the namespace for all the generated classes. Without this switch the interface and the Data Access Objects are all generated into the default (global::) namespace, which I don't like.&amp;nbsp; &lt;/P&gt;
&lt;P mce_keep="true"&gt;You can see that I reference the .NET SDK v3.0 directory for the svcutil.exe tool.&amp;nbsp; WCF first shipped in the .NET SDK v3.0.&amp;nbsp; Even if you have .NET SDK 3.5 installed, (or Visual Studio 2008), you will still use the svcutil.exe from .NET 3.0.&amp;nbsp; This is because of the russian-doll model of releases that .NET 2.0, 3.0 and 3.5 are. &lt;/P&gt;
&lt;P mce_keep="true"&gt;Now, this is a command line, which is definitely not a GUI.&amp;nbsp; But you can teach Visual Studio to do this for you. To do this, you need to go to the Tools menu, and select External Tools.&amp;nbsp; Then click Add, and specify these settings for the svcutil tool:&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://blogs.msdn.com/blogfiles/dotnetinterop/092308_0435_Xxx11.png" mce_src="http://blogs.msdn.com/blogfiles/dotnetinterop/092308_0435_Xxx11.png"&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Of course you have to specify the relevant path for the .NET SDK V3.0, for your installation.&amp;nbsp; Regardless whether you run svcutil.exe from an MSbuild file, or from Visual Studio, here's what the generated interface looks like: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;&lt;PRE&gt;&lt;SPAN&gt;    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
&lt;/SPAN&gt;    [&lt;SPAN style="COLOR: #5f9ea0"&gt;System&lt;/SPAN&gt;.&lt;SPAN style="COLOR: #5f9ea0"&gt;ServiceModel&lt;/SPAN&gt;.ServiceContractAttribute(Namespace=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;,&lt;BR&gt;        ConfigurationName=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Ionic.Samples.Webservices.Sep24.IResearchServiceSoap"&lt;/SPAN&gt;)]
    &lt;SPAN style="COLOR: #a020f0"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #a020f0"&gt;interface&lt;/SPAN&gt; &lt;SPAN style="COLOR: #228b22"&gt;IResearchServiceSoap&lt;/SPAN&gt;
    {
        
        &lt;SPAN&gt;[System.ServiceModel.OperationContractAttribute(Action="urn:Microsoft.Search/Registration",
            ReplyAction="")]
&lt;/SPAN&gt;        [&lt;SPAN style="COLOR: #5f9ea0"&gt;System&lt;/SPAN&gt;.&lt;SPAN style="COLOR: #5f9ea0"&gt;ServiceModel&lt;/SPAN&gt;.XmlSerializerFormatAttribute()]
        &lt;SPAN style="COLOR: #228b22"&gt;string&lt;/SPAN&gt; Registration(&lt;SPAN style="COLOR: #228b22"&gt;string&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;registrationXml&lt;/SPAN&gt;);
        
        &lt;SPAN&gt;[System.ServiceModel.OperationContractAttribute(Action="urn:Microsoft.Search/Query",
            ReplyAction="")]
&lt;/SPAN&gt;        [&lt;SPAN style="COLOR: #5f9ea0"&gt;System&lt;/SPAN&gt;.&lt;SPAN style="COLOR: #5f9ea0"&gt;ServiceModel&lt;/SPAN&gt;.XmlSerializerFormatAttribute()]
        &lt;SPAN style="COLOR: #228b22"&gt;string&lt;/SPAN&gt; Query(&lt;SPAN style="COLOR: #228b22"&gt;string&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;queryXml&lt;/SPAN&gt;);
        
        &lt;SPAN&gt;[System.ServiceModel.OperationContractAttribute(Action="urn:Microsoft.Search/Status",
            ReplyAction="")]
&lt;/SPAN&gt;        [&lt;SPAN style="COLOR: #5f9ea0"&gt;System&lt;/SPAN&gt;.&lt;SPAN style="COLOR: #5f9ea0"&gt;ServiceModel&lt;/SPAN&gt;.XmlSerializerFormatAttribute()]
        &lt;SPAN style="COLOR: #228b22"&gt;string&lt;/SPAN&gt; Status();
        
    }
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;The Office Research Service interface&amp;nbsp;is a bit of a bummer, because the operations on this service interface just exchange strings. No complex types here.&amp;nbsp; But trust me, it works the same if you use complex types in the interface.&amp;nbsp; In that case, the output source file will include a .NET&amp;nbsp;DataContract definition for the various complex types, along with XML namespace settings and so on. &amp;nbsp;The silly thing is that the Office Research Service does actually send back XML.&amp;nbsp; But rather than use xsd:anyType to allow any XML, or even a strictly-specified XML element, the office app just specifies a string. In effect, the XML is encoded as a string.&amp;nbsp; When&amp;nbsp;implementing the service, you would actually instantiate an XmlDocument and load in the string you get passed, if you know what I mean.&amp;nbsp; This is normally something the web services runtime would do for you, if you specify your WSDL that way.&amp;nbsp; But Office did not do that.&amp;nbsp; &lt;/P&gt;
&lt;P mce_keep="true"&gt;Ok, moving on.... Now, If you are sharp-eyed, you will notice that the command line to generate the server-side stub and interface is the same command line you would use for the Client proxy.&amp;nbsp; And you're right. In fact if you look in the generated file you will find some client-specific proxy classes.&amp;nbsp;No problem with any of that. For the client we need those proxy classes, but for the server we don't. In a server-specific project, that generated code will remain unused, or of course you could manually remove it from the generated file. &lt;/P&gt;
&lt;P mce_keep="true"&gt;At this point, you have the interface.&amp;nbsp; Now you need the implementation. In Visual Studio, if you begin to type in a class definition, and then type in a colon and specify the name of an interface, you can right click on that interface and ask Visual Studio to generate method stubs for all the interface methods.&amp;nbsp;Perfect.&amp;nbsp;&amp;nbsp; As well, you will need to decorate your WCF Service class with the ServiceBehavior attribute. &amp;nbsp; It looks like this: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;&lt;PRE&gt;    [ServiceBehavior(Name="WcfResearchLibrary",
                     Namespace=&lt;SPAN style="COLOR: #bc8f8f"&gt;"urn:Microsoft.Search"&lt;/SPAN&gt;,
                     IncludeExceptionDetailInFaults=&lt;SPAN style="COLOR: #5f9ea0"&gt;true&lt;/SPAN&gt;)]
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;After that, you fill in the implementation for those methods.&amp;nbsp; Then you need to consider the service host for your app.&amp;nbsp; If it will run in IIS, then you code up a .svc file;&amp;nbsp; if you want to host it in a console app, then you use some of the boilerplate I mentioned in &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/09/22/custom-service-config-file-for-a-wcf-service-hosted-in-iis.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/09/22/custom-service-config-file-for-a-wcf-service-hosted-in-iis.aspx"&gt;a previous post&lt;/A&gt;. And so on.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Then you need to deal with the configuration settings, another &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/09/22/custom-service-config-file-for-a-wcf-service-hosted-in-iis.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/09/22/custom-service-config-file-for-a-wcf-service-hosted-in-iis.aspx"&gt;issue I dealt with in the previous post&lt;/A&gt;. &amp;nbsp;And that's pretty much it.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;You have now coded a WCF Service using WSDL-First design principles.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8961888" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WSDL/default.aspx">WSDL</category></item><item><title>Flatten your WSDL with this Custom ServiceHost for WCF</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/09/23/flatten-your-wsdl-with-this-custom-servicehost-for-wcf.aspx</link><pubDate>Tue, 23 Sep 2008 18:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8960261</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8960261.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8960261</wfw:commentRss><description>&lt;P&gt;Yesterday I mentioned using a custom service host to flatten the WSDL that is generated by a WCF service.&amp;nbsp; This is &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2007/05/10/improving-wcf-interoperability.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2007/05/10/improving-wcf-interoperability.aspx"&gt;something Christian showed us all how to do&lt;/A&gt; a long while ago, to improve interoperability between WCF-implemented services and consumers written on other technology stacks.&amp;nbsp; Flattening WSDL is important for Interop purposes becausse many tools don't digest modular WSDL very well.&amp;nbsp; When I say modular WSDL, I mean WSDL that imports other WSDL's or XSDs.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I realized that I had never actually published the code for my custom WCF&amp;nbsp;service host that flattens WSDL.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;So here it is. &lt;SPAN style="COLOR: red"&gt;&lt;EM&gt;[updated 146pm US/Pacific time based on Natasa's comment]&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;
&lt;DIV style="FONT-SIZE: 9pt; BACKGROUND: white; COLOR: black; FONT-FAMILY: Consolas"&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Collections;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Collections.Generic;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.ServiceModel.Channels;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.ServiceModel.Description;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.ServiceModel.Dispatcher;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Xml.Schema;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; ServiceDescription = System.Web.Services.Description.ServiceDescription;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; Thinktecture.ServiceModel&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;{&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;FlatWsdl&lt;/SPAN&gt; : IWsdlExportExtension, IEndpointBehavior&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ExportContract(WsdlExporter exporter, WsdlContractConversionContext context) { }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ExportEndpoint(WsdlExporter exporter, WsdlEndpointConversionContext context)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; XmlSchemaSet schemaSet = exporter.GeneratedXmlSchemas;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (WsdlDescription wsdl &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; exporter.GeneratedWsdlDocuments)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;XmlSchema&amp;gt; importsList = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;XmlSchema&amp;gt;();&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (XmlSchema schema &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; wsdl.Types.Schemas)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; AddImportedSchemas(schema, schemaSet, importsList);&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (importsList.Count == 0)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsdl.Types.Schemas.Clear();&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (XmlSchema schema &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; importsList)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; RemoveXsdImports(schema);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wsdl.Types.Schemas.Add(schema);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; AddImportedSchemas(XmlSchema schema, XmlSchemaSet schemaSet, &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;XmlSchema&amp;gt; importsList)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (XmlSchemaImport import &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; schema.Includes)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: #2b91af"&gt;ICollection&lt;/SPAN&gt; realSchemas =&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; schemaSet.Schemas(import.Namespace);&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (XmlSchema ixsd &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; realSchemas)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!importsList.Contains(ixsd))&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; importsList.Add(ixsd);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; AddImportedSchemas(ixsd, schemaSet, importsList);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; RemoveXsdImports(XmlSchema schema)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = 0; i &amp;lt; schema.Includes.Count; i++)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (schema.Includes[i] &lt;SPAN style="COLOR: blue"&gt;is&lt;/SPAN&gt; XmlSchemaImport)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; schema.Includes.RemoveAt(i--);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters) { }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) { }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) { }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Validate(ServiceEndpoint endpoint) { }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;FlatWsdlServiceHost&lt;/SPAN&gt; : System.ServiceModel.ServiceHost&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; FlatWsdlServiceHost() { }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; FlatWsdlServiceHost(&lt;SPAN style="COLOR: #2b91af"&gt;Type&lt;/SPAN&gt; serviceType, &lt;SPAN style="COLOR: blue"&gt;params&lt;/SPAN&gt; Uri[] baseAddresses)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;(serviceType, baseAddresses) { }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; FlatWsdlServiceHost(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; singletonInstance, &lt;SPAN style="COLOR: blue"&gt;params&lt;/SPAN&gt; Uri[] baseAddresses)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;(singletonInstance, baseAddresses) { }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ApplyConfiguration()&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"ApplyConfiguration (thread {0})"&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; System.Threading.&lt;SPAN style="COLOR: #2b91af"&gt;Thread&lt;/SPAN&gt;.CurrentThread.ManagedThreadId);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.ApplyConfiguration();&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; InjectFlatWsdlExtension();&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; InjectFlatWsdlExtension()&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (ServiceEndpoint endpoint &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.Description.Endpoints)&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; endpoint.Behaviors.Add(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; FlatWsdl());&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;sealed&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;FlatWsdlServiceHostFactory&lt;/SPAN&gt; : System.ServiceModel.Activation.ServiceHostFactory&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; System.ServiceModel.ServiceHostBase CreateServiceHost(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; constructorString, Uri[] baseAddresses)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.CreateServiceHost(constructorString, baseAddresses);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; System.ServiceModel.ServiceHost CreateServiceHost(&lt;SPAN style="COLOR: #2b91af"&gt;Type&lt;/SPAN&gt; serviceType, Uri[] baseAddresses)&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; FlatWsdlServiceHost(serviceType, baseAddresses);&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P style="MARGIN: 0px"&gt;}&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And to use this, you would specify something like this in your .svc file: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;&lt;PRE&gt;&amp;lt;%&lt;SPAN style="COLOR: blue"&gt;@&lt;/SPAN&gt; &lt;SPAN style="COLOR: #a31515"&gt;ServiceHost&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: red"&gt;Language&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="C#"&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: red"&gt;Factory&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Thinktecture.ServiceModel.FlatWsdlServiceHostFactory"&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: red"&gt;Service&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Ionic.Samples.Webservices.WcfService1"&lt;/SPAN&gt;%&amp;gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8960261" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WSDL/default.aspx">WSDL</category></item><item><title>Custom Config file for a WCF Service hosted in IIS</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/09/22/custom-service-config-file-for-a-wcf-service-hosted-in-iis.aspx</link><pubDate>Mon, 22 Sep 2008 17:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8960243</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8960243.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8960243</wfw:commentRss><description>&lt;p&gt;I am constantly developing new WCF services to try out various techniques,&amp;nbsp;ideas, scenarios. &lt;/p&gt;
&lt;p&gt;Many times for these quickie WCF applications I will just use a text editor to write the code.&amp;nbsp; As you know &lt;a href="http://msdn.microsoft.com/en-us/library/ms730158.aspx" class="" mce_href="http://msdn.microsoft.com/en-us/library/ms730158.aspx"&gt;there are multiple options for hosting your WCF services&lt;/a&gt;.&amp;nbsp; For these quick apps, I will typically write a simple custom console host for the WCF service, what is sometimes called "self-hosting" the WCF service.&amp;nbsp; You've seen some form of this&amp;nbsp;boilerplate code many times: &lt;/p&gt;
&lt;div style="border: 1pt solid windowtext; padding: 2pt; background: white none repeat scroll 0% 0%; font-size: 9pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; line-height: 98%; font-family: Consolas,Courier New;"&gt;&lt;pre&gt;        &lt;span style="color: rgb(160, 32, 240);"&gt;public static void Main()&lt;br&gt;&lt;/span&gt;        {&lt;br&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;string&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;addressRoot&lt;/span&gt;= &lt;span style="color: rgb(188, 143, 143);"&gt;"http://localhost:5555/"&lt;/span&gt;;&lt;br&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;string&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;endpointSuffix&lt;/span&gt;= &lt;span style="color: rgb(188, 143, 143);"&gt;"MyWcfService"&lt;/span&gt;;&lt;br&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;string&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;endpointAddress&lt;/span&gt;= addressRoot + endpointSuffix;&lt;br&gt;&lt;br&gt;            &lt;span style="color: rgb(178, 34, 34);"&gt;// &lt;/span&gt;&lt;span style="color: rgb(178, 34, 34);"&gt;get the type we are hosting &lt;br&gt;&lt;/span&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(34, 139, 34);"&gt;Type&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;t1&lt;/span&gt; = &lt;span style="color: rgb(160, 32, 240);"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(95, 158, 160);"&gt;Ionic&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Samples&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Webservices&lt;/span&gt;.MyWcfService);&lt;br&gt;&lt;br&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;var&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;host&lt;/span&gt; = &lt;br&gt;                &lt;span style="color: rgb(160, 32, 240);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;ServiceModel&lt;/span&gt;.ServiceHost(t1,&lt;br&gt;                                                    &lt;span style="color: rgb(160, 32, 240);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.Uri(endpointAddress));&lt;br&gt;&lt;br&gt;            &lt;span style="color: rgb(178, 34, 34);"&gt;// &lt;/span&gt;&lt;span style="color: rgb(178, 34, 34);"&gt;Create the binding&lt;br&gt;&lt;/span&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;var&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;basicBinding&lt;/span&gt; = &lt;span style="color: rgb(160, 32, 240);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;ServiceModel&lt;/span&gt;.BasicHttpBinding();&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;basicBinding&lt;/span&gt;.Namespace = &lt;span style="color: rgb(188, 143, 143);"&gt;"urn:Ionic.Samples"&lt;/span&gt;;&lt;br&gt;&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;host&lt;/span&gt;.AddServiceEndpoint&lt;br&gt;                (&lt;span style="color: rgb(160, 32, 240);"&gt;typeof&lt;/span&gt;(IService),&lt;br&gt;                 basicBinding, &lt;br&gt;                 &lt;span style="color: rgb(188, 143, 143);"&gt;""&lt;/span&gt;);&lt;br&gt;&lt;br&gt;            &lt;span style="color: rgb(178, 34, 34);"&gt;// &lt;/span&gt;&lt;span style="color: rgb(178, 34, 34);"&gt;add the "get metadata" behavior &lt;br&gt;&lt;/span&gt;            &lt;span style="color: rgb(178, 34, 34);"&gt;// &lt;/span&gt;&lt;span style="color: rgb(178, 34, 34);"&gt;This will allow the service to emit WSDL when tickled at the proper HTTP endpoint&lt;br&gt;&lt;/span&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;var&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;smb&lt;/span&gt;= &lt;span style="color: rgb(160, 32, 240);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;ServiceModel&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Description&lt;/span&gt;.ServiceMetadataBehavior();&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;smb&lt;/span&gt;.HttpGetEnabled = &lt;span style="color: rgb(95, 158, 160);"&gt;true&lt;/span&gt;;&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;smb&lt;/span&gt;.HttpGetUrl = &lt;span style="color: rgb(160, 32, 240);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.Uri(endpointAddress);&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;host&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Description&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Behaviors&lt;/span&gt;.Add(smb);&lt;br&gt;&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Console&lt;/span&gt;.WriteLine();&lt;br&gt;&lt;br&gt;            &lt;span style="color: rgb(178, 34, 34);"&gt;// &lt;/span&gt;&lt;span style="color: rgb(178, 34, 34);"&gt;Open the ServiceHost to create listeners and start listening for messages&lt;br&gt;&lt;/span&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;host&lt;/span&gt;.Open();&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(188, 143, 143);"&gt;"Service implementation: "&lt;/span&gt; + &lt;span style="color: rgb(95, 158, 160);"&gt;t1&lt;/span&gt;.ToString());&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(188, 143, 143);"&gt;"Service Address: {0}"&lt;/span&gt;, endpointAddress);&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(188, 143, 143);"&gt;"The service is ready."&lt;/span&gt;);&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Console&lt;/span&gt;.WriteLine();&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: rgb(188, 143, 143);"&gt;"Press &amp;lt;ENTER&amp;gt; to terminate the service."&lt;/span&gt;);&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Console&lt;/span&gt;.WriteLine();&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Console&lt;/span&gt;.ReadLine();&lt;br&gt;&lt;br&gt;            &lt;span style="color: rgb(178, 34, 34);"&gt;// &lt;/span&gt;&lt;span style="color: rgb(178, 34, 34);"&gt;Close to shutdown the service&lt;br&gt;&lt;/span&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;host&lt;/span&gt;.Close();&lt;br&gt;        }&lt;br&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p mce_keep="true"&gt;But sometimes I need the WCF service to run for a longer period of time, maybe permanently.&amp;nbsp; This is where the IIS host makes sense - for security and lifecycle purposes.&amp;nbsp; And the ASP.NET deployment stuff works nicely for WCF services - I copy the Interface (IService.cs) and the Service Implementation code to the App_Code directory of IIS, and then copy the .svc file over, and I'm nearly there.&amp;nbsp; The only thing the IIS-hosted service lacks now is the service configuration.&amp;nbsp; &lt;/p&gt;
&lt;p mce_keep="true"&gt;Deploying to IIS, I don't get to use my boilerplate ServiceHost code as above.&amp;nbsp; Which means I don't have the programmatic control over the endpoint and the ServiceMetadataBehavior, and I don't get to specify an endpoint and any behaviors.&amp;nbsp; So of course I have to&amp;nbsp;embed the relevant&amp;nbsp;configuration information in the .config file, which in the case of IIS hosting, is the web.config file.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p mce_keep="true"&gt;A problem comes in when hosting multiple WCF services in a single IIS virtual directory:&amp;nbsp; Each Service gets its own individual .svc file, but all services share a single web.config file.&amp;nbsp; If I update a service, then I need to modify that single file.&amp;nbsp; If I add a service, I need to edit the file.&amp;nbsp; If I remove a service, I need to edit the file.&amp;nbsp; And in each case the edits and changes for one service could affect the other services, if the edits are not done properly.&amp;nbsp; &lt;/p&gt;
&lt;p mce_keep="true"&gt;Ideally I'd like the IIS-hosted WCF service to have its own configuration, independent of any other services running from that same vdir.&amp;nbsp; The .svc file is completely independent.&amp;nbsp; Why can't the configuration also be independent?&amp;nbsp; How can I do this? &lt;/p&gt;
&lt;p mce_keep="true"&gt;I looked around and found the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicehostbase.applyconfiguration.aspx" class="" mce_href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicehostbase.applyconfiguration.aspx"&gt;ServiceHostBase.ApplyConfiguration&lt;/a&gt; method.&amp;nbsp; If I construct a custom service host, then I can override the ApplyConfiguration method and load my service configuration from... anywhere.&amp;nbsp;&amp;nbsp; I decided to establish a simple convention - I will look for a file in the server directory called &amp;lt;ServiceName&amp;gt;.config.&amp;nbsp; This is not &amp;lt;AssemblyName&amp;gt;.config, which is the .NET default.&amp;nbsp; In this case the assembly is likely going to be dynamically generated and named.&amp;nbsp; So using the&amp;nbsp;assembly name to find the config file is probably not right.&amp;nbsp; The next option is to use the Service Name; this is something you specify in code in the [&lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.aspx" class="" mce_href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.aspx"&gt;ServiceBehavior&lt;/a&gt;] attribute.&amp;nbsp; Assuming you select a unique name for each service,&amp;nbsp;that name ought to be useful for uniquifying the configuration file. &amp;nbsp;&lt;/p&gt;
&lt;p mce_keep="true"&gt;Then, it is a simple matter of loading in the configuration file, within the custom ServiceHost.&amp;nbsp;&amp;nbsp;This bit of black magic does the trick for me:&amp;nbsp;&lt;/p&gt;
&lt;div style="border: 1pt solid windowtext; padding: 2pt; background: white none repeat scroll 0% 0%; font-size: 9pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; line-height: 98%; font-family: Consolas,Courier New;"&gt;&lt;pre&gt;        &lt;span style="color: rgb(160, 32, 240);"&gt;protected override void ApplyConfiguration()&lt;br&gt;&lt;/span&gt;        {&lt;br&gt;&lt;br&gt;            &lt;span style="color: rgb(178, 34, 34);"&gt;// &lt;/span&gt;&lt;span style="color: rgb(178, 34, 34);"&gt;generate the name of the custom configFile, from the service name:&lt;br&gt;&lt;/span&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;string&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;configFilename&lt;/span&gt; = &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;IO&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Path&lt;/span&gt;.Combine ( physicalPath,&lt;br&gt;                                                             &lt;span style="color: rgb(95, 158, 160);"&gt;String&lt;/span&gt;.Format(&lt;span style="color: rgb(188, 143, 143);"&gt;"{0}.config"&lt;/span&gt;, &lt;span style="color: rgb(160, 32, 240);"&gt;this&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Description&lt;/span&gt;.Name));&lt;br&gt;            &lt;br&gt;            &lt;span style="color: rgb(160, 32, 240);"&gt;if&lt;/span&gt; (&lt;span style="color: rgb(95, 158, 160);"&gt;string&lt;/span&gt;.IsNullOrEmpty(configFilename) || !&lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;IO&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;File&lt;/span&gt;.Exists(configFilename))&lt;br&gt;                &lt;span style="color: rgb(160, 32, 240);"&gt;base&lt;/span&gt;.ApplyConfiguration();&lt;br&gt;            &lt;span style="color: rgb(160, 32, 240);"&gt;else&lt;/span&gt;&lt;br&gt;                LoadConfigFromCustomLocation(configFilename);&lt;br&gt;&lt;br&gt;        } &lt;br&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p mce_keep="true"&gt;Then there is some supporting logic, to get the physical path and to actually load the configuration: &lt;/p&gt;
&lt;div style="border: 1pt solid windowtext; padding: 2pt; background: white none repeat scroll 0% 0%; font-size: 9pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; line-height: 98%; font-family: Consolas,Courier New;"&gt;&lt;pre&gt;        &lt;span style="color: rgb(160, 32, 240);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(34, 139, 34);"&gt;string&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;_physicalPath&lt;/span&gt; = &lt;span style="color: rgb(95, 158, 160);"&gt;null&lt;/span&gt;;&lt;br&gt;        &lt;span style="color: rgb(160, 32, 240);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(34, 139, 34);"&gt;string&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;physicalPath&lt;/span&gt;&lt;br&gt;        {&lt;br&gt;            &lt;span style="color: rgb(160, 32, 240);"&gt;get&lt;/span&gt; &lt;br&gt;            {&lt;br&gt;                &lt;span style="color: rgb(160, 32, 240);"&gt;if&lt;/span&gt; (_physicalPath == &lt;span style="color: rgb(95, 158, 160);"&gt;null&lt;/span&gt;)&lt;br&gt;                {&lt;br&gt;                    &lt;span style="color: rgb(178, 34, 34);"&gt;// &lt;/span&gt;&lt;span style="color: rgb(178, 34, 34);"&gt;if hosted in IIS&lt;br&gt;&lt;/span&gt;                    _physicalPath = &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Web&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Hosting&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;HostingEnvironment&lt;/span&gt;.ApplicationPhysicalPath;&lt;br&gt;                    &lt;span style="color: rgb(160, 32, 240);"&gt;if&lt;/span&gt; (&lt;span style="color: rgb(95, 158, 160);"&gt;String&lt;/span&gt;.IsNullOrEmpty(_physicalPath))&lt;br&gt;                    {&lt;br&gt;                        &lt;span style="color: rgb(178, 34, 34);"&gt;// &lt;/span&gt;&lt;span style="color: rgb(178, 34, 34);"&gt;for hosting outside of IIS&lt;br&gt;&lt;/span&gt;                        _physicalPath= &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;IO&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Directory&lt;/span&gt;.GetCurrentDirectory();&lt;br&gt;                    }&lt;br&gt;                }&lt;br&gt;                &lt;span style="color: rgb(160, 32, 240);"&gt;return&lt;/span&gt; _physicalPath;&lt;br&gt;            }&lt;br&gt;        }&lt;br&gt;&lt;br&gt;        &lt;span style="color: rgb(160, 32, 240);"&gt;private void LoadConfigFromCustomLocation(string configFilename)&lt;br&gt;&lt;/span&gt;        {&lt;br&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;var&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;filemap&lt;/span&gt; = &lt;span style="color: rgb(160, 32, 240);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Configuration&lt;/span&gt;.ExeConfigurationFileMap();&lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;filemap&lt;/span&gt;.ExeConfigFilename = configFilename;&lt;br&gt; &lt;br&gt;            &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Configuration&lt;/span&gt;.&lt;span style="color: rgb(34, 139, 34);"&gt;Configuration&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;config&lt;/span&gt; = &lt;br&gt;                &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Configuration&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;ConfigurationManager&lt;/span&gt;.OpenMappedExeConfiguration&lt;br&gt;                (filemap, &lt;br&gt;                 &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Configuration&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;ConfigurationUserLevel&lt;/span&gt;.None);&lt;br&gt; &lt;br&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;var&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;serviceModel&lt;/span&gt; = &lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;ServiceModel&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Configuration&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;ServiceModelSectionGroup&lt;/span&gt;.GetSectionGroup(config);&lt;br&gt; &lt;br&gt;            &lt;span style="color: rgb(34, 139, 34);"&gt;bool&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;loaded&lt;/span&gt;= &lt;span style="color: rgb(95, 158, 160);"&gt;false&lt;/span&gt;;&lt;br&gt;            &lt;span style="color: rgb(160, 32, 240);"&gt;foreach&lt;/span&gt; (&lt;span style="color: rgb(95, 158, 160);"&gt;System&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;ServiceModel&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Configuration&lt;/span&gt;.&lt;span style="color: rgb(34, 139, 34);"&gt;ServiceElement&lt;/span&gt; &lt;span style="color: rgb(184, 134, 11);"&gt;se&lt;/span&gt; &lt;span style="color: rgb(160, 32, 240);"&gt;in&lt;/span&gt; &lt;span style="color: rgb(95, 158, 160);"&gt;serviceModel&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Services&lt;/span&gt;.Services)&lt;br&gt;            {&lt;br&gt;                &lt;span style="color: rgb(160, 32, 240);"&gt;if&lt;/span&gt;(!loaded)&lt;br&gt;                    &lt;span style="color: rgb(160, 32, 240);"&gt;if&lt;/span&gt; (&lt;span style="color: rgb(95, 158, 160);"&gt;se&lt;/span&gt;.Name == &lt;span style="color: rgb(160, 32, 240);"&gt;this&lt;/span&gt;.&lt;span style="color: rgb(95, 158, 160);"&gt;Description&lt;/span&gt;.ConfigurationName)&lt;br&gt;                    {&lt;br&gt;                        &lt;span style="color: rgb(160, 32, 240);"&gt;base&lt;/span&gt;.LoadConfigurationSection(se);&lt;br&gt;                        loaded= &lt;span style="color: rgb(95, 158, 160);"&gt;true&lt;/span&gt;;&lt;br&gt;                    }&lt;br&gt;            }&lt;br&gt;            &lt;span style="color: rgb(160, 32, 240);"&gt;if&lt;/span&gt; (!loaded)&lt;br&gt;                &lt;span style="color: rgb(160, 32, 240);"&gt;throw&lt;/span&gt; &lt;span style="color: rgb(160, 32, 240);"&gt;new&lt;/span&gt; ArgumentException(&lt;span style="color: rgb(188, 143, 143);"&gt;"ServiceElement doesn't exist"&lt;/span&gt;);         &lt;br&gt;        }&lt;br&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p mce_keep="true"&gt;And of course to make this work, you will need to specify a custom ServiceHostFactory in the .svc file.&amp;nbsp; The custom service host approach is useful for lots of things; in the past I used it for &lt;a href="http://blogs.msdn.com/dotnetinterop/archive/2007/08/20/improving-wcf-interop-with-websphere-rad-by-controlling-wsdl-generation.aspx" class="" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2007/08/20/improving-wcf-interop-with-websphere-rad-by-controlling-wsdl-generation.aspx"&gt;WSDL-Flattening&lt;/a&gt; or for &lt;a href="http://blogs.msdn.com/dotnetinterop/archive/2007/07/19/interop-between-asmx-and-wcf-services.aspx" class="" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2007/07/19/interop-between-asmx-and-wcf-services.aspx"&gt;modifying namespaces on SOAP payloads&lt;/a&gt;. Of course you can have a single custom service host that combines all those capabilities, if you like. For this post I am focusing only on the config file. &lt;/p&gt;
&lt;div style="border: 1pt solid windowtext; padding: 2pt; background: white none repeat scroll 0% 0%; font-size: 9pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; color: black; line-height: 98%; font-family: Consolas,Courier New;"&gt;&lt;pre&gt;&amp;lt;%@ &lt;span style="color: rgb(163, 21, 21);"&gt;ServiceHost&lt;/span&gt;&lt;br&gt;    &lt;span style="color: red;"&gt;Language&lt;/span&gt;=&lt;span style="color: blue;"&gt;"C#"&lt;/span&gt; &lt;br&gt;    &lt;span style="color: red;"&gt;Debug&lt;/span&gt;=&lt;span style="color: blue;"&gt;"true"&lt;/span&gt; &lt;br&gt;    &lt;span style="color: red;"&gt;Service&lt;/span&gt;=&lt;span style="color: blue;"&gt;"Ionic.Samples.Webservices.Sep20.CustomConfigService"&lt;/span&gt; &lt;br&gt;&lt;br&gt;    &lt;span style="color: red;"&gt;Factory&lt;/span&gt;=&lt;span style="color: blue;"&gt;"Ionic.ServiceModel.ServiceHostFactory"&lt;/span&gt;&lt;br&gt;&lt;br&gt;%&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p mce_keep="true"&gt;For now, the logic that reads in a unique&amp;nbsp;file per service will do, but in the general case I'd like to be able to read the configuration from a remote centralized repository, like a network share or a database.&amp;nbsp; That is something left for the future. &lt;/p&gt;
&lt;p mce_keep="true"&gt;I've attached all the code here in a zipfile. &lt;br&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8960243" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/dotnetinterop/attachment/8960243.ashx" length="10274" type="application/zip" /><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WSDL/default.aspx">WSDL</category></item><item><title>WADL and WSDL and REST, oh my!</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/02/06/wadl-and-wsdl-and-rest-oh-my.aspx</link><pubDate>Wed, 06 Feb 2008 21:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7496003</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/7496003.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=7496003</wfw:commentRss><description>&lt;P&gt;Hernan Garcia made an interesting comment on my post of yesterday:&amp;nbsp; &lt;EM&gt;For REST, there is an alternative to the WSDL in SOAP and it is WADL&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;Good point Mr Garcia - The adoption and practical utility of WADL is worth watching.&amp;nbsp; The question for&amp;nbsp;me&amp;nbsp;becomes whether WADL+REST is actually better than WSDL+SOAP, or just different.&amp;nbsp; Whether REST has succeeded to the extent that it has, &lt;EM&gt;in spite of&lt;/EM&gt; lack of WSDL-like tools, or in fact, &lt;EM&gt;because &lt;/EM&gt;of the lack of WSDL-like tools?&amp;nbsp; Is the appeal of REST that there is no single set of tools, which thus limits the possibility to be overcome by galloping complexity, as some have characterized WS-*?&amp;nbsp; &lt;/P&gt;
&lt;P&gt;All interesting.&amp;nbsp; It is by no means certain that clear answers to these questions will be coming soon, &lt;STRONG&gt;&lt;EM&gt;if at all&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp; Seriously. In 2 years' time the tea leaves may be no clearer on any of these things. &lt;/P&gt;
&lt;P&gt;Which gets me back to my earlier philosophy: the best approach for enterprise architects today is to &lt;EM&gt;think strategically, but act pragmatically&lt;/EM&gt;. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the communication framework built into .NET, Windows Communication Foundation (aka WCF), this is the philosophy we at Microsoft are trying to endorse.&amp;nbsp; It is designed to support REST and SOAP today, as well as other non-standard protocols (via the WCF LOB Adapter SDK), in a single unified programming model.&amp;nbsp;&amp;nbsp;A contrast here is a variety of programming models for different communications protocols; in Java-land what I am thinking is; ECI/EPI for Mainframe and 3270 integration, EJB for transactional comms, JMS for queued comms, JAX-WS for SOAP, JAX-RS for REST, RMI for like-to-like communications.&amp;nbsp; This is hard for any architect or programmer to keep up with.&amp;nbsp; This variety seems to be the result of pragmatic design, rather than strategic design. &amp;nbsp;Each step makes sense by itself. Each API is useful by itself. But all together, there's no cohesiveness.&amp;nbsp; It's overwhelming. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7496003" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Java/default.aspx">Java</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/REST/default.aspx">REST</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/SOAP/default.aspx">SOAP</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WSDL/default.aspx">WSDL</category></item><item><title>WCF and Apache AXIS interop</title><link>http://blogs.msdn.com/dotnetinterop/archive/2007/10/09/wcf-and-apache-axis-interop.aspx</link><pubDate>Tue, 09 Oct 2007 18:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5334571</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/5334571.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=5334571</wfw:commentRss><description>&lt;P&gt;I'm getting back to building and publishing working examples. &lt;/P&gt;
&lt;P&gt;My latest is a working example of a WCF client communicating with an Apache AXIS 1.4 server, using web services.&amp;nbsp; You can find it &lt;A class="" href="http://dinoch.dyndns.org:7070/axis1.4/AboutCtService.jsp" mce_href="http://dinoch.dyndns.org:7070/axis1.4/AboutCtService.jsp"&gt;here&lt;/A&gt;.&amp;nbsp; There's full source code available. &lt;/P&gt;
&lt;P&gt;This one shows complex types with nesting being transferred between AXIS and WCF.&amp;nbsp; There's no Security or Reliability, etc.&amp;nbsp; No MTOM either. &lt;/P&gt;
&lt;P&gt;If you all have requests or suggestions for other examples, let me know. For this particular example, I think one nice enhancement would be to show the raw XML messages being transmitted back and forth.&amp;nbsp; I may do that.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Seems like a higher priority ought to be publishing an AXIS 2.0 service, with some more advanced capabilities (like MTOM); or showing an AXIS client communicating with a WCF service.&amp;nbsp; I'm interested in your input!&lt;/P&gt;
&lt;P&gt;Cheers!&lt;/P&gt;
&lt;P&gt;-Dino&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5334571" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/AXIS/default.aspx">AXIS</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Java/default.aspx">Java</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WSDL/default.aspx">WSDL</category></item><item><title>Improving WCF interop with Websphere/RAD by controlling WSDL Generation</title><link>http://blogs.msdn.com/dotnetinterop/archive/2007/08/20/improving-wcf-interop-with-websphere-rad-by-controlling-wsdl-generation.aspx</link><pubDate>Mon, 20 Aug 2007 21:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4483804</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/4483804.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=4483804</wfw:commentRss><description>&lt;P&gt;I wrote about &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2007/05/10/improving-wcf-interoperability.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2007/05/10/improving-wcf-interoperability.aspx"&gt;Christian's foray into this area a while back&lt;/A&gt;. Now comes news that other people are confronting the same issue, but with Websphere or Rational App Developer. &lt;/P&gt;
&lt;P&gt;Here's the problem: WCF emits WSDL that is modular - the base WSDL file references other WSDLs and XSDs which are external.&amp;nbsp; Christian found out that not all non-.NET tools (such as some PHP libraries he tried) can digest that modular WSDL, and a "flattened" WSDL works better in many cases.&amp;nbsp; This apparently is also true with Rational Application Developer.&amp;nbsp;&amp;nbsp; If you are a WSDL hacker, you can, in 10-20 minutes, take a compound WSDL document and flatten it.&amp;nbsp; But most people are not WSDL hackers and if they are, they don't want to be WSDL hackers. (Trust me on this)&lt;/P&gt;
&lt;P&gt;Ideally, generating flattened WSDL out of WCF would be something you could just "turn on" - so that flat WSDL is automatically generated.&amp;nbsp; In fact, this is exactly what Christian did.&amp;nbsp; Modifying the WCF host so that the auto-generated WSDL is automatically flattened, is pretty simple, and general.&amp;nbsp; This should improve interop with Rational Application Developer significantly. &lt;/P&gt;
&lt;P&gt;By the way, Christian does his flattening trick by using a custom ServiceHost in WCF - the same extensibility point I used to improve interop with ASMX services, which &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2007/07/19/interop-between-asmx-and-wcf-services.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2007/07/19/interop-between-asmx-and-wcf-services.aspx"&gt;I described in a prior post&lt;/A&gt;. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4483804" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Websphere/default.aspx">Websphere</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/IBM/default.aspx">IBM</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Java/default.aspx">Java</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WSDL/default.aspx">WSDL</category></item><item><title>Interop between ASMX and WCF Services</title><link>http://blogs.msdn.com/dotnetinterop/archive/2007/07/19/interop-between-asmx-and-wcf-services.aspx</link><pubDate>Fri, 20 Jul 2007 04:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3965100</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/3965100.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=3965100</wfw:commentRss><description>&lt;P&gt;My esteemed colleague, &lt;A class="" href="http://www.casadehambone.com/" mce_href="http://www.casadehambone.com"&gt;Kevin&lt;/A&gt;, is working on a project where the customer has a bunch of ASP.NET (ASMX) web services, and they are looking at migrating to WCF. The customer's goal is simplicity: in stage 1, they'd like to keep their ASMX files, keep the IIS hosting, but add a .svc file to &lt;EM&gt;also&lt;/EM&gt; host the service also in WCF. In stage 2, they'd like to turn off the ASMX endpoint and use &lt;EM&gt;only&lt;/EM&gt; the WCF (.svc) endpoint. All this while keeping the existing client code unchanged: no new code, no re-compile, nothing. A .NET app with a web service stub generated from wsdl.exe should be able to talk to the new service hosted in WCF. &lt;/P&gt;
&lt;P&gt;This ought to be pretty simple, right? Kevin found an MSDN article on this topic, &lt;A href="http://msdn2.microsoft.com/en-us/library/aa738697.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/aa738697.aspx"&gt;How to: Migrate a ASP.NET Web Service Code to the Windows Communication Foundation&lt;/A&gt;&lt;SPAN style="COLOR: #1f497d"&gt;. &lt;/SPAN&gt;This article seems to work, though it doesn't address the specific requirements for Kevin's customer, which included &lt;EM&gt;simplicity&lt;/EM&gt;.&amp;nbsp; Following this article, which by the way is the "right" way to migrate from ASP.NET to WCF, you essentially re-implement everything in WCF.&amp;nbsp; Isn't there a simpler way?&lt;/P&gt;
&lt;P&gt;What Kevin did was pretty straightforward and sensible, and he thought it should work. He had a simple .ASMX file, which looked like this: &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;SPAN style="BACKGROUND-COLOR: yellow"&gt;&amp;lt;%&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;@&lt;/SPAN&gt; &lt;SPAN style="COLOR: #a31515"&gt;WebService&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;Language&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="C#"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;CodeBehind&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="~/App_Code/CommunicationService.cs"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;Class&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="CommunicationService"&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR: yellow"&gt;%&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;The code-behind file contained the implementation of the service. It looked like this: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;
&lt;P&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;WebService&lt;/SPAN&gt;(Namespace = &lt;SPAN style="COLOR: #a31515"&gt;"urn:namespace1"&lt;/SPAN&gt;)] &lt;BR&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;WebServiceBinding&lt;/SPAN&gt;(ConformsTo = &lt;SPAN style="COLOR: #2b91af"&gt;WsiProfiles&lt;/SPAN&gt;.BasicProfile1_1)] &lt;BR&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CommunicationService&lt;/SPAN&gt; : System.Web.Services.&lt;SPAN style="COLOR: #2b91af"&gt;WebService &lt;/SPAN&gt;&lt;BR&gt;{ &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; CommunicationService() { } &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;[&lt;SPAN style="COLOR: #2b91af"&gt;WebMethod&lt;/SPAN&gt;] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;ComplexType &lt;/SPAN&gt;SendCommunication(&lt;SPAN style="COLOR: #2b91af"&gt;CommunicationEntity&lt;/SPAN&gt; Request) {...}&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;... &lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Kevin created a new .svc file for the WCF stuff: &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;SPAN style="BACKGROUND-COLOR: yellow"&gt;&amp;lt;%&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;@&lt;/SPAN&gt; &lt;SPAN style="COLOR: #a31515"&gt;ServiceHost&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;Language&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="C#"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;CodeBehind&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="~/App_Code/CommunicationService.cs"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;Service&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="CommunicationService"&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR: yellow"&gt;%&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;And then he decorated the existing web service implementation class with the appropriate WCF attributes, something like this: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;
&lt;P&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;WebService&lt;/SPAN&gt;(Namespace = &lt;SPAN style="COLOR: #a31515"&gt;"urn:namespace1"&lt;/SPAN&gt;)] &lt;BR&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;WebServiceBinding&lt;/SPAN&gt;(ConformsTo = &lt;SPAN style="COLOR: #2b91af"&gt;WsiProfiles&lt;/SPAN&gt;.BasicProfile1_1)] &lt;BR&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;ServiceContract&lt;/SPAN&gt;(Namespace= &lt;SPAN style="COLOR: #a31515"&gt;"urn:namespace1"&lt;/SPAN&gt;)] &lt;BR&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;XmlSerializerFormat&lt;/SPAN&gt;] &lt;BR&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;CommunicationService&lt;/SPAN&gt; : System.Web.Services.&lt;SPAN style="COLOR: #2b91af"&gt;WebService &lt;/SPAN&gt;&lt;BR&gt;{&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; CommunicationService() { } &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;[&lt;SPAN style="COLOR: #2b91af"&gt;WebMethod&lt;/SPAN&gt;] &lt;BR&gt;&amp;nbsp;&amp;nbsp;[&lt;SPAN style="COLOR: #2b91af"&gt;OperationContract&lt;/SPAN&gt;(Action= &lt;SPAN style="COLOR: #a31515"&gt;"SoapAction1Here"&lt;/SPAN&gt;)] &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;ComplexType &lt;/SPAN&gt;SendCommunication(&lt;SPAN style="COLOR: #2b91af"&gt;CommunicationEntity&lt;/SPAN&gt; Request) {...} &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;...&lt;BR&gt;&lt;BR&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;The &lt;A href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.operationcontractattribute.aspx"&gt;OperationContract&lt;/A&gt; attribute decorates the service method, like &lt;A href="http://msdn2.microsoft.com/en-us/library/28a537td.aspx"&gt;WebMethod&lt;/A&gt; does for ASP.NET. The &lt;A href="http://msdn2.microsoft.com/en-us/library/ms586952.aspx"&gt;XmlSerializerFormat&lt;/A&gt; attribute on the service class tells WCF to not use the default DataContract serialization behavior, but instead to use the XmlSerializer. This, ostensibly, to maintain consistency and compatibility with data types that have been decorated with the XmlSerializer attributes, like &lt;A href="http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmlelementattribute.aspx"&gt;XmlElement&lt;/A&gt;, &lt;A href="http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmlignoreattribute.aspx"&gt;XmlIgnore&lt;/A&gt;, &lt;A href="http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmltypeattribute.aspx"&gt;XmlType&lt;/A&gt;, and so on. &lt;/P&gt;
&lt;P&gt;This all sounds pretty easy right? The problem is that the actual XML messages expected by WCF for this service, were different than the XML messages expected and accepted by ASP.NET. Now it's XML, so, we don't need an exact string match. We need equivalence of the &lt;A href="http://www.w3.org/TR/xml-infoset/"&gt;Xml Infoset&lt;/A&gt;. That means, element names must be the same, XML namespaces must be the same, but prefixes attached to the namespaces can be different. But we did not have infoset equivalence! The first puzzle was, WHY? &lt;/P&gt;
&lt;P&gt;As in many scenarios involving interop between different web services libraries, it's the XML namespaces that cause lots of insidious problems. In this case, the ASP.NET-hosted web service was serializing and de-serializing the CommunicationEntity, using an XML namespace derived from the &lt;A href="http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmltypeattribute.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmltypeattribute.aspx"&gt;XmlTypeAttribute&lt;/A&gt; attached to that type definition. On the other hand, WCF was serializing the same object using the XML namespace associated to the &lt;A href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.servicecontractattribute.aspx"&gt;ServiceContract&lt;/A&gt;. If those two xml namespaces are the same, no problem. But in general, they are different, and in this specific case, they were different. The result was that ASMX clients (and by this I mean .NET apps compiled with webservice stubs generated from wsdl.exe in .NET 2.0) would send a serialized XML stream to the WCF service, which was &lt;EM&gt;ever so close&lt;/EM&gt; to the format WCF wanted. But close doesn't cut it, and so WCF would not de-serialize the request, and the app received a null instance for CommunicationEntity. &lt;/P&gt;
&lt;P&gt;This stinks. &lt;/P&gt;
&lt;P&gt;You would think it would be automatic, but it sure isn't. &lt;/P&gt;
&lt;P&gt;The next puzzle was, how to fix this? If you are familiar with the ASP.NET and XmlSerializer model, there are lots of attributes you can apply to types to specify the namespaces to use, the element names to use, and so on. It's very flexible, so flexible that some people find it unfathomable. The WCF serializer is much simpler, which is nice, but&amp;nbsp;on the downside, there is no special attribute that WCF uses to specify the namespace here. &lt;/P&gt;
&lt;P&gt;After a little spelunking, I found what I think is a useful hack to work around this problem. It is a custom &lt;A href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.servicehost.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.servicehost.aspx"&gt;ServiceHost&lt;/A&gt;, which, in the OnOpening() event, changes the MessageParts where the part namespace disagrees with the namespace specified in the &lt;A href="http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmltypeattribute.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmltypeattribute.aspx"&gt;XmlTypeAttribute&lt;/A&gt; associated to the CLR type for that message part. Huh? &lt;/P&gt;
&lt;P&gt;What this means is, now the WCF endpoint and the ASP.NET endpoint serialize and de-serialize the same way, for complex message types. Even better, when you query the WCF service for metadata, you get the "correct" WSDL – with the updated xml namespace. &lt;/P&gt;
&lt;P&gt;The ServiceHost uses reflection to inspect the message parts and decide on whether to change the XML namespace or not. Reflection is expensive at runtime, but this happens only once, when the service is opened. So it should have essentially no impact, after startup of the service. &lt;/P&gt;
&lt;P&gt;Here's the code: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;
&lt;P&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System; &lt;BR&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.ServiceModel; &lt;BR&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.ServiceModel.Description; &lt;BR&gt;&lt;BR&gt;&lt;SPAN style="COLOR: green"&gt;// if your original .svc file was: &lt;BR&gt;// &amp;lt;%@ ServiceHost Language="C#" Debug="true" Service="CommunicationService" CodeBehind="~/App_Code/CommunicationService.cs" %&amp;gt; &lt;BR&gt;// &lt;BR&gt;// then use this, to get the custom service host: &lt;BR&gt;// &amp;lt;%@ ServiceHost Language="C#" Debug="true" Factory="dinoch.wcf.fixup.EnforceXmlTypeServiceHostFactory" &lt;BR&gt;// &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Service="CommunicationService" CodeBehind="~/App_Code/CommunicationService.cs" %&amp;gt; &lt;BR&gt;// &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; dinoch.wcf.fixup &lt;BR&gt;{ &lt;BR&gt;&lt;SPAN style="COLOR: green"&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;/// &amp;lt;summary&amp;gt; &lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; This custom ServiceHost modifies the ServiceDescription to use the "preferred" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; namespaces on message parts. The ServiceDescription is used by the WCF service &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; in generating metadata (eg WSDL) and also in driving the serialization behavior. &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; We do this because the default behavior in WCF when using the XmlSerializer format &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; (via the XmlSerializerFormat attribute) is to NOT use the namespace specified in the &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; XmlTypeAttribute, if such an attribute is attached to the data type. This means that &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; WCF services will not accept the same input messages as ASMX Services, and will not &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; generate the same response messages as ASMX services - they will differ by XML namespace. &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; The way this works - on opening the service, which happens before WSDL is generated and &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; before any messages and dispatched to methods, this ServiceHost modifies the ServiceDescription &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; of the service. It examines message parts, looks for XmlTypeAttributes attached to the &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; types associated to those message parts, and then compares the xml namespace used in the message &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; part to the xml namespace specified in the XmlTypeAttribute. If they namespaces differ, then &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; this ServiceHost overrides the default namespace, and uses the namespace from the XmlTypeAttribute &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; in its stead. &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; Because this ServiceHost modifies the ServiceDescription before starting up the service, at runtime, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; this technique has the same effect as applying an (imaginary) attribute &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; to the service implementation code; the metadata (WSDL) generated from this service &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; will indicate the desired namespace for the message parts. &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; This ServiceHost has no effect on service operations that do not use the XmlSerializer. &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; There is one catch: running svcutil.exe over the assembly &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; (as opposed to the service itself, hosted and running within IIS) will not &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; detect the proper namespaces. &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; To use this service host, use something like this in your .svc file: &lt;BR&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;nbsp;&amp;nbsp;/// &amp;lt;%@ ServiceHost &lt;BR&gt;&amp;nbsp;&amp;nbsp;/// &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Language="C#" &lt;BR&gt;&amp;nbsp;&amp;nbsp;/// &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Debug="true" &lt;BR&gt;&amp;nbsp;&amp;nbsp;/// &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Factory="dinoch.wcf.fixup.EnforceXmlTypeServiceHostFactory" &lt;BR&gt;&amp;nbsp;&amp;nbsp;/// &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Service="CommunicationService" &lt;BR&gt;&amp;nbsp;&amp;nbsp;/// &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CodeBehind="~/App_Code/CommunicationService.cs" &lt;BR&gt;&amp;nbsp;&amp;nbsp;/// %&amp;gt; &lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt; For some additional background, see http://msdn2.microsoft.com/en-us/library/Aa395224.aspx &lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;/// &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: gray"&gt;/// &amp;lt;/summary&amp;gt; &lt;/SPAN&gt;&lt;BR&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;EnforceXmlTypeServiceHost&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;ServiceHost &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; EnforceXmlTypeServiceHost(&lt;SPAN style="COLOR: #2b91af"&gt;Type&lt;/SPAN&gt; t, &lt;SPAN style="COLOR: blue"&gt;params&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Uri&lt;/SPAN&gt;[] baseAddresses) : &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;(t, baseAddresses) { } &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; EnforceXmlTypeServiceHost(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; singletonInstance, &lt;SPAN style="COLOR: blue"&gt;params&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Uri&lt;/SPAN&gt;[] baseAddresses) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;: &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;(singletonInstance, baseAddresses) { } &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; EnforceXmlTypeServiceHost() : &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;() { } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; OnOpening() &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: #2b91af"&gt;ServiceEndpointCollection&lt;/SPAN&gt; sec = &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.Description.Endpoints; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ServiceEndpoint&lt;/SPAN&gt; se &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; sec) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (se.Address.ToString().EndsWith(&lt;SPAN style="COLOR: #a31515"&gt;".svc"&lt;/SPAN&gt;)) &lt;SPAN style="COLOR: green"&gt;// eliminate mex endpoints&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;OperationDescription&lt;/SPAN&gt; opDesc &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; se.Contract.Operations) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: green"&gt;// Are we using XmlSerializer? &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (opDesc.Behaviors.Find&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;XmlSerializerOperationBehavior&lt;/SPAN&gt;&amp;gt;() != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;MessageDescription&lt;/SPAN&gt; messDesc &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; opDesc.Messages) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = 0; i &amp;lt; messDesc.Body.Parts.Count; i++) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: #2b91af"&gt;MessagePartDescription&lt;/SPAN&gt; part = messDesc.Body.Parts[i]; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.Reflection.&lt;SPAN style="COLOR: #2b91af"&gt;MemberInfo&lt;/SPAN&gt; info = (System.Reflection.&lt;SPAN style="COLOR: #2b91af"&gt;MemberInfo&lt;/SPAN&gt;)part.Type; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.Xml.Serialization.&lt;SPAN style="COLOR: #2b91af"&gt;XmlTypeAttribute&lt;/SPAN&gt;[] attributes = &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(System.Xml.Serialization.&lt;SPAN style="COLOR: #2b91af"&gt;XmlTypeAttribute&lt;/SPAN&gt;[])&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;info.GetCustomAttributes(&lt;SPAN style="COLOR: blue"&gt;typeof&lt;/SPAN&gt;(System.Xml.Serialization.&lt;SPAN style="COLOR: #2b91af"&gt;XmlTypeAttribute&lt;/SPAN&gt;), &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; ((attributes!= &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) &amp;amp;&amp;amp; (attributes.Length &amp;gt; 0)) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: green"&gt;// check to see if the xml namespace specified to the XmlSerializer via &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: green"&gt;// the XmlTypeAttribute attribute, disagrees with the xml namespace used &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: green"&gt;// in the WCF message description. &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (attributes[0].Namespace != part.Namespace) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: green"&gt;// the namespaces do not agree. we need to swap them. &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: green"&gt;// this won't work, the property is readonly &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: green"&gt;// messDesc.Body.Parts[i].Namespace = attributes[0].Namespace; &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: green"&gt;// Duplicate the old part description, except for the XML namespace &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: #2b91af"&gt;MessagePartDescription&lt;/SPAN&gt; newPart = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;MessagePartDescription&lt;/SPAN&gt;(part.Name, attributes[0].Namespace); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newPart.Index = part.Index; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newPart.MemberInfo = part.MemberInfo; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newPart.Multiple = part.Multiple; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newPart.ProtectionLevel = part.ProtectionLevel; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;newPart.Type = part.Type; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: green"&gt;// Replace the old part with the new one &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;messDesc.Body.Parts[i] = newPart; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.OnOpening(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;EnforceXmlTypeServiceHostFactory&lt;/SPAN&gt; : System.ServiceModel.Activation.&lt;SPAN style="COLOR: #2b91af"&gt;ServiceHostFactory &lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ServiceHost&lt;/SPAN&gt; CreateServiceHost(&lt;SPAN style="COLOR: #2b91af"&gt;Type&lt;/SPAN&gt; serviceType, &lt;SPAN style="COLOR: #2b91af"&gt;Uri&lt;/SPAN&gt;[] baseAddresses) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;EnforceXmlTypeServiceHost&lt;/SPAN&gt;(serviceType, baseAddresses); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;&amp;nbsp;&amp;nbsp;} &lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;And here's how you specify the custom ServiceHost in the .svc file: &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;SPAN style="BACKGROUND-COLOR: yellow"&gt;&amp;lt;%&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;@&lt;/SPAN&gt; &lt;SPAN style="COLOR: #a31515"&gt;ServiceHost&lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: red"&gt;Language&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="C#"&lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: red"&gt;Factory&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="dinoch.wcf.fixup.EnforceXmlTypeServiceHostFactory"&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: red"&gt;CodeBehind&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="~/App_Code/CommunicationService.cs"&lt;/SPAN&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="COLOR: red"&gt;Service&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="CommunicationService"&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR: yellow"&gt;%&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;I hope this is useful! The same principle would apply, of course, when migrating from ASMX to WCF on the server side, if you are using a Java-based client, or a web service client on any other platform. So this&amp;nbsp;definitely falls in the arena of interop. If any of you have other requests on interop topics relating to WCF, let me hear 'em! &lt;/P&gt;
&lt;P&gt;Cheers, &lt;/P&gt;
&lt;P&gt;-Dino &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3965100" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/dotnetinterop/attachment/3965100.ashx" length="8648" type="text/plain" /><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/XML/default.aspx">XML</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Java/default.aspx">Java</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WSDL/default.aspx">WSDL</category></item></channel></rss>