Web Services Description Language
表示

Web Services Description Language (WSDL ウィズダル) とは、Webサービス記述言語の意で、SOAPによるXML Webサービスのインタフェースを記述するインタフェース記述言語。通常その表現にはXMLを使う。WSDLは、サービスの呼出方法、それが期待するパラメータ群、それが返すデータ型について、機械可読な形式の記述を提供する。従って、その目的はプログラミング言語におけるメソッド・シグネチャの役割に似ている。
WSDLの現在のバージョンはWSDL 2.0である。省略語WSDLにおけるDの意味はバージョン1.1当時の「Definition」から変更されている。
関連文書に多数の混乱があるため、まず、必ずWS-IのBasic Profileの「5. Service Description」[1]を熟読すべきである。
WSDLの構成要素
- types
- message
- operation
- portType
- binding
- port
- service
WSDL ファイル サンプル
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.w3.org/ns/wsdl"
xmlns:tns="http://www.tmsws.com/wsdl20sample"
xmlns:whttp="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:wsoap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="http://www.tmsws.com/wsdl20sample">
<!-- Abstract type -->
<types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.tmsws.com/wsdl20sample"
targetNamespace="http://www.example.com/wsdl20sample">
<xs:element name="request"> ... </xs:element>
<xs:element name="response"> ... </xs:element>
</xs:schema>
</types>
<!-- Abstract interfaces -->
<interface name="Interface1">
<fault name="Error1" element="tns:response"/>
<operation name="Get" pattern="http://www.w3.org/ns/wsdl/in-out">
<input messageLabel="In" element="tns:request"/>
<output messageLabel="Out" element="tns:response"/>
</operation>
</interface>
<!-- Concrete Binding Over HTTP -->
<binding name="HttpBinding" interface="tns:Interface1"
type="http://www.w3.org/ns/wsdl/http">
<operation ref="tns:Get" whttp:method="GET"/>
</binding>
<!-- Concrete Binding with SOAP-->
<binding name="SoapBinding" interface="tns:Interface1"
type="http://www.w3.org/ns/wsdl/soap"
wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"
wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response">
<operation ref="tns:Get" />
</binding>
<!-- Web Service offering endpoints for both bindings-->
<service name="Service1" interface="tns:Interface1">
<endpoint name="HttpEndpoint"
binding="tns:HttpBinding"
address="http://www.example.com/rest/"/>
<endpoint name="SoapEndpoint"
binding="tns:SoapBinding"
address="http://www.example.com/soap/"/>
</service>
</definitions>