WSDL2.0 <service>元素

WSDL2.0 <service>元素是WSDL 2.0 文档的顶级元素。<service>用于定义具有一个或多个端点的服务,该端点具有给定接口的<endpoint>子元素。 使用给定绑定和通信地址定义端点。<service>元素的语法如下所示:

<wsdl:service name=nmtoken1 interface=qname1>
    <wsdl:endpoint name=nmtoken2 binding=qname2
       address=uri/>
       ...
</wsdl:service>

关于<service>元素的说明:

  • name=nmtoken1 - 提供此服务的引用名称。
  • name=nmtoken2 - 为此端点提供引用名称。
  • interface=qname1 - 通过引用<interface>元素指定接口。
  • binding=qname2 - 通过引用<binding>元素指定绑定。

以下是<service>元素的示例:

<wsdl:service name=helloService interface=hy:helloInterface>
    <wsdl:endpoint name=helloEndpoint binding=hy:helloBinding
address=http://www.jb51.cc/Service/hello_soap.php/>
</wsdl:service>

在上面示例代码中,

  • 服务 - helloService由一个端点helloEndpoint定义,
  • 端点 - helloEndpoint使用绑定的URL地址helloBinding定义。