The SOAP Body

Exactly one <Body> element must exist within an <Envelope> element. The <Body> element contains the actual payload destined for the endpoint. This is where the interesting application-specific data is located. In .NET Remoting, the <Body> element contains method calls with parameters including XML versions of complex data types such as structures. Section 5 of the SOAP 1.1 specification describes how to serialize arrays, structures, and object graphs; many developers colloquially refer to this encoding scheme as Section 5 encoding. Here's an example of a typical SOAP <Body> element used for RPC:

<SOAP-ENV:Body>

<myns:GetPopulationOfState xmlns:myns="my-namespace-uri">

<state>Florida</state> </myns:GetPopulationOfState> </SOAP-ENV:Body>

Child elements of the <Body> element's method name element will contain any input and will reference parameters of the method. In the example, the child element <state> specifies that the caller wants to retrieve the population for the state of Florida. A response message payload will then contain any output and will reference parameters for the method. The recipient of the GetPopuIationOfState request message might respond with the following SOAP message:

<SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ SOAP-ENV:encodingStyle=

"http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body>

<myns:GetPopulationOfStateResponse xmlns:myns="my-namespace-uri"> <Population>15 982378</Population> </myns:GetLastTradePriceResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

The SOAP Fault

If an error occurs on the server, the SOAP specification defines a <FauIt> tag that must be a child of the <Body> element. The <FauIt> element carries information describing why the operation failed on the server. Of course, the implication is that you'll see <FauIt> tags in response messages only.

0 0

Post a comment