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>

