WSDL - <service> 元素
<service>元素定义 Web 服务支持的端口。对于每一种受支持的协议,都有一个端口元素。服务元素是端口的集合。
Web 服务客户端可以从服务元素中了解以下内容 -
- 在哪里访问该服务,
- 通过哪个端口访问 Web 服务,以及
- 如何定义通信消息。
服务元素包括文档元素以提供人类可读的文档。
这是示例章节中的一段代码 -
<service name = "Hello_Service">
<documentation>WSDL File for HelloService</documentation>
<port binding = "tns:Hello_Binding" name = "Hello_Port">
<soap:address
location = "http://www.examples.com/SayHello/">
</port>
</service>
port元素的绑定属性将服务的地址与 Web 服务中定义的绑定元素相关联。在此示例中,这是Hello_Binding
<binding name =" Hello_Binding" type = "tns:Hello_PortType">
<soap:binding style = "rpc"
transport = "http://schemas.xmlsoap.org/soap/http"/>
<operation name = "sayHello">
<soap:operation soapAction = "sayHello"/>
<input>
<soap:body
encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"
namespace = "urn:examples:helloservice" use = "encoded"/>
</input>
<output>
<soap:body
encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"
namespace = "urn:examples:helloservice" use = "encoded"/>
</output>
</operation>
</binding>