• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • WebService描述語言WSDL詳解(2)

    發表于:2007-05-25來源:作者:點擊數: 標簽:WebServiceWSDL描述詳解語言
    WSDL文件示例 讓我們來研究一下WSDL文件,看看它的結構,以及如何工作。請注意這是一個非常簡單的WSDL文檔實例。我們的意圖只是說明它最顯著的特征。以下的內容中包括更加詳細的討論。 <?xml version="1.0" encoding="UTF-8" ?> <definitions name="FooSa

    WSDL文件示例

      讓我們來研究一下WSDL文件,看看它的結構,以及如何工作。請注意這是一個非常簡單的WSDL文檔實例。我們的意圖只是說明它最顯著的特征。以下的內容中包括更加詳細的討論。

    <?xml version="1.0" encoding="UTF-8" ?>
    <definitions name="FooSample"
     targetNamespace="http://tempuri.org/wsdl/"
     xmlns:wsdlns="http://tempuri.org/wsdl/"
     xmlns:typens="http://tempuri.org/xsd"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
     xmlns:stk="http://schemas.microsoft.com/soap-toolkit/wsdl-extension"
     xmlns="http://schemas.xmlsoap.org/wsdl/">

    <types>
    <schema targetNamespace="http://tempuri.org/xsd"
      xmlns="http://www.w3.org/2001/XMLSchema"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
      elementFormDefault="qualified" >
    </schema>
    </types>

    <message name="Simple.foo">
    ?。紁art name="arg" type="xsd:int"/>
    </message>

    <message name="Simple.fooResponse">
    ?。紁art name="result" type="xsd:int"/>
    </message>

    <portType name="SimplePortType">
    ?。紀peration name="foo" parameterOrder="arg" >
     ?。糹nput message="wsdlns:Simple.foo"/>
     ?。紀utput message="wsdlns:Simple.fooResponse"/>
    ?。?operation>
    </portType>

    <binding name="SimpleBinding" type="wsdlns:SimplePortType">
    ?。約tk:binding preferredEncoding="UTF-8" />
    ?。約oap:binding style="rpc"
      transport="http://schemas.xmlsoap.org/soap/http"/>
    ?。紀peration name="foo">
     ?。約oap:operation soapAction="http://tempuri.org/action/Simple.foo"/>
     ?。糹nput>
      ?。約oap:body use="encoded" namespace="http://tempuri.org/message/"
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
     ?。?input>
     ?。紀utput>
      ?。約oap:body use="encoded" namespace="http://tempuri.org/message/"
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
     ?。?output>
    ?。?operation>
    </binding>

    <service name="FOOSAMPLEService">
    ?。紁ort name="SimplePort" binding="wsdlns:SimpleBinding">
     ?。約oap:address location="http://carlos:8080/FooSample/FooSample.asp"/>
    ?。?port>
    </service>
    </definitions>

      以下是該實例文檔的總述:稍后我將詳細討論每一部分的細節。

      第一行申明該文檔是XML。盡管這并不是必需的,但它有助于XML解析器決定是否解析WSDL文件或只是報錯。第二行是WSDL文檔的根元素:<definitions>。一些屬性附屬于根元素,就像<schema>子元素對于<types>元素。

     ?。紅ypes>元素包含了Types欄。如果沒有需要聲明的數據類型,這欄可以缺省。在WSDL范例中,沒有應用程序特定的types聲明,但我仍然使用了Types欄,只是為了聲明schema namespaces。

     ?。糾essage>元素包含了Messages欄。如果我們把操作看作函數,<message>元素定義了那個函數的參數。<message>元素中的每個<part>子元素都和某個參數相符。輸入參數在<message>元素中定義,與輸出參數相隔離--輸出參數有自己的<message>元素。兼作輸入、輸出的參數在輸入輸出的<message>元素中有它們相應的<part>元素。輸出<message>元素以"Response"結尾,就像以前所用的"fooResponse"。每個<part>元素都有名字和類型屬性,就像函數的參數有參數名和參數類型。

      用于交換文檔時,WSDL允許使用<message>元素來描述交換的文檔。

     ?。紁art>元素的類型可以是XSD基類型,也可以是SOAP定義類型(soapenc)、WSDL定義類型(wsdl)或是Types欄定義的類型。

      一個PortTypes欄中,可以有零個、單個或多個<portType>元素。由于抽象PortType定義可以放置在分開的文件中,在某個WSDL文件中沒有<portType>元素是可能的。上面的例子里只是用了一個<portType>元素。而一個<portType>元素可在<operation>元素中定義一個或是多個操作。示例僅使用了一個名為"foo"的<operation>元素。這和某個函數名相同。<operation>元素可以有一個、兩個、三個子元素:<input>, <output> 和<fault>元素。每個<input>和<output>元素中的消息都引用Message欄中的相關的<message>元素。這樣,示例中的整個<portType>元素就和以下的C函數等效:

     
     int foo(int arg);

      這個例子足見XML和C相比要冗長的多。(包括<message>元素,XML在示例中共使用了12行代碼來表達相同的單行函數聲明。)

      Bindings欄可以有零個、一個或者多個<binding>元素。它的意圖是制定每個<operation>通過網絡調用和回應。Services欄同樣可以有零個、一個、多個<service>元素。它還包含了<port>元素,每個<port>元素引用一個Bindings欄里的<binding>元素。Bindings和Services欄都包含WSDL文檔。

    原文轉自:http://www.kjueaiud.com

    評論列表(網友評論僅供網友表達個人看法,并不表明本站同意其觀點或證實其描述)
    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>