WSDL 接口

WSDL 接口文档定义由特定 portType 定义的操作和消息的消息格式。可以生成包含所有 WSDL 元素的整体式 WSDL 文档,也可以生成单独的 WSDL 接口文档。

WSDL 接口文档包含下列顶级元素:
portType
一个或多个端口支持的一个或多个操作的抽象集合。每个操作定义输入和输出消息以及可选的故障消息。端口可支持下列操作类型:
  • 单向。端口接收输入消息,但是不会获得回复。
  • 请求-响应。端口接收输入消息,然后发送相关的输出消息。
Message
在服务请求者与服务提供者之间传递的数据的抽象类型化定义。一条消息可以具有一个或多个类型化部分,但是正如 WS-I 所定义的那样,各个部分之间可能存在互操作性(取决于 RPC 或“文档”)。
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 1999, 2005. All Rights Reserved.