WSDL 介面

WSDL 介面文件定義特定 portType 所定義之作業和訊息的訊息格式。您可以產生其中包含所有 WSDL 元素的整體 WSDL 文件,也可以產生個別 WSDL 介面文件。

WSDL 介面文件含有下列最上層元素:
portType。
這是一或多個埠支援的一組抽象作業,其中有一或多項作業。每項作業都會定義一則輸入和輸出訊息,以及一則選用的錯誤訊息。埠可以支援下列作業類型:
  • 單向。埠會接收一則輸入訊息,且不預期回覆。
  • 要求-回應。埠會接收一則輸入訊息,再送出一則相關的輸出訊息。
Message。
這是在服務要求者和服務提供者之間的通訊資料的抽象類型化定義。 訊息可以有一或多個類型化的組件,不過,組件數隱含的交互作業能力會視 RPC 或 Document 而定(如 WS-I 所定義)。
Type。
這是使用某些類型系統(如 XSD)的資料類型定義儲存器。

下列 WSDL 介面文件是依據 StockQuoteService 範例。

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="StockQuoteService" targetNamespace="http:///"
    xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http:///"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <message name="getQuoteRequest">
        <part name="symbol" type="xsd:string"/>
    </message>
    <message name="getQuoteResponse">
        <part name="result" type="xsd:float"/>
    </message>
  <!--   This service interface file defines a single port  
-->
  <!--   type StockQuoteServiceJavaPortType                 
-->
  <!--   with only one operation getQuote.                  
-->
    <portType name="StockQuoteService">
    <!--   The operation makes use of two abstract messages  
-->
    <!--   getQuoteRequest and getQuoteResponse.             
-->
        <operation name="getQuote" parameterOrder="symbol">
            <input message="tns:getQuoteRequest"
name="getQuoteRequest"/>
            <output message="tns:getQuoteResponse"
name="getQuoteResponse"/>
        </operation>
    </portType>
</definitions>
使用條款 | 讀者意見
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.