1.WSDL 简介

来源:互联网 发布:立冬为什么吃饺子 知乎 编辑:程序博客网 时间:2024/06/02 06:01
WSDL 是基于 XML 的用于描述 Web Services 以及如何访问 Web Services 的语言。

这里写图片描述


WSDL 文档
这里写图片描述

<definitions><types>   definition of types........</types><message>   definition of a message....</message><portType>   definition of a port.......</portType><binding>   definition of a binding....</binding></definitions>

这里写图片描述

<message name="getTermRequest">   <part name="term" type="xs:string"/></message><message name="getTermResponse">   <part name="value" type="xs:string"/></message><portType name="glossaryTerms">  <operation name="getTerm">        <input message="getTermRequest"/>        <output message="getTermResponse"/>  </operation></portType>

这里写图片描述


WSDL 端口
这里写图片描述

One-Way 操作
一个 one-way 操作的例子:

<message name="newTermValues">   <part name="term" type="xs:string"/>   <part name="value" type="xs:string"/></message><portType name="glossaryTerms">   <operation name="setTerm">      <input name="newTerm" message="newTermValues"/>   </operation></portType >

这里写图片描述

Request-Response 操作
一个 request-response 操作的例子:

<message name="getTermRequest">   <part name="term" type="xs:string"/></message><message name="getTermResponse">   <part name="value" type="xs:string"/></message><portType name="glossaryTerms">  <operation name="getTerm">    <input message="getTermRequest"/>    <output message="getTermResponse"/>  </operation></portType>
在这个例子中,端口 "glossaryTerms" 定义了一个名为 "getTerm"request-response 操作。"getTerm" 操作会请求一个名为 "getTermRequest" 的输入消息,此消息带有一个名为 "term" 的参数,并将返回一个名为 "getTermResponse" 的输出消息,此消息带有一个名为 "value" 的参数。

WSDL 绑定
这里写图片描述

<message name="getTermRequest">   <part name="term" type="xs:string" /></message><message name="getTermResponse">   <part name="value" type="xs:string" /></message><portType name="glossaryTerms">  <operation name="getTerm">      <input message="getTermRequest" />      <output message="getTermResponse" />  </operation></portType><binding type="glossaryTerms" name="b1"><soap:binding style="document"transport="http://schemas.xmlsoap.org/soap/http" />  <operation>    <soap:operation     soapAction="http://example.com/getTerm" />    <input>      <soap:body use="literal" />    </input>    <output>      <soap:body use="literal" />    </output>  </operation></binding>

这里写图片描述


WSDL 和 UDDI
这里写图片描述


完整的 WSDL 语法

<wsdl:definitions name="nmtoken"? targetNamespace="uri">    <import namespace="uri" location="uri"/> *    <wsdl:documentation .... /> ?    <wsdl:types> ?        <wsdl:documentation .... /> ?        <xsd:schema .... /> *    </wsdl:types>    <wsdl:message name="ncname"> *        <wsdl:documentation .... /> ?        <part name="ncname" element="qname"? type="qname"?/> *    </wsdl:message>    <wsdl:portType name="ncname"> *        <wsdl:documentation .... /> ?        <wsdl:operation name="ncname"> *            <wsdl:documentation .... /> ?            <wsdl:input message="qname"> ?                <wsdl:documentation .... /> ?            </wsdl:input>            <wsdl:output message="qname"> ?                <wsdl:documentation .... /> ?            </wsdl:output>            <wsdl:fault name="ncname" message="qname"> *                <wsdl:documentation .... /> ?            </wsdl:fault>        </wsdl:operation>    </wsdl:portType>    <wsdl:serviceType name="ncname"> *        <wsdl:portType name="qname"/> +    </wsdl:serviceType>    <wsdl:binding name="ncname" type="qname"> *        <wsdl:documentation .... /> ?        <-- binding details --> *        <wsdl:operation name="ncname"> *            <wsdl:documentation .... /> ?            <-- binding details --> *            <wsdl:input> ?                <wsdl:documentation .... /> ?                <-- binding details -->            </wsdl:input>            <wsdl:output> ?                <wsdl:documentation .... /> ?                <-- binding details --> *            </wsdl:output>            <wsdl:fault name="ncname"> *                <wsdl:documentation .... /> ?                <-- binding details --> *            </wsdl:fault>        </wsdl:operation>    </wsdl:binding>    <wsdl:service name="ncname" serviceType="qname"> *        <wsdl:documentation .... /> ?        <wsdl:port name="ncname" binding="qname"> *            <wsdl:documentation .... /> ?            <-- address details -->        </wsdl:port>    </wsdl:service></wsdl:definitions>
0 0
原创粉丝点击