<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Dan Driscoll's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/dandris/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/dandris/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 04:58:02 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Building WSDXML sections</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/building-wsdxml-sections</link>
      <pubDate>Tue, 11 Aug 2009 12:52:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2009/08/11/building-wsdxml-sections/</guid>
      <description><![CDATA[Last year I described the general structure of WSDAPI's WSDXML sections and provided some hints for...]]></description>
      <content:encoded><![CDATA[<P>Last year I described the general structure of WSDAPI's WSDXML sections and provided some hints for creating and consuming these structures.&nbsp; I've received a few requests since then to provide more concrete examples of how to build these structures in code.</P>
<P>Before we get started, I do recommend you re-read my <A href="https://blogs.msdn.com/dandris/archive/2008/07/28/wsdxml-and-wsdapi-s-dom-sections.aspx" mce_href="https://blogs.msdn.com/dandris/archive/2008/07/28/wsdxml-and-wsdapi-s-dom-sections.aspx">original post on WSDXML</A>.&nbsp; The relationship between WSDXML_ELEMENT, WSDXML_TYPE, and WSDXML_NODE is an important part of understanding how everything fits together.</P>
<P><STRONG><EM>Simple example: element with text</EM></STRONG><BR>The first example will demonstrate how to build a single element with text, but without any attributes or children.&nbsp; If we imagine the "ex" prefix is bound to the https://www.example.org namespace, here's the element we will want to build:</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ex:TestElement&gt;text&lt;/ex:TestElement&gt;</P>
<P>Creating this structure is straightforward.&nbsp; It involves two steps:</P>
<OL>
<LI>Extract an XML name ("ex:TestElement") from the XML context</LI>
<LI>Build a WSDXML_ELEMENT structure from that XML name</LI></OL>
<P>Here's what it looks like in code.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // All error handling is omitted from this example<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HRESULT hr = S_OK;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IWSDXMLContext *pContext = NULL;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WSDXML_NAME *pName = NULL;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WSDXML_ELEMENT *pElement = NULL;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr = WSDXMLCreateContext( &amp;pContext );</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr = pContext-&gt;AddNamespace(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; L"https://www.example.org",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; L"ex",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL );</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr = pContext-&gt;AddNameToNamespace(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; L"https://www.example.org",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; L"TestElement",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;pName );</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr = WSDXMLBuildAnyForSingleElement(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pName,&nbsp; //&nbsp;pName is copied here, and must be freed separately<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; L"text",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;pElement );<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // pElement is now complete, and contains: &lt;ex:TestElement&gt;text&lt;/ex:TestElement&gt;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // cleanup:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // WSDFreeLinkedMemory( pElement );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // WSDFreeLinkedMemory( pName );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // pContext-&gt;Release();</P>
<P>Note that you can omit the "text" parameter to WSDXMLBuildAnyForSingleElement to generate empty elements.&nbsp; Supplying NULL here would result in &lt;ex:TestElement /&gt;</P>
<P><STRONG><EM>Advanced example: chaining elements</EM></STRONG><BR>We'll build on the last example to show how you can create chains of structures.&nbsp; Here's the element we want to build this time:</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ex:ParentElement&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ex:ChildElement&gt;text&lt;/ex:ChildElement&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ex:AnotherChildElement /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ex:ParentElement&gt;</P>
<P>In this case, the steps go like this:</P>
<OL>
<LI>Build ParentElement, ChildElement, and AnotherChildElement separately using the instructions above.</LI>
<LI>Use WSDXMLAddChild to link ParentElement to ChildElement</LI>
<LI>Use WSDXMLAddChild or WSDXMLAddSibling to add in AnotherChildElement.&nbsp; Either is acceptable.</LI></OL>
<P><STRONG>Important: </STRONG>see section below on cleaning up WSDXML structures.<STRONG>&nbsp; </STRONG>Also note that you only need to call IWSDXMLContext::AddNamespace once for a given namespace--it is not necessary to call it for every name you add.</P>
<P>Here's some example code:</P>
<P mce_keep="true">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Use steps above to create pParentElement, pChildElement,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp; and pAnotherChildElement</P>
<P mce_keep="true">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr = WSDXMLAddChild( pParentElement, pChildElement );</P>
<P mce_keep="true">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr = WSDXMLAddSibling( pChildElement, pAnotherChildElement );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // It is also acceptable to call<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // WSDXMLAddChild( pParentElement, pAnotherChildElement);</P>
<P mce_keep="true">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // cleanup:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // WSDFreeLinkedMemory( pParentElement );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Use WSDFreeLinkedMemory to destroy WSDXML_NAME&nbsp;objects<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;extracted from IWSDXMLContext<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // DO NOT FREE pChildElement or pAnotherChildElement;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp;&nbsp; they are attached to pParentElement</P>
<P mce_keep="true"><STRONG><EM>Destroying WSDXML structures<BR></EM></STRONG>At first glance, it may seem complex to destroy these structures, but they're designed to be simple.&nbsp; You only need to follow a few simple rules to write robust and leak-free WSDXML code:</P>
<UL>
<LI>
<DIV mce_keep="true">All WSDXML functions use linked memory.&nbsp; Always use WSDFreeLinkedMemory to destroy individual structures or whole trees.</DIV></LI>
<LI>
<DIV mce_keep="true">WSDXMLBuildAnyForSingleElement copies the "name" parameter and links a copy into the new tree.</DIV></LI>
<LI>
<DIV mce_keep="true">WSDXMLAddChild and WSDXMLAddSibling link together all structures in the tree.</DIV></LI>
<LI>
<DIV mce_keep="true">Only free the topmost WSDXML_ELEMENT structure in an entire tree.</DIV></LI>
<LI>
<DIV mce_keep="true">When passing WSDXML structures as outparams from services, be sure to link the entire WSDXML tree into the outparameter.</DIV></LI></UL>]]></content:encoded>
    </item>
    <item>
      <title>WS-DD v1.1 specs are now standards</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/ws-dd-v1-1-specs-are-now-standards</link>
      <pubDate>Wed, 01 Jul 2009 17:31:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2009/07/01/ws-dd-v1-1-specs-are-now-standards/</guid>
      <description><![CDATA[OASIS has just announced that&nbsp;version 1.1 of&nbsp;DPWS, WS-Discovery, and...]]></description>
      <content:encoded><![CDATA[<P>OASIS <A href="https://lists.oasis-open.org/archives/tc-announce/200907/msg00001.html" mce_href="https://lists.oasis-open.org/archives/tc-announce/200907/msg00001.html">has</A> <A href="https://lists.oasis-open.org/archives/tc-announce/200907/msg00002.html" mce_href="https://lists.oasis-open.org/archives/tc-announce/200907/msg00002.html">just</A> <A href="https://lists.oasis-open.org/archives/tc-announce/200907/msg00003.html" mce_href="https://lists.oasis-open.org/archives/tc-announce/200907/msg00003.html">announced</A> that&nbsp;version 1.1 of&nbsp;<A href="https://docs.oasis-open.org/ws-dd/ns/dpws/2009/01" mce_href="https://docs.oasis-open.org/ws-dd/ns/dpws/2009/01">DPWS</A>, <A href="https://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" mce_href="https://docs.oasis-open.org/ws-dd/ns/discovery/2009/01">WS-Discovery</A>, and <A href="https://docs.oasis-open.org/ws-dd/soapoverudp/1.1/wsdd-soapoverudp-1.1-spec.html" mce_href="https://docs.oasis-open.org/ws-dd/soapoverudp/1.1/wsdd-soapoverudp-1.1-spec.html">SOAP-over-UDP</A>&nbsp;are now officially standards!</P>
<P>The links to the RDDL and spec pages currently point to the Committee Specification 1&nbsp;(CS1)&nbsp;revisions of the specs, but OASIS will update these links to the fully standardized versions of the documents soon.</P>
<P>This is a big milestone in the progress of these specifications.&nbsp; My thanks go to the other members of the WS-DD Technical Committee, who all showed great dedication to this technology, and many of whom made substantial commitments of time and energy in producing high-quality specifications.</P>]]></content:encoded>
    </item>
    <item>
      <title>Using MTOM to set up binary streams</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/using-mtom-to-set-up-binary-streams</link>
      <pubDate>Mon, 29 Jun 2009 15:51:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2009/06/29/using-mtom-to-set-up-binary-streams/</guid>
      <description><![CDATA[The SOAP Message Transmission Optimization Mechanism is a building-block spec that DPWS profiles so...]]></description>
      <content:encoded><![CDATA[<P>The <A href="https://www.w3.org/TR/2005/REC-soap12-mtom-20050125/" mce_href="https://www.w3.org/TR/2005/REC-soap12-mtom-20050125/">SOAP Message Transmission Optimization Mechanism</A> is a building-block spec that DPWS profiles so that specifications built on top can use it in a consistent and device-friendly way.&nbsp; MTOM isn't used in any of DPWS's messages, but it is available to solution authors and is included in <EM>many </EM>specs built on DPWS.</P>
<P>In short, MTOM is a way to link binary MIME attachments into the SOAP envelope*.&nbsp; The simplest example is a print job: using MTOM, you can send a SOAP message that describes the print job, and attach the binary document as a MIME attachment inside the HTTP connection.&nbsp; MTOM lets you link the MIME and SOAP together.&nbsp; This seems like an obvious way to package data, but let's imagine what would happen without that binding: the sender would have to encode the binary document into some form (likely base64) and then inline it into the SOAP message.&nbsp; There are a lot of disadvantages in this approach, most notably that the receiver can't really process the SOAP until it consumes the entire binary document, which could be very large.&nbsp; This would be a huge problem for devices, which are often memory-limited and which rely on streaming large documents as they cannot buffer them in entirety.</P>
<P>That last sentence hints at a neat fringe benefit of MTOM: it allows the sender and receiver to establish a binary stream with a SOAP message header.&nbsp; This is a really convenient way to open a stream like this, since the stream can coexist on the port used to send SOAP traffic, and there's a natural association between the strongly-typed SOAP contents and the more flexible stream data.&nbsp; Conceptually, MTOM doesn't distinguish between well-bounded documents and open-ended streams, although solutions are often written with either one of these in mind.</P>
<P>A good example of the&nbsp;stream&nbsp;pattern is the DPWS-based <A href="https://sideshowbitmap.codeplex.com/" mce_href="https://sideshowbitmap.codeplex.com/">Windows SideShow Bitmap</A> driver, which uses the SendSideShowFrameStream operation to open a stream connection, which is linked inside the FrameStream element.&nbsp; The SOAP message contains some useful parameters about the stream, and the stream contains bitmaps.</P>
<P>There are, naturally, disadvantages and limitations to this approach.&nbsp; The stream itself is unidirectional (although you may be able to set up simultaneous request/response streams), and even though a SOAP message can contain multiple MTOM sections, only one stream can be active at a time.&nbsp; Every stream must be prefaced with a SOAP message, and the data inside is completely untyped.&nbsp; But even with these limitations, using MTOM to set up streams is incredibly handy in DPWS applications.</P>
<P>To use MTOM in your application, simply include the xs:base64Binary schema type in an element.&nbsp; This type will become a pointer to the MIME section containing your binary document or stream data.&nbsp; WSDAPI automatically interprets this type and provides IWSDAttachment pointers for easy access to the binary data.</P>
<P>* Note: MTOM is actually a bit more complex than this, and is organized into a generic optimization mechanism <EM>and </EM>a MIME serialization.&nbsp; But in the context of DPWS, it really is just a way to link MIME sections into SOAP.</P>]]></content:encoded>
    </item>
    <item>
      <title>DPWS v1.1 update</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/dpws-v1-1-update</link>
      <pubDate>Fri, 29 May 2009 11:27:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2009/05/29/dpws-v1-1-update/</guid>
      <description><![CDATA[It's been a while since I last provided an update on the standardization of DPWS, WS-Discovery, and...]]></description>
      <content:encoded><![CDATA[<P>It's been a while since I last provided an <A href="https://blogs.msdn.com/dandris/archive/2009/01/30/ws-dd-standardization-update.aspx" mce_href="https://blogs.msdn.com/dandris/archive/2009/01/30/ws-dd-standardization-update.aspx">update</A> on the standardization of DPWS, WS-Discovery, and SOAP-over-UDP.&nbsp; I'm pleased to say that the standardization committee has produced <A href="https://docs.oasis-open.org/ws-dd/ns/dpws/2009/01" mce_href="https://docs.oasis-open.org/ws-dd/ns/dpws/2009/01">Committee Specification</A> versions of these three specs--that doesn't mean that they're standards, but the committee has finished with these versions and has sent them to the greater OASIS community for an approval vote.&nbsp; The TC has a more <A href="https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=ws-dd#announcements" mce_href="https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=ws-dd#announcements">detailed announcement</A>.</P>
<P mce_keep="true">Even though these aren't approved standards, we can still compare the technical details of&nbsp;<A href="https://specs.xmlsoap.org/ws/2006/02/devprof/" mce_href="https://specs.xmlsoap.org/ws/2006/02/devprof/">DPWS&nbsp;v1.0</A> (the&nbsp;version&nbsp;originally&nbsp;supported in&nbsp;Vista) to the <A href="https://docs.oasis-open.org/ws-dd/ns/dpws/2009/01" mce_href="https://docs.oasis-open.org/ws-dd/ns/dpws/2009/01">latest revision of DPWS&nbsp;v1.1</A>&nbsp;to see what has changed.</P>
<UL>
<LI>
<DIV mce_keep="true"><STRONG>Namspaces:</STRONG>&nbsp; First and foremost, DPWS v1.1 (and WS-Discovery v1.1) have new namespaces.&nbsp; This means that the two protocols are not inherently compatible--instead, individual implementers may choose whether they will support v1.0, v1.1, or both.&nbsp; In my opinion, the lack of backward compatibility built into the specification is actually a good thing: it keeps the specs isolated and individually very simple, and does not burden future specs written on DPWS v1.1 with a requirement to support the pre-standard versions of the specs.</DIV></LI>
<LI>
<DIV mce_keep="true"><STRONG>References:</STRONG> The v1.1 revisions now reference the latest available standards, particularly WS-Policy v1.5 and WS-Addressing v1.0.&nbsp; Note that references to WS-Transfer, WS-MetadataExchange, and WS-Eventing&nbsp;have not yet been&nbsp;updated as those specifications are still being standardized in the <A href="https://www.w3.org/2002/ws/ra/" mce_href="https://www.w3.org/2002/ws/ra/">W3C WS-RA WG</A>.</DIV></LI>
<LI>
<DIV mce_keep="true"><STRONG>Security:</STRONG>&nbsp; DPWS v1.1 features a heavily reorganized security section which is simpler, easier to understand from an implementation perspective, and better organized.&nbsp; I'm personally very pleased with this change, as it makes DPWS security even more accessible.</DIV></LI>
<LI>
<DIV mce_keep="true"><STRONG>Numerous smaller changes:</STRONG> I can't really do justice to the many other meaningful changes made to improved the quality of the specifications.&nbsp; Across all three specs, we resolved 141 issues ranging from a few editorial updates to dramatic improvements in specific parts of the text.</DIV></LI></UL>
<P mce_keep="true">I also want to call out one big change to WS-Discovery:</P>
<UL>
<LI>
<DIV mce_keep="true"><STRONG>WS-Discovery Managed Mode:</STRONG>&nbsp; WS-Discovery v1.1 now clearly separates two functional modes: ad-hoc, where discovery occurs among peers; and managed, where discovery occurs by means of a discovery proxy.&nbsp; WS-Discovery v1.0 hinted at how this would work but v1.1 is much clearer about how clients and services can contact a proxy.</DIV></LI></UL>
<P mce_keep="true">Now, there are many changes I'm lumping into that category of "numerous smaller changes" which could each be broken out into their own articles--but the items I've listed above are the ones I'm most excited about.&nbsp; In the future I expect to dive into these (particularly security) in much greater detail.</P>
<P mce_keep="true">Stay tuned for additional updates as the OASIS member vote on these specs gets underway.</P>]]></content:encoded>
    </item>
    <item>
      <title>xAddrs optionality in WS-Discovery messages</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/xaddrs-optionality-in-ws-discovery-messages</link>
      <pubDate>Thu, 02 Apr 2009 18:02:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2009/04/02/xaddrs-optionality-in-ws-discovery-messages/</guid>
      <description><![CDATA[Traditional big web services, like a billing system or a service running in the cloud, nearly always...]]></description>
      <content:encoded><![CDATA[<P>Traditional big web services, like a billing system or a service running in the cloud, nearly always have&nbsp;fixed addresses--often HTTP URLs.&nbsp; Smaller web services, such as those on a PC or a device, often have logical identifiers ("urn:uuid:c3de740f-9227-4706-b3ee-9494243c040d") that let you recognize the service, but which don't actually tell you anything about how to contact the service.</P>
<P>One of the great uses of <A href="https://schemas.xmlsoap.org/ws/2005/04/discovery/" mce_href="https://schemas.xmlsoap.org/ws/2005/04/discovery/">WS-Discovery</A> is transforming logical addresses into physical addresses (e.g., <A>https://my_pc/service/</A>) so you can actually contact the service.&nbsp; A service uses the <EM>xAddrs</EM> field in WS-Discovery messages to express its transport addresses.</P>
<P>But it turns out that these xAddrs are optional.&nbsp; There are actually a lot of really good cases why you would want to omit them--if they're very large, or if you don't want to generate different Hello messages for every IP address in the system--but the specification doesn't clearly explain when they're often omitted in the real world, and what happens when they are.</P>
<P>So let's go through the four messages a service can send.</P>
<UL>
<LI><STRONG>Hello </STRONG>messages <EM>sometimes </EM>contain xAddrs.&nbsp; On any given subnet it's likely to encounter Hello messages both with and without xAddrs.&nbsp; Those without xAddrs will cause a Resolve from any clients interested in the service.&nbsp; Hello is the only multicast message that can include xAddrs, so it's a little unique--and it differs from ProbeMatches and ResolveMatches in that sense.</LI>
<LI><STRONG>Bye </STRONG>messages <EM>never </EM>contain xAddrs.&nbsp; The specification does not allow it (note that this has been changed in WS-Discovery v1.1).</LI>
<LI><STRONG>ResolveMatches </STRONG>messages <EM>always </EM>contain xAddrs.&nbsp; It's technically possible for the xAddrs element to be empty but this is unusual and probably not a good way to achieve interoperability.&nbsp; A service must realistically <EM>always </EM>produce&nbsp;xAddrs in its ResolveMatches messages.</LI>
<LI><STRONG>ProbeMatches </STRONG>messages <EM>usually </EM>contain xAddrs.&nbsp; It's very unusual for services to omit xAddrs in their ProbeMatches messages because it takes no more effort than including them in ResolveMatches--both messages are unicast responses.&nbsp; Including xAddrs in ProbeMatches lets everyone avoid a Resolve/ResolveMatches exchange.</LI></UL>
<P>One interesting consequence of this is that the example sequence on page 11 of WS-Discovery (Probe -&gt; ProbeMatches -&gt; Resolve -&gt; Resolve Matches -&gt; success!) almost never happens.&nbsp; Services usually include xAddrs in their ProbeMatches messages in the first place.</P>]]></content:encoded>
    </item>
    <item>
      <title>Service-level metadata</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/service-level-metadata</link>
      <pubDate>Tue, 31 Mar 2009 17:15:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2009/03/31/service-level-metadata/</guid>
      <description><![CDATA[DPWS defines two different levels of metadata: the Device delivers metadata about the entire device,...]]></description>
      <content:encoded><![CDATA[<P>DPWS defines two different levels of metadata: the <EM>Device </EM>delivers metadata about the entire device, and about the relationship between the Device and its Hosted Services; and each <EM>Hosted Service </EM>delivers metadata about itself (and optionally about its relationship with the Device).</P>
<P>Of these two, the device-level metadata is the most important.&nbsp; Since WS-Discovery only advertises the Device, the device-level metadata is the only way to discover the services.&nbsp; Without device-level metadata, you really can't do anything with the device.&nbsp; WSDAPI and Windows relies heavily on device-level metadata to populate the properties visible inside the Network explorer, and this metadata is retrieved any time an application attempts to use a Hosted Service on the device.</P>
<P>The service-level metadata, on the other hand, isn't absolutely critical for Windows to connect to the device.&nbsp; It is possible that someone will build an application that uses service-level metadata (the <A href="https://msdn.microsoft.com/en-us/library/aa386210(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa386210(VS.85).aspx">IWSDServiceProxy</A>::<A href="https://msdn.microsoft.com/en-us/library/aa386212(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa386212(VS.85).aspx">BeginGetMetadata</A>/<A href="https://msdn.microsoft.com/en-us/library/aa386213(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa386213(VS.85).aspx">EndGetMetadata</A> methods provide access) but for now it's not used by many of the applications that ship inside Windows.</P>]]></content:encoded>
    </item>
    <item>
      <title>Discovery-layer types in DPWS applications</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/discovery-layer-types-in-dpws-applications</link>
      <pubDate>Sat, 28 Feb 2009 15:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2009/02/28/discovery-layer-types-in-dpws-applications/</guid>
      <description><![CDATA[The roles of Types in WS-Discovery messages is really clear for generic, non-DPWS services.&nbsp;...]]></description>
      <content:encoded><![CDATA[<P>The roles of Types in WS-Discovery messages is really clear for generic, non-DPWS services.&nbsp; Types are qualified names expressed in the &lt;d:Types&gt; element of WS-Discovery messages, and these names identify a set of operations; the service advertised in the WS-Discovery message supports those operations.&nbsp; In many cases a language like WSDL is used to express the connection between the name and the operations, but it's not strictly necessary.</P>
<P>When DPWS is involved, things are a little more complicated.&nbsp; Remember that DPWS uses a Host service that is responsible for advertising all of the Hosted services.&nbsp; The Hosted services are the ones that actually perform the device's functionality (e.g., WSD Toaster operations) so their types are advertised in the metadata that the Host service provides (e.g., the Host service would describe a Hosted service, and would advertise a type of t:WSDToasterService).</P>
<P>Now in most cases, the Host service does not actually implement any application-specific operations on its own; it only provides the metadata that allows a client to find the application-specific services.&nbsp; Devices built like this don't advertise t:WSDToasterService at the device level because it's inaccurate--a client cannot send WSD Toaster operations directly to the Host service and expect them to work.&nbsp; The Host service supports the WS-Transfer/Get request used to retrieve the device's <A href="https://blogs.msdn.com/dandris/archive/2008/10/21/relationship-metadata.aspx" mce_href="https://blogs.msdn.com/dandris/archive/2008/10/21/relationship-metadata.aspx">metadata</A>, that that operation is described by the dpws:Device type.</P>
<P>The difficulty is that clients cannot search for devices that support WSD Toaster services at the WS-Discovery layer.&nbsp; After all, why should a device connect to hundreds of devices that have nothing to do with WSD Toaster?</P>
<P>To fix this problem, some specifications add an empty device-layer type with no associated operations, but which identifies that one or more service-layer types of interest can be found on this device.&nbsp; So in this case, WSD Toaster would define a type t:WSDToaster<STRONG>Device</STRONG> without any associated actions, but which is required on every device with a matching t:WSDToasterService service.&nbsp; Clients can then merely search for t:WSDToasterDevice in WS-Discovery and only retrieve metadata for devices that contain toaster services.&nbsp; t:WSDToasterDevice isn't useful on its own, but it does provide a hint that t:WSDToasterService is nearby.</P>
<P>DPWS v1.0 applications usually manually describe the association between their service-layer (t:WSDToasterService) and device-layer (t:WSDToasterDevice) types in normative text.&nbsp; It usually looks something like this: "A device that supports one or more WSD Toaster services MUST advertise the t:WSDToasterDevice type at the DPWS DEVICE."&nbsp; As a convenience, <A href="https://docs.oasis-open.org/ws-dd/dpws/1.1/pr-01/wsdd-dpws-1.1-spec-pr-01.html#_Toc221003988" mce_href="https://docs.oasis-open.org/ws-dd/dpws/1.1/pr-01/wsdd-dpws-1.1-spec-pr-01.html#_Toc221003988">DPWS v1.1 Appendix C</A> adds an optional WSDL attribute that can be used to express this association in a way that code generation tools can understand.&nbsp; An example is shown in that appendix.</P>
<P>Now, this article doesn't completely describe the possible variations of these types, and the benefits and drawbacks of any of the arrangements.&nbsp; Specification authors should be warned that this is a complex topic and shouldn't be taken lightly--at some point I may even put together a whole post on how to choose the layout.&nbsp; But the basics I've described here are applicable to many of the most common cases (including WS-Print and WS-Scan), and should provide some clarity to specification authors, application-layer implementers, and generic stack implementers alike.</P>]]></content:encoded>
    </item>
    <item>
      <title>WS-DD standardization update</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/ws-dd-standardization-update</link>
      <pubDate>Fri, 30 Jan 2009 21:01:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2009/01/30/ws-dd-standardization-update/</guid>
      <description><![CDATA[Just under six months ago, DPWS, WS-Discovery and SOAP-over-UDP entered standardization in the OASIS...]]></description>
      <content:encoded><![CDATA[<P>Just under six months ago, DPWS, WS-Discovery and SOAP-over-UDP <A href="https://blogs.msdn.com/dandris/archive/2008/08/29/dpws-ws-discovery-and-soap-over-udp-entering-standardization.aspx" mce_href="https://blogs.msdn.com/dandris/archive/2008/08/29/dpws-ws-discovery-and-soap-over-udp-entering-standardization.aspx">entered standardization</A> in the <A href="https://www.oasis-open.org/committees/ws-dd/" mce_href="https://www.oasis-open.org/committees/ws-dd/">OASIS WS-DD technical committee</A>.&nbsp; An incredible amount of work and progress has been made during that time, and the committee has just published the second draft of the 1.1 versions of each specification.</P>
<P>As I mentioned in my earlier posts, this is a very important step for these specifications as the entire DPWS community comes together to collaborate on the specifications and refine and improve the contents.&nbsp; In fact, this technical committee has filed and handled nearly 150 different issues across all three specifications, and has improved the utility and broad applicability of the specs without changing the core fundamentals set out in the 1.0 versions.</P>
<P>Although the dates have slipped a little, it is expected that the specs will enter the 60-day OASIS public review period shortly, bringing us even closer to the date when DPWS will be a standard.</P>]]></content:encoded>
    </item>
    <item>
      <title>Release and Terminate in WSDAPI objects</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/release-and-terminate-in-wsdapi-objects</link>
      <pubDate>Wed, 31 Dec 2008 18:40:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2008/12/31/release-and-terminate-in-wsdapi-objects/</guid>
      <description><![CDATA[A lot of WSDAPI objects implement IUnknown, so the expose the Release() method.&nbsp; A few more...]]></description>
      <content:encoded><![CDATA[<P>A lot of WSDAPI objects implement <A href="https://msdn.microsoft.com/en-us/library/ms680509(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms680509(VS.85).aspx">IUnknown</A>, so the expose the <A href="https://msdn.microsoft.com/en-us/library/ms682317(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms682317(VS.85).aspx">Release()</A> method.&nbsp; A few more also support <A href="https://msdn.microsoft.com/en-us/library/aa385955(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa385955(VS.85).aspx">Terminate()</A>.&nbsp; What's the difference, and which should you call?</P>
<P>Ultimately, you should always refer&nbsp;to the <A href="https://msdn.microsoft.com/en-us/library/aa386288(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa386288(VS.85).aspx">documentation</A>, as rules for specific objects may differ from the norm.&nbsp; But in most cases, the following guidelines apply:</P>
<UL>
<LI><STRONG>Terminate</STRONG> should always be called if the object was properly initialized, and should be called before calling Release.&nbsp; Terminate often does last-minute cleanup work that cannot occur inside Release, such as synchronizing threads, or cleaning other objects that may have references back to this object.&nbsp; Failing to call Terminate could result in access violations as other threads continue to run, or could result in reference loops and leaks.</LI>
<LI><STRONG>Release</STRONG> should always be called when you're discarding a reference to the object.&nbsp; Release should be called even if Terminate is also required.</LI></UL>
<P>Often, my cleanup code looks like this:</P>
<P>HRESULT hr = S_OK;<BR><A href="https://msdn.microsoft.com/en-us/library/aa385941(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa385941(VS.85).aspx">IWSDDeviceHost</A> *pDeviceHost = NULL;<BR><BR>hr = <A href="https://msdn.microsoft.com/en-us/library/aa386292(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa386292(VS.85).aspx">WSDCreateDeviceHost</A>( ..., &amp;pDeviceHost );<BR><BR>// ...initialize and use pDeviceHost...<BR><BR>if( NULL != pDeviceHost )<BR>{<BR>&nbsp;&nbsp;&nbsp; // Always terminate pDeviceHost if it was successfully&nbsp;created/initialized<BR>&nbsp;&nbsp;&nbsp; hr = pDeviceHost-&gt;<A href="https://msdn.microsoft.com/en-us/library/aa385955(VS.85).aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa385955(VS.85).aspx">Terminate</A>();<BR>&nbsp;&nbsp;&nbsp; // Optionally print an error if Terminate failed<BR><BR>&nbsp;&nbsp;&nbsp; // Always&nbsp;release pDeviceHost, even if Terminate failed<BR>&nbsp;&nbsp;&nbsp; pDeviceHost-&gt;Release();<BR>&nbsp;&nbsp;&nbsp; pDeviceHost = NULL;<BR>}</P>]]></content:encoded>
    </item>
    <item>
      <title>Web Services stacks on Windows</title>
      <link>https://docs.microsoft.com/archive/blogs/dandris/web-services-stacks-on-windows</link>
      <pubDate>Wed, 31 Dec 2008 17:53:00 GMT</pubDate>
      <dc:creator><![CDATA[Dan Driscoll]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/dandris/2008/12/31/web-services-stacks-on-windows/</guid>
      <description><![CDATA[It has never been particularly easy to choose a Web Services stack on which to build your...]]></description>
      <content:encoded><![CDATA[<P>It has never been particularly easy to choose a Web Services stack on which to build your application.&nbsp; Microsoft has produced many over the years (for example, WCF and&nbsp;WSDAPI) and other software vendors produce even more.&nbsp; The feature sets of these stacks often overlaps, but rarely are they all exactly the same--so making a decision about which stack to use can be complicated and time-consuming.</P>
<P>And things are about to get even more complicated--but for very good reason--with the introduction of the Windows Web Services API (WWSAPI).&nbsp; Even though it means one more stack to choose from, I'm actually very excited about WWSAPI, because it brings WCF-like functionality to native non-managed Windows applications.&nbsp; This fills a big gap in the development story for Web Services.</P>
<P>So soon there will be at least three different stacks you can use to build WS applications.</P>
<UL>
<LI><STRONG>Web Services on Devices API (WSDAPI)&nbsp;</STRONG>is the one-stop shop for building applications on&nbsp;DPWS, WSD, or WS-Discovery.&nbsp; If you use any of these three technologies, use WSDAPI.&nbsp; (And if you're lost in the acronyms, see <A href="https://blogs.msdn.com/dandris/archive/2008/05/30/acronym-soup.aspx" mce_href="https://blogs.msdn.com/dandris/archive/2008/05/30/acronym-soup.aspx">this post</A>.)</LI>
<LI><STRONG>Windows Communication Foundation (WCF) </STRONG>is the generic Web Services stack available in .NET.&nbsp; If you're not communicating with devices but are using managed code, use WCF.</LI>
<LI><STRONG>Windows Web Services API (WWSAPI) </STRONG>is the generic Web Services stack available on Windows.&nbsp; If you're not communicating with devices but are using native code, use WWSAPI.</LI></UL>
<P>Additionally, there are other technology-specific WS stacks available in Windows (such as <A href="https://msdn.microsoft.com/en-us/library/aa384426.aspx" mce_href="https://msdn.microsoft.com/en-us/library/aa384426.aspx">WinRM</A> for WS-Management)&nbsp;that I'm not listing here for brevity.</P>
<P>The short version is that if you're using devices, WSDAPI is probably the first place to look for Web Services connectivity.&nbsp; For more generic Web Services applications, WWSAPI is a great solution if you're writing native code.</P>
<P>More information&nbsp;on WWSAPI can be found on the blogs of two WWSAPI team members, <A href="https://blogs.msdn.com/haoxu/default.aspx" mce_href="https://blogs.msdn.com/haoxu/default.aspx">Hao Xu</A> and <A href="https://blogs.msdn.com/nikolad/default.aspx" mce_href="https://blogs.msdn.com/nikolad/default.aspx">Nikola Dudar</A>.</P>]]></content:encoded>
    </item>
  </channel>
</rss>