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

SMO 主體

「服務訊息物件 (SMO)」的主體是參照「Web 服務說明語言」(WSDL) 之訊息來定義的。

簡介

一般而言,SMO 主體的結構是由 WSDL 訊息的參照所定義的。

WSDL 訊息所定義的每一個組件, 在 SMO 主體下都有一個元素。SMO 元素的內容是 WSDL 組件定義結構的一部分。元素名稱會視用來定義 SMO 的 WSDL 訊息類型而定。

文件文字折返與類似的 WSDL 訊息樣式

WSDL 的文件文字折返樣式, 會產生含有單一元素的 SMO 主體。Web 服務設計師常會使用這個 WSDL 樣式, 且可從 WebSphere Integration Developer 的介面編輯器產生。

如果 WSDL 訊息有單一組件是由廣域元素輸入 WSDL 定義中, 則 SMO 主體會含有單一元素。該單一元素會在 WSDL 廣域元素之後命名。
註: 該單一元素並不是完整的名稱空間。廣域元素的名稱空間會被忽略。
比方說,有以下 WSDL。
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns="urn://www.example.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DLWInterface" targetNamespace="urn://www.example.org">
  <wsdl:types>
    <xsd:schema targetNamespace="urn://www.example.org" xmlns:tns="urn://www.example.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="operation1">
        <xsd:complexType>
          			<xsd:sequence>
            <xsd:element name="name" nillable="true" type="xsd:string"/>
            <xsd:element name="age" nillable="true" type="xsd:int"/>
          			</xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="operation1Response">
        <xsd:complexType>
          			<xsd:sequence>
            <xsd:element name="surname" nillable="true" type="xsd:string"/>
            <xsd:element name="height" nillable="true" type="xsd:float"/>
          			</xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
  </wsdl:types>
    <wsdl:message name="operation1RequestMsg">
    <wsdl:part element="tns:operation1" name="operation1Parameters"/>
  	</wsdl:message>
    <wsdl:message name="operation1ResponseMsg">
    <wsdl:part element="tns:operation1Response" name="operation1Result"/>
  	</wsdl:message>
    <wsdl:portType name="DLWInterface">
    <wsdl:operation name="operation1">
      <wsdl:input message="tns:operation1RequestMsg" name="operation1Request"/>
      <wsdl:output message="tns:operation1ResponseMsg" name="operation1Response"/>
    </wsdl:operation>
  </wsdl:portType>
</wsdl:definitions>
這個範例 WSDL 會產生如下的 SMO 主體:
<body xsi:type="tns:operation1RequestMsg">
  <operation1>
    <name>Bob</name>
    <age>35</age>
  </operation1>
</body>

這個範例可以有如下的 XPath:/body/operation1/name

WSDL 的其他樣式

如果 WSDL 訊息有許多組件, 則 SMO 主體中每一個元素的名稱都與對應的 WSDL 組件相同。如果 WSDL 訊息有由 XSD 類型描述的單一組件, 則 SMO 主體中每一個元素的名稱也會與對應的 WSDL 組件相同。

比方說,有以下 WSDL。

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:tns="urn://www.example.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="NonDLWInterface" targetNamespace="urn://www.example.org">

  <wsdl:message name="operation2RequestMsg">
    <wsdl:part name="name" type="xsd:string"/>
    <wsdl:part name="age" type="xsd:int"/>
  	</wsdl:message>
  <wsdl:message name="operation2ResponseMsg">
    <wsdl:part name="surname" type="xsd:string"/>
    <wsdl:part name="height" type="xsd:float"/>
  	</wsdl:message>
  <wsdl:portType name="NonDLWInterface">
    <wsdl:operation name="operation2">
      <wsdl:input message="tns:operation2RequestMsg" name="operation2Request"/>
      <wsdl:output message="tns:operation2ResponseMsg" name="operation2Response"/>
    </wsdl:operation>
  </wsdl:portType>
</wsdl:definitions>
這個範例 WSDL 會產生如下的 SMO 主體:
<body xsi:type="tns:operation2RequestMsg">
    <name>Bob</name>
    <age>35</age>
</body>

這個範例可以有如下的 XPath:/body/name

WebSphere Integration Developer 的介面編輯器

如果您使用 WebSphere Integration Developer 的介面編輯器來建立介面, 則產生的 WSDL 會是文件文字折返樣式。不過,您可以使用介面編輯器來檢視及編輯不屬於文件文字折返樣式的 WSDL 檔。在某些情況下, 介面編輯器不一定會顯示判斷 SMO 主體結構所需的資訊。


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_SMOBody.html

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