SOAP Body
作者:w3pop.com 翻译/整理:w3pop.comThe mandatory SOAP Body element contains the actual SOAP message.
具有强制性的SOAP主体元素包含了现行的SOAP信息。
The SOAP Body Element
Soap主体元素
The required SOAP Body element contains the actual SOAP message intended for the ultimate endpoint of the message.
所要求的SOAP主体元素包含了用于信息终端的现行SOAP信息。
Immediate child elements of the SOAP Body element may be namespace-qualified. SOAP defines one element inside the Body element in the default namespace ("http://www.w3.org/2001/12/soap-envelope"). This is the SOAP Fault element, which is used to indicate error messages.
直接的SOAP主体元素的子元素可能是有资格获得命名空间(name-space)的。SOAP以默认的命名空间定义了("http://www.w3.org/2001/12/soap-envelope")主体元素内的一个元素。这是SOAP用来显示错误信息的“错误元素”。
<?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.w3schools.com/prices"> <m:Item>Apples</m:Item> </m:GetPrice> </soap:Body> </soap:Envelope> |
The example above requests the price of apples. Note that the m:GetPrice and the Item elements above are application-specific elements. They are not a part of the SOAP standard.
上面举的是请求苹果价格的例子。注意,上面的m:GetPrice和项目元素都是详细的应用程序(application-specific)元素。它们不是SOAP标准的一部分。
A SOAP response could look something like this:
SOAP响应如下:
<?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.w3schools.com/prices"> <m:Price>1.90</m:Price> </m:GetPriceResponse> </soap:Body> </soap:Envelope> |