<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 1,  comments - 25,  trackbacks - 0

    rpc和document的區(qū)別  

    2008-10-24 18:48:07|  分類: webservice|字號 訂閱

     

    翻譯自 The Difference Between RPC and Document Style WSDL

    rpc和document到底是什么意思?他們?nèi)绾瓮?encoded/literal"相關聯(lián)?二者的沖突來自哪里?

    binding的style和use

    通常情況下,web服務是由一個wadl文件來描述的的。在這個文件中,抽象的描述所支持的web服務操作和消息,然后關聯(lián)到一個具體的網(wǎng)

    絡歇息和消息格式。典型的wsdl文件由這個幾個元素組成:tyoes,message.porttype用來描述抽象的定義;biding和service指定具體的實

    現(xiàn)。所有的這些元素包裝在definitions元素中。

    在binding元素中,rpc和document是最值得我們關注的元素。wsdl 的 binding描述了如何將service關聯(lián)到消息協(xié)議;這些消息協(xié)議是

    http,mime,soap中的任意一種。不過,實際中,soap是最常用的協(xié)議;rpc和document的區(qū)別也是在soap的下的區(qū)別(it is SOAP that

    the RPC/document distinction refers to)。通常http(s)是傳輸soap消息的協(xié)議。

    <wsdl:binding>元素包含一對參數(shù),style(rpc|document)和use(encoded|literal),他倆會影響到soap消息的格式.他們的使用方式如下

    <wsdl:binding name="Config1Binding" type="prt0:CreditLimitLocalWebServiceVi_Document">

        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />

         <wsdl:operation name="creditLimitCheck">

            <soap:operation soapAction="" />

             <wsdl:input>

                <soap:body use="literal" parts="parameters" />

             </wsdl:input>

            <wsdl:output>

                <soap:body use="literal" />

             </wsdl:output>

    </wsdl:operation>

    </wsdl:binding>

    style屬性:

    wsdl1.1要求binding的style要么是rpc要么是doucment。這個選擇與如何組織soap的負荷相關。下面是分別他們?nèi)绾斡绊?lt;soap:body>內(nèi)

    容的細節(jié)。

    document:<soap:body>的內(nèi)容由定義在<wsdl:type>中的xml模式指定。他不需要遵循特定的soap規(guī)范。簡言之,soap消息是通過

    <soap:body>中的document發(fā)送出去,而沒有額外的要遵循的格式規(guī)則。document style是一種默認的選擇。

    rpc: <soap:body>元素的結(jié)構(gòu)需要遵循特定的規(guī)則(soap1.1規(guī)范第7部分有細節(jié))。根據(jù)這些規(guī)則,<soap:body>可以包含唯一一個元素

    ,這個元素在operation后被命名,所有的參數(shù)都必須寫成這個元素的子元素。

    因為可以自由的選擇哪種消息格式,遵循document格式的soap消息看上去很像rpc格式。

    現(xiàn)在,決定性的問題是:選擇其中任意一個選項后的結(jié)果是什么樣?為何要選擇rpc或者document?很多情況下,選擇他們后,soap消息

    的格式看起來很相像,那么為什么還要提供這種選擇呢?原因要從soap標準化的歷程中尋找。

    use屬性

    這個屬性指定了soap消息的編碼規(guī)則。他同樣在<wsdl:binding>元素中完成。他的值為encoded或者literal.

    他引用了一系列規(guī)則,soap客戶端和soap服務端都遵循這些規(guī)則以解釋<body>元素中的內(nèi)容。

    use="literal" 意味著type定義遵循xml模式定義

    use="encoded" 參考xml中已有的應用數(shù)據(jù),通常指的是soap1.1規(guī)范中的soap編碼規(guī)則。如果文檔中沒有自定義數(shù)據(jù),就可以選擇

    encoded。

    附文章全文:

    The Difference Between RPC and Document Style WSDL

    Summary

    RPC style and document style are catchphrases frequently heard in the context of web services and the SOAP protocol. What exactly do they mean? How do they relate to the pair of terms "encoded/literal"? Where does the confusion about these terms come from? This article describes the WSDL binding style and use attributes.

    By Susanne Rothaug

    20 Nov 2004

    Binding Style and Use

    A web service is usually described by a WSDL (Web Services Description Language) document. In this document, the supported web service operations and messages are described abstractly and then bound to a concrete network protocol and message format. A typical WSDL document consists of the following elements: "types," "message," and "portType" for the abstract definitions; "binding" and "service" for the concrete specification. All of these elements are wrapped inside a "definitions" element.

    In the context of RPC and document style, it is the binding element that we need to take a closer look at. A WSDL binding describes how the service is bound to a messaging protocol, either HTTP GET/POST, MIME, or SOAP. In practice, SOAP is the most universally used protocol; it is SOAP that the RPC/document distinction refers to. Usually HTTP(S) is used as transport protocol for the SOAP message – "SOAP over HTTP(S)."

    The <wsdl:binding> element of the WSDL contains a pair of parameters that influence the form of the resulting SOAP messages: binding style (RPC or document) and use (encoded or literal). See how style and use are defined in the WSDL fragment below: <wsdl:binding name="Config1Binding" type="prt0:CreditLimitLocalWebServiceVi_Document">     <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />      <wsdl:operation name="creditLimitCheck">         <soap:operation soapAction="" />          <wsdl:input>             <soap:body use="literal" parts="parameters" />          </wsdl:input>         <wsdl:output>             <soap:body use="literal" />          </wsdl:output> </wsdl:operation> </wsdl:binding>

    The "Style" Attribute

    WSDL 1.1 specifies the style of the binding as either RPC or document. This choice corresponds to how the SOAP payload - i.e., how the contents of the <soap:Body> element - can be structured. Here are some details of how each style affects the contents of <soap:Body>:

    • Document: the content of <soap:Body> is specified by XML Schema defined in the <wsdl:type> section. It does not need to follow specific SOAP conventions. In short, the SOAP message is sent as one "document" in the <soap:Body> element without additional formatting rules having to be considered. Document style is the default choice.

    • RPC: The structure of an RPC style <soap:Body> element needs to comply with the rules specified in detail in Section 7 of the SOAP 1.1 specification. According to these rules, <soap:Body> may contain only one element that is named after the operation, and all parameters must be represented as sub-elements of this wrapper element.

    As a consequence of the freedom of choice that the document style offers, the SOAP messages conforming to a document style WSDL may look exactly the same as the RPC equivalent.

    The decisive question now is: What are the consequences of choosing one option or another? Why choose RPC over document, or document over RPC? In many cases, the SOAP messages generated from either RPC or document style WSDLs look exactly the same - so why offer the choice at all? The reason may be found in the history of the SOAP standard.

    SOAP has its roots in synchronous remote procedure calls over HTTP and the appearance of the document accordingly followed these conventions. Later, it was seen as a simplification to use arbitrary XML in the SOAP body without adhering to conventions. This preference is reflected in the document style WSDL documents. So far, both options are represented in the WSDL specification and the choice of one or the other is mainly a question of personal taste since most SOAP clients today accept both versions.

    The "Use" Attribute

    The use attribute specifies the encoding rules of the SOAP message. This is also done within the <wsdl:binding> element, as seen in the example above. The value can be encoded or literal. It refers to the serialization rules followed by the SOAP client and the SOAP server to interpret the contents of the <Body> element in the SOAP payload.

    • use="literal" means that the type definitions literally follow an XML schema definition.

    • use="encoded" refers to the representation of application data in XML, usually according to the SOAP encoding rules of the SOAP 1.1 specification. The rules to encode and interpret a SOAP body are in a URL specified by the encodingStyle attribute. Encoded is the appropriate choice where non-treelike structures are concerned, because all others can be perfectly described in XML Schema.

    The combination of the style and use attributes leads to four possible style/use pairs:

    1. RPC/encoded

    2. RPC/literal

    3. document/encoded

    4. document/literal

    Some of these combinations are rarely used in practice, such as document/encoded. In general, the literal use is gaining importance, and as far as RPC/encoded is concerned, the Web Services Interoperability Organization (WS-I) in its Basic Profile Version 1.0a of August 2003 ruled out the use of SOAP encoding with web services. Document/literal and RPC/literal will be the only allowed style/use combinations in the future.

    posted on 2011-08-31 13:24 Daniel 閱讀(1233) 評論(0)  編輯  收藏 所屬分類: WebService
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(3)

    隨筆檔案

    文章分類

    文章檔案

    相冊

    搜索

    •  

    最新評論

    主站蜘蛛池模板: 中文字幕精品亚洲无线码一区 | 精品免费AV一区二区三区| **aaaaa毛片免费| 亚洲精品国产免费| 国产成人免费在线| 亚洲av乱码一区二区三区香蕉| 91精品免费观看| 亚洲免费在线观看视频| ww在线观视频免费观看| 亚洲最大的成人网站| 日本免费一二区在线电影| 国产高清免费视频| 亚洲国产日韩在线人成下载 | 小草在线看片免费人成视久网| 国产V亚洲V天堂无码| 99久久免费看国产精品| 亚洲jjzzjjzz在线播放| 青青青国产免费一夜七次郎| 欧亚一级毛片免费看| 国产亚洲一区二区在线观看| 最近中文字幕完整版免费高清| 亚洲免费福利在线视频| 又色又污又黄无遮挡的免费视| 一边摸一边桶一边脱免费视频| 亚洲AV无码一区二区三区系列| 0588影视手机免费看片| 色屁屁在线观看视频免费| 亚洲韩国精品无码一区二区三区| 99久久综合精品免费| 亚洲AV永久无码精品网站在线观看| 免费a级毛片永久免费| 国产偷伦视频免费观看| 亚洲伊人久久大香线蕉在观 | 亚洲精品成人片在线观看| 成全视频免费观看在线看| 亚洲成a人片在线看| 亚洲国产aⅴ综合网| 国产91色综合久久免费分享| 国产99久久亚洲综合精品| 亚洲精品中文字幕无码蜜桃| 久久久久国色AV免费观看性色 |