- WSDL 元素
- WSDL - <definitions>
- WSDL - <types>
- WSDL - <message>
- WSDL - <portType>
- WSDL - <binding>
- WSDL - <ports>
- WSDL - <service>
- WSDL 参考文献
- WSDL - 摘要
- WSDL - 参考文献
- WSDL 有用资源
- WSDL - 快速指南
- WSDL - 有用资源
- WSDL - 讨论
WSDL - <definition> 元素
<definitions> 元素必须是所有 WSDL 文档的根元素。它定义了 Web 服务的名称。
以下是使用 definitions 元素的上个章节中的代码片段。
<definitions name="HelloService" targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> ................................................ </definitions>
从上面的示例中,我们可以得出结论,definitions −
是所有其他元素的容器。
指定此文档称为 HelloService。
指定了 targetNamespace 属性。targetNamespace 是 XML Schema 的一种约定,使 WSDL 文档可以引用自身。在此示例中,我们指定了 http://www.examples.com/wsdl/HelloService.wsdl 的 targetNamespace
指定一个默认名称空间:xmlns=http://schemas.xmlsoap.org/wsdl/。因此,所有没有名称空间前缀的元素,如 message 或 portType 均假定是默认 WSDL 名称空间的一部分。
指定了整个文档的其余部分所使用的多个名称空间。
注意 - 名称空间规范不要求文档出现在给定的位置。关键是要指定一个其他所有定义的名称空间都不同的唯一值。
广告