以下是以XML格式表示WSDL 2.0 文件的簡單範例,檔案:hello_wsdl_20_soap.wsdl 的內容如下 -
<?xml version="1.0"?>
<wsdl:description xmlns:wsdl="http://www.w3.org/ns/wsdl"
xmlns:wsoap= "http://www.w3.org/ns/wsdl/soap"
xmlns:hy="http://www.herongyang.com/Service/"
targetNamespace="http://www.herongyang.com/Service/">
<wsdl:documentation>
Hello_WSDL_20_SOAP.wsdl
Copyright (c) 2009 HerongYang.com, All Rights Reserved.
</wsdl:documentation>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="https://www.tw511.com/service/">
<xsd:element name="Hello" type="xsd:string"/>
<xsd:element name="HelloResponse" type="xsd:string"/>
</xsd:schema>
</wsdl:types>
<wsdl:interface name="helloInterface" >
<wsdl:operation name="Hello"
pattern="http://www.w3.org/ns/wsdl/in-out"
style="http://www.w3.org/ns/wsdl/style/iri">
<wsdl:input messageLabel="In"
element="hy:Hello" />
<wsdl:output messageLabel="Out"
element="hy:HelloResponse" />
</wsdl:operation>
</wsdl:interface>
<wsdl:binding name="helloBinding"
interface="hy:helloInterface"
type="http://www.w3.org/ns/wsdl/soap"
wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/">
<wsdl:operation ref="hy:Hello"
wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/>
</wsdl:binding>
<wsdl:service name="helloService"
interface="hy:helloInterface">
<wsdl:endpoint name="helloEndpoint"
binding="hy:helloBinding"
address="h/"/>
</wsdl:service>
</wsdl:description>
在這個WSDL 2.0
範例文件中,
helloService
使用端點helloEndpoint
定義,它的存取地址是:h/ 。helloEndpoint
連結到系結helloBinding
。helloBinding
是通過HTTP上的SOAP 1.2通訊協定定義的。helloBinding
連結到介面helloInterface
。helloInterface
由一個操作Hello
定義的,該操作需要輸入訊息元素和輸出訊息元素。Hello/HelloResponse
都由Types
部分中包含的XML模式定義。