DPWS 设备的容器 ID

从 Windows 7 开始,支持 PnP 扩展 (PnP-X) 和适用于 Web 服务的设备配置文件 (DPWS) 的设备可以通过在设备元数据文档中包括 ContainerId XML 元素来指定容器 ID。 有关 DPWS 和 DPWS 设备元数据文档的详细信息,请参阅 DPWS 规范。

注意

从 Windows 10 开始,系统会忽略设备提供的容器 ID,而是自行生成容器 ID。 它通过使用设备终结点引用地址中的 GUID (EPR) 或设备的 EPR (的 SHA-1 哈希(如果不是 GUID) )来执行此操作。

ContainerId XML 元素的声明如下:

<df:ContainerId xmlns:df="">
  xs:string
</df:ContainerId>

ContainerId XML 元素类型是一个字符串,其值为全局唯一标识符 (GUID) 格式化。 此字符串的格式为 {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

下面是 ContainerId XML 元素的示例。

<df:ContainerId xmlns:df="">
  {101392d0-5e91-11dd-ad8b-0800200c9a66}
</df:ContainerId>

<ContainerId> XML 元素必须位于<设备元数据交换简单对象访问协议 (SOAP) 消息的 ThisDevice> 部分中。 以下示例演示了 ContainerId> 元素在元数据交换消息中的正确位置<。

注意

这不是完整的 DPWS 元数据交换文档。 有关 DPWS 的详细信息,请参阅 DPWS 规范。

<soap:Envelope
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
    xmlns:wsdisco="http://schemas.xmlsoap.org/ws/2005/04/discovery"
    xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
    xmlns:wsd="http://schemas.xmlsoap.org/ws/2006/02/devprof"
    xmlns:df="http://schemas.microsoft.com/windows/2008/09/devicefoundation">

    <soap:Header>
        <!-- Place SOAP header information here.-->
    </soap:Header>

    <soap:Body>
        <wsx:Metadata>

           <wsx:MetadataSection
                Dialect="http://schemas.xmlsoap.org/ws/2005/05/devprof/ThisModel">
                <wsd:ThisDevice>
                    <!-- Place ThisDevice metadata here.-->
                    <df:ContainerId>
                        <!--- Place the ContainerID GUID here.--->
                        {101392d0-5e91-11dd-ad8b-0800200c9a66}
                    </df:ContainerId>
                </wsd:ThisDevice>
            </wsx:MetadataSection>

        </wsx:Metadata>
    </soap:Body>
</soap:Envelope>

如果 DPWS 设备元数据文档不包括 ContainerId XML 元素,即插即用 (PnP) 管理器将使用设备的终结点引用地址的值作为容器 ID。