WebSphere WebSphere Enterprise Service Bus, Version 6.0.1 作業系統: AIX, HP-UX, Linux, Solaris, Windows

SMO 的 XML 表示法

某些調解基本元素會使用「服務訊息物件 (SMO)」的 XML 序列。

簡介

訊息日誌程式和 XSLT 調解基本元素會使用 SMO 的 XML 序列。

「訊息日誌程式」調解基本元素會記載 SMO 的 XML 序列。XSLT 調解基本元素會使用 XSLT 1.0 轉換來轉換訊息。轉換會操作 SMO 的 XML 序列。如果您需要瞭解由「訊息日誌程式」記載的資料, 或是撰寫會操作 XML 序列的 XSL 轉換,則您應該知道 SMO 表示成 XML 的方法。

一般而言, SMO 會有標頭資料、環境定義資訊,以及含有訊息有效負載的主體。訊息有效負載是服務端點之間交換的應用程式資料。標頭資料是固定結構;環境定義資料的結構部分是固定的, 部分則是由流程設計人員來定義。主體的結構是參照 WSDL 定義之來定義的。

根元素

「訊息日誌程式」和 XSLT 調解基本元素可指定序列的根, 而 XML 文件的根元素則會反映這個根。

一般而言,根元素在 SMO 結構中會在選定的根之後命名, 且位於預設名稱空間中。不過,如果在調解基本元素中選擇 / 作為根來將整個 SMO 序列化, 則根元素的名稱為 smo 且位於 SMO 名稱空間中。

比方說,從 / 序列化的 SMO 可能看起來如下:
<?xml version="1.0" encoding="UTF-8"?>
<smo:smo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:accounts="urn://www.example.com/accounts"
xmlns:smo="http://www.ibm.com/websphere/sibx/smo/v6.0.1">
  <context>
    <correlation xsi:type="accounts:CorrelateByAgentId">
      <agentid>SMI537654-2</agentid>
    </correlation>
    <transient xsi:type="accounts:ExchangeRate">
      <from>GBP</from>
      <to>USD</to>
      <multiplier>1.74068</multiplier>
    </transient>
  </context>
  <headers>
    <SMOHeader>
      <MessageUUID>b048778f-0701-0000-0080-80c5b8a4d8b8</MessageUUID>
      <Version>
        <Version>6</Version>
        <Release>0</Release>
        <Modification>1</Modification>
      </Version>
    </SMOHeader>
  </headers>
  <body xsi:type="accounts:processPaymentRequestMsg">
    <processPayment>
      <agentid>SMI537654-2</agentid>
      <priority>2</priority>
      <payment>
        <value>415.26</value>
        <currency>USD</currency>
        <date>2005-01-16Z</date>
        <account>546219G</account>
      </payment>
    </processPayment>
  </body>
</smo:smo>
/body 序列化的同一個 SMO 看起來如下:
<?xml version="1.0" encoding="UTF-8"?>
<body xsi:type="accounts:processPaymentRequestMsg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:accounts="urn://www.example.com/accounts">
  <processPayment>
    <agentid>SMI537654-2</agentid>
    <priority>2</priority>
    <payment>
      <value>415.26</value>
      <currency>USD</currency>
      <date>2005-01-16Z</date>
      <account>546219G</account>
    </payment>
  </processPayment>
</body>

主體結構

一般而言,XML 序列的主體是由 WSDL 訊息的參照所定義。

WSDL 訊息所定義的每一個組件, 在主體下都有一個元素。每一個元素的命名方式如下:
  • 如果 WSDL 訊息有單一組件是由廣域元素輸入 WSDL 定義中, 則主體會在該廣域元素之後命名單一元素。這個狀況包括 WSDL 定義的文件文字折返樣式。Web 服務設計師常會使用這個樣式, 且可從 WebSphere Integration Developer 的介面編輯器產生。
    註: 元素會位於預設名稱空間中, 而不在廣域元素的名稱空間中。
  • 如果 WSDL 訊息有許多組件,或是有由 XSD 類型描述的單一組件, 則每一個元素的名稱會與對應的 WSDL 組件相同。

Reference topic

使用條款 | 此頁的評等

時間戳記前次更新: 6 Mar 2006
http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.wbit.help.medprim.doc.nl1_6.0.1\ref\rwesb_XMLrepresentationofSMO.html

(C) Copyright IBM Corporation 2005. All Rights Reserved.
本資訊中心採用 Eclipse 技術。(http://www.eclipse.org)