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

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

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

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

    WS-ResourceLifetime協議定義了WS-Resource的資源銷毀機制,其中包括資源的立即銷毀和資源的調度銷毀。立即銷毀使得客戶可以顯示地要求對特定的WS-Resource進行銷毀,從而釋放該WS-Resource占用的系統資源。調度銷毀則允許客戶通過設定某個WS-Resource的預定銷毀時間(Termination Time),由引擎負責在其生命周期結束時對其進行銷毀。在每一種情況都要明白,只有 WS-Resource 有狀態資源和 Web 服務的關聯—被銷毀。資源本身和 Web 服務都沒有受到影響

    另外值得注意的是此協議并沒有定義WS-Resource的創建方式。

    1.1.1.1    創建WS-Resource

    我們可以發送“create”消息:

    <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>

    結果是一個 SOAP 消息,其中包含對操作創建的 WS-Resource 的端點引用

    <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>

    該端點引用惟一地識別正在談論的 WS-Resource,所以我們可以使用它來銷毀該 WS-Resource

    1.1.1.2    立即銷毀WS-Resource

    當我們準備銷毀 WS-Resource 時,可以使用它的端點引用來創建 SOAP 請求:

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

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

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

          xmlns:wsrl="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd">

        <SOAP-ENV:Header>

           <wsa:Action>

               http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceLifetime/Destroy

           </wsa:Action>

           <wsa:To SOAP-ENV:mustUnderstand="1">

                http://example.com/satellite

           </wsa:To>

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

        </SOAP-ENV:Header>

        <SOAP-ENV:Body>

           <wsrl:Destroy />

        </SOAP-ENV:Body>

    </SOAP-ENV:Envelope>

     

    假設一切正常,我們會收到確認消息:

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

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

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

         xmlns:wsrl="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd">

        <SOAP-ENV:Header>

           <wsa:Action>

                http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceLifetime/DestroyResponse

           </wsa:Action>

           <wsa:To SOAP-ENV:mustUnderstand="1">

                http://example.com/myClient

           </wsa:To>

        </SOAP-ENV:Header>

        <SOAP-ENV:Body>

           <wsrl:DestroyResponse />

        </SOAP-ENV:Body>

    </SOAP-ENV:Envelope>

    這似乎不怎么像確認消息,但是只要收到它,就可以知道一切正常。如果不是一切正常,就會得到 WSRF 故障:WS-ResourceLifetime 中所討論的一條 fault 消息。如果在 WS-Resource 銷毀后還試圖訪問它,也會得到故障消息。

    我們也可以安排 WS-Resource 在以后銷毀。

    1.1.1.3    調度銷毀WS-Resource

    我們并不總是想要當場銷毀 WS-Resource。在有些情況下,我們只是想要保持 WS-Resource 活躍一段特定的時間,然后再讓它銷毀。為了做到這一點,我們需要給 WS-Resource 附加一個 TerminationTime 屬性,這意味著將它添加到資源屬性文檔。對于我們的人造衛星,意味著類似下面的這些東西:

    <satProp:GenericSatelliteProperties

        xmlns:satProp="http://example.com/satellite"

        xmlns:counterProp="http://example.com/satellite/CounterSatelliteProperties"

        xmlns:wsrl="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd">

       <satProp:latitude>30.3</satProp:latitude>

       <satProp:longitude>223.2</satProp:latitude>

       <satProp:altitude>47700</satProp:altitude>

       <satProp:pitch>49</satProp:pitch>

       <satProp:yaw>0</satProp:yaw>

       <satProp:roll>32</satProp:roll>

       <satProp:focalLength>

           21999992

       </satProp:focalLength>

       <satProp:currentView>

           http://example.com/satellite/2239992333.zip

       </satProp:currentView>

       <counterProp:currentCount>

           92828

       </counterProp:currentCount>

       <wsrl:TerminationTime>

           2005-12-31T12:00:00

       </wsrl:TerminationTime>

       <wsrl:CurrentTime>2005-2-15T03:24:57</CurrentTime>

    </satProp:GenericSatelliteProperties>

    如果像本例中一樣,沒有指定時區,就會假設是格林威治標準時間。

    注意,除了 TerminationTime,我們還添加了 CurrentTime。該屬性使我們不必同步時鐘,下面您就會看到。

     

    獲得 CurrentTime TerminationTime

    由于不同系統上的客戶機,因而潛在地存在時鐘同步的嚴重問題。例如,假設我們想要指定剛才創建的人造衛星 WS-Resource 應該在 4 小時后終止。選擇一個相對于客戶機的時間將會成為問題,因為在預定銷毀情況下,實際上是由服務器銷毀引用的。

    幸運的是,WS-Resource 帶有自己的“當前時間”。因為它是資源屬性文檔的一部分,所以我們可以像請求任何其他屬性一樣請求它:

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

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

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

          xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"

          xmlns:wsrl="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd">

        <SOAP-ENV:Header>

           <wsa:Action>

              http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceProperties/GetMultipleResourceProperties

           </wsa:Action>

           <wsa:To SOAP-ENV:mustUnderstand="1">

                http://example.com/satellite

           </wsa:To>

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

        </SOAP-ENV:Header>

        <SOAP-ENV:Body>

           <wsrp:GetMultipleResourceProperties>

              <wsrp:ResourceProperty>wsrl:CurrentTime</wsrp:ResourceProperty>

              <wsrp:ResourceProperty>wsrl:TerminationTime</wsrp:ResourceProperty>

           </wsrp:GetMultipleResourceProperties>

        </SOAP-ENV:Body>

    </SOAP-ENV:Envelope>

     

    在本例中,我們請求了 CurrentTime TerminationTime,所以響應中包含了它們倆:

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

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

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

          xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"

          xmlns:wsrl="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd">

        <SOAP-ENV:Header>

           <wsa:Action> http://docs.oasis-open.org/wsrf/2004/06/WS-Resour

    ceProperties/GetMutlipleResourcePropertiesResponse

           </wsa:Action>

           <wsa:To SOAP-ENV:mustUnderstand="1">

                http://example.com/myClient

           </wsa:To>

        </SOAP-ENV:Header>

        <SOAP-ENV:Body>

           <wsrp:GetMultipleResourcePropertiesResponse>

              <wsrl:CurrentTime>2005-2-15T03:24:57</wsrl:CurrentTime>

              <wsrl:TerminationTime>2005-2-15T03:30:00</wsrl:TerminationTime>

           </wsrp:GetMultipleResourcePropertiesResponse>

        </SOAP-ENV:Body>

    </SOAP-ENV:Envelope>

     

    在應用程序中,然后我們可以使用 CurrentTime 來確定和設置新的 TerminationTime

    注意,盡管我們可以像請求任何其他資源屬性一樣請求 CurrentTime TerminationTime,但是不能像設置任何其他資源屬性一樣設置它們。CurrentTime 是只讀的,而 TerminationTime 必須使用我們下面將會看到的消息來設置

     

    設置新的 TerminationTime

    一旦為 TerminationTime 確定了適當的值,我們就可以發送 SetTerminationTime 消息了:

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

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

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

          xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"

          xmlns:wsrl="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd">

        <SOAP-ENV:Header>

           <wsa:Action>

               http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceLifetime/SetTerminationTime

           </wsa:Action>

           <wsa:To SOAP-ENV:mustUnderstand="1">

                http://example.com/satellite

           </wsa:To>

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

        </SOAP-ENV:Header>

        <SOAP-ENV:Body>

           <wsrl:SetTerminationTime>

              <wsrl:RequestedTerminationTime>

                     2005-2-15T07:24:00

              </wsrl:RequestedTerminationTime>

           </wsrl:SetTerminationTime>

        </SOAP-ENV:Body>

    </SOAP-ENV:Envelope>

    注意,我們不是通過直接操縱 TerminationTime 屬性來設置時間的。這是因為我們需要系統實施它自己的任何一個時間相關規則,比如,不縮短資源的生存期,或者不擴展它超過某個特定的點

    響應消息包含新的 TerminationTime CurrentTime

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

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

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

         xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"

         xmlns:wsrl="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd">

        <SOAP-ENV:Header>

           <wsa:Action>

               http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceLifetime/SetTerminationTimeResponse

           </wsa:Action>

           <wsa:To SOAP-ENV:mustUnderstand="1">

                http://example.com/myClient

           </wsa:To>

        </SOAP-ENV:Header>

        <SOAP-ENV:Body>

           <wsrl:SetTerminationTimeResponse>

              <wsrl:NewTerminationTime>2005-2-15T07:24:00</wsrl:NewTerminationTime>

              <wsrl:CurrentTime>2005-2-15T03:25:08</wsrl:CurrentTime>

           </wsrl:SetTerminationTimeResponse>

        </SOAP-ENV:Body>

    </SOAP-ENV:Envelope>

    除非應用程序本身具有設置時間的特定規則,否則沒有任何特殊的約束。您甚至可以將 TerminationTime 設置為過去的值,這與發送 Destroy 消息的效果是一樣的。

     



    Author: orangelizq
    email: orangelizq@163.com

    歡迎大家訪問我的個人網站 萌萌的IT人
    posted on 2009-07-19 15:45 桔子汁 閱讀(342) 評論(0)  編輯  收藏 所屬分類: Web Service
    主站蜘蛛池模板: 亚洲喷奶水中文字幕电影| 久久精品国产亚洲网站| 久久久久一级精品亚洲国产成人综合AV区 | 亚洲理论精品午夜电影| 亚洲 欧洲 日韩 综合在线| 免费亚洲视频在线观看| 你懂的免费在线观看| 51视频精品全部免费最新| 拨牐拨牐x8免费| 红杏亚洲影院一区二区三区| 亚洲国产人成在线观看69网站| 精品亚洲AV无码一区二区三区| 国产午夜亚洲精品不卡免下载| 99在线免费视频| 成年免费大片黄在线观看岛国 | 国产香蕉九九久久精品免费| 免费成人av电影| 久久精品亚洲视频| 亚洲人成网站色7799| 成年免费a级毛片| **真实毛片免费观看| 国产在线观看www鲁啊鲁免费| 亚洲综合AV在线在线播放| 2020国产精品亚洲综合网 | 亚洲国产精品无码第一区二区三区 | 亚洲欧洲免费视频| 好爽好紧好大的免费视频国产| 亚洲精品乱码久久久久久按摩 | 亚洲成_人网站图片| eeuss免费影院| 四虎永久在线精品免费观看视频| 九月婷婷亚洲综合在线| 亚洲高清中文字幕综合网| 日韩成人精品日本亚洲| 四虎国产成人永久精品免费| 日日夜夜精品免费视频| 亚洲视频免费观看| 亚欧国产一级在线免费| 久久精品女人天堂AV免费观看| 亚洲国产成人片在线观看无码| 亚洲欧洲AV无码专区|