隨筆-128  評論-55  文章-5  trackbacks-0
             WS-ResourceProperties協議

          WS-ResourceProperties協議解決了兩個問題:(1)如何描述資源狀態;(2)如何操作資源狀態。

          WSRP使用資源屬性文檔來描述資源的屬性,它是一個代表資源屬性元素邏輯組合的XML文檔。資源屬性文檔是資源狀態的一個映射,并與WSDLportType相關聯。同時WSRP還定義了一系列的消息交換格式,用于操作資源的狀態:如獲取、插入和修改屬性等。

          協議中的定義如下:

          Resource Property:

          l        A resource property is a piece of information defined as part of the state model of a WS-Resource.

          l        A resource property may reflect a part of the resource’s state, meta-data, manageability information, etc.

          Resource Properties Document:

          l        The XML document representing a logical composition of resource property elements. The resource properties document defines a particular view or projection of the state data implemented by the WS-Resource.

          l        The type (e.g. the XML Schema definition of the root element) of a resource properties document is associated with the WSDL portType defining the Web service interface. This association is the basis of the WS-Resource definition. Each instance of a particular WS-Resource type MUST implement a logical resource properties document of the type declared in the WSDL portType.

          Resource Property Element:

          l        The XML representation of a resource property.

          l        A resource property element must appear as the immediate child of the root element of a resource properties document.

          l        A resource property element must be an XML global element definition (GED), and is uniquely identified by QName.

          Resource Property Value:

          l        The value(s) associated with a resource property.

           

          WS-ResourceProperties協議還定義了9種標準操作:

          1.      GetResourcePropertyDocument

          2.      GetResourceProperty

          3.      GetMultipleResourceProperties

          4.      QueryResourceProperties

          5.      PutResourcePropertyDocument

          6.      SetResourceProperties

          7.      UpdateResourceProperties

          8.      DeleteResourceProperties

          9.      InsertResourceProperties

          一個包含資源屬性文檔的Web服務必須支持GetResourceProperty消息交換方式,可以支持其它8種消息交換模式。

          注意在協議中并沒有定義創建資源的操作,該操作由應用程序自己定義。

          關于創建 WS-Resource 的實際 SOAP 請求是非常簡單的:

          <SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

              <SOAP-ENV:Header/>

              <SOAP-ENV:Body>

                  <createSatellite xmlns="http://example.com/satellite"/>

              </SOAP-ENV:Body>

          </SOAP-ENV:Envelope>

          我們還沒有實際的對象,所以該請求到達 WSDL 文件中列出的 URI,并且我們將該請求定義為一個簡單的 createSatellite 元素。

          響應要稍微有意思一些。一旦您發送針對新人造衛星的請求,服務器就創建一個對新WS-Resource的引用,并以EndpointReference形式將它返回:

          <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

              <SOAP-ENV:Header/>

              <SOAP-ENV:Body>

                 <wsa:EndpointReference  xmlns:wsa="http://www.w3.org/2005/02/addressing"

                       xmlns:sat="http://example.org/satelliteSystem">

                     <wsa:Address>http://example.com/satellite</wsa:Address>

                     <wsa:ReferenceProperties>

                         <sat:SatelliteId>SAT9928</sat:SatelliteId>

                     </wsa:ReferenceProperties>

                 </wsa:EndpointReference>

              </SOAP-ENV:Body>

          </SOAP-ENV:Envelope>

          注意,EndpointReference Address 元素指向我們在 WSDL 文件中列出的同一 URI,所以信息仍然到達相同的地方,只是量的增多。

          現在我們應該注意,這不是一個普通的端點引用。 ReferenceProperties 元素展示一個標識符,該標識符最終將用于識別 WS-Resource,所以這實際上是一個 WS-Resource 限定的端點引用。我們可以使用該信息來對WS-Resource做出后續調用。

          已經創建了 WS-Resource,那么我們可以對它做什么呢?

          實際上,可以通過調整它的屬性來做任何事情。例如,可以通過更改 altitude 屬性來改變人造衛星軌道的大小。不,只是更改值并不能移動人造衛星;人造衛星的實際移動是由 Web 服務背后的應用程序決定的。但是這是 WS-Resources 所真正關心的:創建一種方式,以便通過更改屬性來操縱對象。協議只是指出了如何將這些更改告訴Web服務。它不關心應用程序是如何真正操縱對象的,我們也不關心。



          Author: orangelizq
          email: orangelizq@163.com

          歡迎大家訪問我的個人網站 萌萌的IT人
          posted on 2009-07-19 15:43 桔子汁 閱讀(1203) 評論(0)  編輯  收藏 所屬分類: Web Service
          主站蜘蛛池模板: 廉江市| 肃北| 颍上县| 石渠县| 延庆县| 毕节市| 那坡县| 澄江县| 潞城市| 黑河市| 湖南省| 双流县| 那曲县| 城口县| 石屏县| 苍溪县| 青河县| 蒲城县| 英德市| 邹平县| 泽州县| 澄迈县| 昌乐县| 衢州市| 西乌珠穆沁旗| 天长市| 永春县| 镇安县| 淮滨县| 阿拉善左旗| 集贤县| 平顺县| 垦利县| 英吉沙县| 正阳县| 麻栗坡县| 阿克苏市| 锦州市| 绥德县| 墨脱县| 武威市|