SOAP Body Element
- Previous Page SOAP Header
- Next Page SOAP Fault
强制使用的 SOAP Body 元素包含实际的 SOAP 消息。
SOAP Body Element
必需的 SOAP Body 元素可包含打算传送到消息最终端点的实际 SOAP 消息。
SOAP Body 元素的直接子元素可以是合格的命名空间。SOAP 在默认的命名空间中("http://www.w3.org/2001/12/soap-envelope")定义了 Body 元素内部的一个元素。即 SOAP 的 Fault 元素,用于指示错误消息。
<?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://www.codew3c.com/prices"> <m:Item>Apples</m:Item> </m:GetPrice> </soap:Body> </soap:Envelope>
The above example requests the price of apples. Note that the m:GetPrice and Item elements are application-specific elements. They are not part of the SOAP standard.
A SOAP response should look something like this:
<?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://www.codew3c.com/prices"> <m:Price>1.90</m:Price> </m:GetPriceResponse> </soap:Body> </soap:Envelope>
- Previous Page SOAP Header
- Next Page SOAP Fault