Interview Questions

How to explain Body Element in SOAP?

SOAP Interview Questions and Answers


(Continued from previous question...)

How to explain Body Element in SOAP?

We use Body element in SOAP to contains the actual SOAP message specify the ultimate endpoint of the message.
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>Mangos
</m:GetPrice>
</soap:Body>
</soap:Envelope>

Above example has write to requests the price of Mangos.In this m:GetPrice and Item elements botha re called as application specific elements. I want to confirm you both elements are not a part of SOAP namespace.
I have given you a SOAP response code according to above SOAP request.
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: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