<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.microsoft.co.il/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>Ido Flatow&amp;#39;s Blog&lt;h3&gt;Veni Vidi Scripsi&lt;/h3&gt; : wsdl</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/tags/wsdl/default.aspx</link><description>Tags: wsdl</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>What’s new in WCF 4.5? a single WSDL file</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx</link><pubDate>Sat, 17 Sep 2011 23:04:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:902087</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=902087</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx#comments</comments><description>&lt;p&gt;This is the second post in the WCF 4.5 series, and this time we’ll talk about WSDL files.&lt;/p&gt;
&lt;p&gt;Previous posts:&lt;/p&gt;
&lt;p&gt;1. &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/16/what-s-new-in-wcf-4-5-let-s-start-with-wcf-configuration.aspx"&gt;What’s new in WCF 4.5? let’s start with WCF configuration&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A few weeks ago, I &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx"&gt;posted&lt;/a&gt; about the difference between exposing the service metadata through WSDL and through a MEX endpoint. One of the things I noted in the post was that the metadata exposed through a WSDL file is actually one part of the overall metadata – in addition to the WSDL file, there is usually an additional set of files, XSD files, that contain the data contracts of the service. For WCF 4 and previous versions, the schema part in the WSDL is a set of import directives for additional files:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_0CF7CAD0.png"&gt;&lt;img style="BACKGROUND-IMAGE:none;BORDER-BOTTOM:0px;BORDER-LEFT:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;PADDING-TOP:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_7825D24F.png" width="665" height="128" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So what has changed in WCF 4.5? When you browse to a WCF 4.5 service’s metadata URL, you will see the following WSDL options:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_7BE3771F.png"&gt;&lt;img style="BACKGROUND-IMAGE:none;BORDER-BOTTOM:0px;BORDER-LEFT:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;PADDING-TOP:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_1975521F.png" width="821" height="189" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In addition to the ?wsdl option, we now get another option - ?singleWsdl. The singleWsdl link will return a single WSDL file, containing all the schemas in it:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_2FE7F0A6.png"&gt;&lt;img style="BACKGROUND-IMAGE:none;BORDER-BOTTOM:0px;BORDER-LEFT:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;PADDING-TOP:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_2C8658FE.png" width="793" height="313" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Each of the schema elements contains the schema that was previously imported from an external file.&lt;/p&gt;
&lt;p&gt;So in my previous &lt;a href="http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx"&gt;post&lt;/a&gt;, where I listed the reasons why to use MEX instead of WSDL, we can omit the first reason – “If you want to make as less calls as possible to your service in order to get its metadata (one call instead of several).”&lt;/p&gt;
&lt;p&gt;Stay tuned for more posts about the new features of WCF 4.5. You can also follow me on Twitter (@IdoFlatow) to get updates as soon as new posts are published.&lt;/p&gt;
&lt;p&gt;The RTM of .NET 4.5 is still to come, and I assume many of you are still adjusting to WCF 4. If you want to learn more about the new features of WCF 4, come to my &lt;a href="http://vslive.com/Events/Redmond-2011/Sessions/Tuesday/T8-Whats-New-in-WCF4.aspx"&gt;session&lt;/a&gt; at Visual Studio Live! 2011 in Redmond (October 17-21).&lt;/p&gt;
&lt;p&gt;Also, if you are an MCT and reside in the US, come hear my session about WCF 4 at the &lt;a href="http://www.mctsummit.org/"&gt;MCT 2011 North-America Summit&lt;/a&gt; that will be held in San-Francisco (October 19-21).&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;MARGIN:0px;PADDING-LEFT:0px;PADDING-RIGHT:0px;PADDING-TOP:0px;" class="wlWriterHeaderFooter"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;BORDER-TOP:0px;BORDER-RIGHT:0px;" alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/09/17/what-s-new-in-wcf-4-5-a-single-wsdl-file.aspx" /&gt;&lt;/a&gt; &lt;a style="DISPLAY:none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=2199681" rel="tag"&gt;CodeProject&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=902087" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/What_2700_s+new/default.aspx">What's new</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WSDL+vs+MEX/default.aspx">WSDL vs MEX</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/wsdl/default.aspx">wsdl</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF+4.5/default.aspx">WCF 4.5</category></item><item><title>WSDL vs MEX, knockout or tie?</title><link>http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx</link><pubDate>Wed, 10 Aug 2011 15:12:47 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:882407</guid><dc:creator>Ido Flatow</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/idof/rsscomments.aspx?PostID=882407</wfw:commentRss><comments>http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx#comments</comments><description>&lt;p&gt;When teaching WCF I am always asked about the difference between getting the service’s metadata by using the WSDL’s http get url, and getting the metadata by calling the MEX endpoint.&lt;/p&gt;  &lt;p&gt;To answer that question we first need to understand the different parts of the configuration that affect metadata creation.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;The ServiceMetadata behavior&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;This behavior controls whether metadata is created for the service. When this behavior is used, the service is scanned, and metadata is created for the service’s contracts (a list of operations and types exposed by the service). &lt;/p&gt;  &lt;p&gt;If the behavior is not used, no metadata will be created for the service, and you will not be able to create MEX endpoints. &lt;/p&gt;  &lt;p&gt;&lt;u&gt;The ServiceMetadata’s httpGetEnabled flag&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;This flag defines whether the metadata will be accessible by an http get request. If this attribute is set to true, then a default url will be created for the metadata (usually the service’s address with the suffix of&amp;#160; ‘?wsdl’). The url will lead you to a WSDL file containing the description of the service operations, but without the description of the data contracts – these files are accessible by different urls, usually the service’s url with the suffix of ‘?xsd=xsdN’. The list of these urls are pointed out from the WSDL file.&lt;/p&gt;  &lt;p&gt;If you do not set this attribute to true, you will not be able to access the metadata using http get requests. If you prefer using https for the get requests, you can use the &lt;strong&gt;httpsGetEnabled&lt;/strong&gt; attribute instead of the httpGetEnabled.&lt;/p&gt;  &lt;p&gt;There are several other settings for the get options – you can read more about them on &lt;a href="http://msdn.microsoft.com/en-us/library/ms731317.aspx"&gt;MSDN&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;The MEX endpoint&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;MEX endpoints are special endpoints that allow clients to receive the service’s metadata by using SOAP messages instead of http get requests. You can create MEX endpoint that can be accessed through http, https, tcp, and even named pipes.&lt;/p&gt;  &lt;p&gt;The response that you will receive when calling a MEX endpoint’s GetMetadata operation will include the content of the WSDL and all the XSD files that are linked to it.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;So what exactly is the difference between MEX and WSDL? &lt;/u&gt;&lt;/p&gt;  &lt;p&gt;There is no difference! &lt;/p&gt;  &lt;p&gt;MEX and WSDL both output the same thing – a web service description language (WSDL) document, only MEX does it by getting a SOAP message over some transport (http, tcp, named pipes) and returning one message with all the parts, while the WSDL urls use http get requests and require sending several requests to get all the parts.&lt;/p&gt;  &lt;p&gt;Don’t believe me? &lt;/p&gt;  &lt;p&gt;The following diff diagram was produced by comparing the output of a MEX call to the output of the aggregated results gathered by calling all the WSDL related urls using http get:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_66D682B0.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_3E772A8F.png" width="437" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As you can see, there are only several sections that are different between the files (marked in red and yellow), while most of the content is identical. Let’s look at one of these parts:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/idof/image_21AD8FAD.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://blogs.microsoft.co.il/blogs/idof/image_thumb_7F095131.png" width="716" height="159" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The red lines come from the MEX result, and the yellow lines from the WSDL file. The difference is because when using WSDL files, the rest of the XSD files are linked by using the &amp;lt;xsd:import&amp;gt; tag with the schemaLocation attribute. Since the MEX response includes all the XSD content in it, the import tag doesn’t include the location attribute. &lt;/p&gt;  &lt;p&gt;As for the other different sections – they are different because the MEX response wraps each WSDL/XSD part with an xml element that does not appear in the aggregated files. These elements are part of the MEX standard declared by the &lt;a href="http://schemas.xmlsoap.org/ws/2004/09/mex/"&gt;W3C&lt;/a&gt; - surprise surprise, MEX is a W3C standard, it’s not a Microsoft proprietary spec.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;So they are the same, still, which one to use?&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;In most cases there is no need for MEX endpoint – using WSDLs with http get is usually enough.&lt;/p&gt;  &lt;p&gt;The “Add Service Reference” option in Visual Studio 2010 will work for both options. The same goes for the svcutil command line tool.&lt;/p&gt;  &lt;p&gt;So when would I use MEX?&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;If you want to make as less calls as possible to your service in order to get its metadata (one call instead of several).&lt;/li&gt;    &lt;li&gt;If you don’t want to use HTTP to get the metadata, but prefer using TCP or named pipes (not so common).&lt;/li&gt;    &lt;li&gt;If you want people to ask you why you declared a MEX endpoint.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;So is it a knockout or a tie? I say tie.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="margin:0px;padding:0px 0px 0px 0px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx&amp;amp;bgcolor=6600FF" /&gt;&lt;/a&gt; &lt;a href="http://dotnetshoutout.com/Submit?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx"&gt;&lt;img alt="Shout it" src="http://dotnetshoutout.com/image.axd?url=http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx" style="border:0px;" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=882407" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/WSDL+vs+MEX/default.aspx">WSDL vs MEX</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/mex/default.aspx">mex</category><category domain="http://blogs.microsoft.co.il/blogs/idof/archive/tags/wsdl/default.aspx">wsdl</category></item></channel></rss>