WSDL - <service> 元素



<service> 元素定義 Web 服務支援的埠。對於每個支援的協議,都會有一個埠元素。service 元素是埠的集合。

  • Web 服務客戶端可以從 service 元素中瞭解以下資訊:

    • 訪問服務的位置
    • 訪問 Web 服務的埠
    • 通訊訊息的定義方式
  • service 元素包括文件元素,用以提供面向人的文件。

下面是從案例章節中摘錄的一段程式碼:-

<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>
廣告
© . All rights reserved.