国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
如何看懂一個WSDL文檔
如何看懂一個WSDL文檔
 

WSDL 指網(wǎng)絡(luò)服務(wù)描述語言 (Web Services Description Language)。一個WSDL文檔是一個服務(wù)的描述,它描述了:服務(wù)名,服務(wù)地址,服務(wù)能用什么協(xié)議訪問,服務(wù)有哪些方法,每個方法有幾部分參數(shù),每個參數(shù)的類型。

在一個WSDL文檔中,你最經(jīng)??吹降脑厍熬Y會有wsdlsoap、xsd。當(dāng)然這些前綴是與命名空間URI對應(yīng)的,前綴是可以自己定義的,或許與此不同,但大都這么定義。

WSDL在設(shè)計時,充分考慮了,各個元素模塊的重用(好像一個類中定義了一些方法,可被不同方法共同調(diào)用)如:wsdl:binding、wsdl:portType、wsdl:message,你定義的這個元素可能被幾個地方引用到。所以WSDL設(shè)計者把它設(shè)計的夠精簡、靈活。

下面我基于WSDL 1.2 語法分別對三個命名空間的經(jīng)常用到的元素解釋一下:最好從下往上看

//文檔的根元素,表示這是一個服務(wù)的定義,在此定義中默認(rèn)的名字空間URIhttp://axisversion.sample”.
<wsdl:definitions xmlns:axis2="http://axisversion.sample" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns0="http://axisversion.sample/xsd" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://axisversion.sample">
<wsdl:documentation>
        This service is to get the running Axis version
    </wsdl:documentation>

//為它表示所有消息中能使用的基本元素類型,如一個方法三個參數(shù)的其中一個參數(shù)的類型。
<wsdl:types>
   <xs:schema xmlns:ns="http://axisversion.sample/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://axisversion.sample/xsd">

//為了最大程度的平臺中立性,WSDL 使用 XML Schema 語法來定義數(shù)據(jù)類型

    <xs:element name="ExceptionFault">
     <xs:complexType>
      <xs:sequence>
       <xs:element name="Exception" nillable="true" type="xs:anyType"/>
      </xs:sequence>
     </xs:complexType>
    </xs:element>
    <xs:element name="getVersionResponse">
     <xs:complexType>
      <xs:sequence>
       <xs:element name="return" nillable="true" type="xs:string"/>
      </xs:sequence>
     </xs:complexType>
    </xs:element>
   </xs:schema>
</wsdl:types>

//這是定義一個消息,是一次服務(wù)調(diào)用的一個消息。也就是下面的方法可以用到(指定)的方法參數(shù)。

<wsdl:message name="getVersionMessage"/>
<wsdl:message name="getVersionResponse">
   <wsdl:part name="part1" element="ns0:getVersionResponse"/>//
這是這個消息的第一人部分,同方法的第一個參數(shù)
</wsdl:message>
<wsdl:message name="getVersionFault">
   <wsdl:part name="part1" element="ns0:ExceptionFault"/>
</wsdl:message>

*//端口類型,它表示被某種端口類型(訪問協(xié)議)指定的一組可被這個端口執(zhí)行的操作,以及相關(guān)消息,你可以它理解為可被調(diào)用的一個函數(shù)庫。  
<wsdl:portType name="VersionPortType">

//操作,它表示其中一個操作
   <wsdl:operation name="getVersion">

//輸入,用它指定一個輸入消息
    <wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" message="axis2:getVersionMessage" wsaw:Action="urn:getVersion"/>

//輸出,用它指定一個返回消息
    <wsdl:output message="axis2:getVersionResponse"/>

//錯誤,用它指明發(fā)生錯誤時,返回的消息
    <wsdl:fault message="axis2:getVersionFault" name="getVersionFault"/>
   </wsdl:operation>
</wsdl:portType>

//綁定,此元素詳細(xì)描述了某個端口,的消息傳輸協(xié)議和消息包裝格式。(用于服務(wù)器端收到消息中的解析)
<wsdl:binding name="VersionSOAP11Binding" type="axis2:VersionPortType">
   <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>

//此處用于表示,當(dāng)收到一個消息請求方法為“urn:getVersion”時,用此元素包含的描述定義來解析此消息。并確定消息所請求的方法所對應(yīng)的服務(wù)的方法“wsdl:operation name="getVersion”。   <wsdl:operation name="getVersion">
    <soap:operation soapAction="urn:getVersion" style="document"/>
    <wsdl:input>
     <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
     <soap:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="getVersionFault">
     <soap12:fault use="literal" name="getVersionFault"/>
    </wsdl:fault>
   </wsdl:operation>
</wsdl:binding>

//SOAP:binding是采用SOAP1.1版本。soap12:binding是采用SOAP1.2版本, 并且是采用SOAP規(guī)范來形成HTTPRequest
<wsdl:binding name="VersionSOAP12Binding" type="axis2:VersionPortType">
   <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
   <wsdl:operation name="getVersion">
    <soap12:operation soapAction="urn:getVersion" style="document"/>
    <wsdl:input>
     <soap12:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
     <soap12:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="getVersionFault">
     <soap12:fault use="literal" name="getVersionFault"/>
    </wsdl:fault>
   </wsdl:operation>
</wsdl:binding>

//此binding 是采用HTTP規(guī)范來填寫消息內(nèi)容
<wsdl:binding name="VersionHttpBinding" type="axis2:VersionPortType">
   <http:binding verb="POST"/>
   <wsdl:operation name="getVersion">
    <http:operation location="getVersion"/>
    <wsdl:input>
     <mime:content type="text/xml"/>
    </wsdl:input>
    <wsdl:output>
     <mime:content type="text/xml"/>
    </wsdl:output>
   </wsdl:operation>
</wsdl:binding>

//此元素用于描述一個服務(wù)定義中其中的一個服務(wù)(可定義多個服務(wù))。和此服務(wù)所有可訪問的端口和訪問地址
<wsdl:service name="Version">
   <wsdl:port name="VersionSOAP11port_http" binding="axis2:VersionSOAP11Binding">
    <soap:address location="http://192.9.107.58:8080/axis2/services/Version"/>
   </wsdl:port>
   <wsdl:port name="VersionSOAP12port_http" binding="axis2:VersionSOAP12Binding">
    <soap12:address location="http://192.9.107.58:8080/axis2/services/Version"/>
   </wsdl:port>

   <wsdl:port name="VersionHttpport" binding="axis2:VersionHttpBinding">
    <http:address location="http://192.9.107.58:8080/axis2/services/Version"/>
   </wsdl:port>
</wsdl:service>
</wsdl:definitions>

 

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Web Service基礎(chǔ)(WSDL、SOAP)
WebServiceWSDL結(jié)構(gòu)分析
【原創(chuàng)】用Visual C 客戶端調(diào)用Weblogic的Webservice
WSDL 綁定
Camel組件之CXF | salever的小站
熱門技術(shù)中的應(yīng)用-微服務(wù)中的相關(guān)協(xié)議2-SOAP:不用說NBA,請說美國職業(yè)籃球聯(lián)賽
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服