[WSDL]WSDL(web service document language)简介

A WSDL document describes a web service using these major elements:

(一个WSDL 文件 主要用包含以下4种元素)
Element     Defines
<portType>    The operations performed by the web service
<message>    The messages used by the web service
<types>     The data types used by the web service
<binding>    The communication protocols used by the web service

WSDL Example1:(例)
<definitions>
<types>
 definition of types...
</types>

<message>
 definition of a message...
</message>

<portType>
 definition of a port...
</portType>

<binding>
 definition of a binding...
</binding>

WSDL Example2:(例2)
<message name="getTermRequet">
 <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 Operation Types (WSDL4种 运算类型)
Type                                    Definition
One-way                             The operation can receive a message but will not return a response
Request-response The   operation can receive a request and will return a response
Solicit-response               The operation can send a request and will wait for a response
Notification                         The operation can send a message but will not wait for a response

1.One-Way Operation(例1--单向请求方式)

A one-way operation example:
<message name="newTermValus">
 <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>

2.Request-Response Operation(例2--请求相应方式)
A request-response operation example:
<message name="getTermRequest">
 <part name="term" type="xs:string"/>
</message>
<message name="getTermResponse">
 <part name="term" type="xs:string"/>
</message>
<portType name="glossaryTerms">
 <operation name="getTerm">
  <input message="getTermRequest"/>
  <output message="getTermResponse"/>
 </operation>
</portType>

[WSDL Bindings]
1.Binding to SOAP
A request-response operation example:
<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 and UDDI]
UDDI(Universal Description, Discovery and Integration )

[The Full WSDL Syntax](全部 WSDL 语法集合)
The full WSDL 1.2 syntax as described in the W3C Working Draft is listed below.

<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" service="qname"> [*]
  <wsdl:documentation ... /> [?]
  
  <wsdl:port name="ncname" binding="qname"> [*]
   <wsdl:documentation ... /> [?]
   <!-- address details -->
  </wsdl:port>
 </wsdl:service>
 
 
</wsdl:definitions> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值