Interview Questions

What is SOAP Body Element?

SOAP Interview Questions and Answers


(Continued from previous question...)

What is SOAP Body Element?

The SOAP Body element contains the actual SOAP message.
The required SOAP Body element contains the actual SOAP message intended for the ultimate endpoint of the message.
Immediate child elements of the SOAP Body element may be namespace-qualified.

Example
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.www.org/2010/12/soap-envelope"
soap:encodingStyle="http://www.www.org/2010/12/soap-encoding">

<soap:Body>
<m:GetPrice xmlns:m="http://www.www.org/2010/12/prices">
<m:Item>Apples
</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 namespace.

A SOAP response could look something like this:
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.www.org/2010/12/soap-envelope"
soap:encodingStyle="http://www.www.org/2010/12/soap-encoding">

<soap:Body>
<m:GetPriceResponse xmlns:m="http://www.www.org/2010/12/prices">
<m:Price>1.90
</m:GetPriceResponse>
</soap:Body>

</soap:Envelope>

(Continued on next question...)

Other Interview Questions