WSDL - 服务元素

< service> 元素定义了Web服务支持的端口.对于每个支持的协议,都有一个端口元素. service元素是端口的集合.

  • 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 = "https://img01.yuandaxia.cn/Content/img/tutorials/wsdl/error.aspx
   <operation name = "sayHello">
      <soap:operation soapAction = "sayHello"/>
		
      <input>
         <soap:body
            encodingStyle = "https://img01.yuandaxia.cn/Content/img/tutorials/wsdl/"
            namespace = "urn:examples:helloservice" use = "encoded"/>
      </input>
			
      <output>
         <soap:body
            encodingStyle = "https://img01.yuandaxia.cn/Content/img/tutorials/wsdl/"
            namespace = "urn:examples:helloservice" use = "encoded"/>
      </output>
   </operation>
</binding>