SOAP Body 元素
強(qiáng)制使用的 SOAP Body 元素包含實(shí)際的 SOAP 消息。
SOAP Body 元素
必需的 SOAP Body 元素可包含打算傳送到消息最終端點(diǎn)的實(shí)際 SOAP 消息。
SOAP Body 元素的直接子元素可以是合格的命名空間。SOAP 在默認(rèn)的命名空間中("http://www.w3.org/2001/12/soap-envelope")定義了 Body 元素內(nèi)部的一個(gè)元素。即 SOAP 的 Fault 元素,用于指示錯(cuò)誤消息。
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body>
<m:GetPrice xmlns:m="http://m.fzitv.net/prices">
<m:Item>Apples</m:Item>
</m:GetPrice>
</soap:Body>
</soap:Envelope>
上面的例子請(qǐng)求蘋果的價(jià)格。請(qǐng)注意,上面的 m:GetPrice 和 Item 元素是應(yīng)用程序?qū)S玫脑。它們并不?SOAP 標(biāo)準(zhǔn)的一部分。
而一個(gè) SOAP 響應(yīng)應(yīng)該類似這樣:
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body>
<m:GetPriceResponse xmlns:m="http://m.fzitv.net/prices">
<m:Price>1.90</m:Price>
</m:GetPriceResponse>
</soap:Body>
</soap:Envelope>