Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Although the Header element is optional, all SOAP messages must contain exactly one Body element.BP The Body element contains either the application-specific data or a fault message. Application-specific data is the information that we want to exchange with a Web service. It can be arbitrary XML data or parameters to a procedure call. Either way, the Body element contains the application data being exchanged. A fault message is used only when an error occurs. The receiving node that discovers a problem, such as a processing error or a message that's improperly structured, sends it back to the sender just before it in the message path. A SOAP message may carry either application-specific data or a fault, but not both.

Whether the Body element contains application-specific data or a fault, most SOAP experts agree that only the ultimate receiver of the SOAP message should process the contents of the Body. Intermediary nodes in the message path may view the Body element, but they should not alter its contents in any way. This is very different from header blocks, which may be processed by any number of intermediaries along the message path. This is a critical point: Only the ultimate receiver should alter the contents of the Body element.

Neither SOAP 1.1 nor the BP explicitly prohibits intermediaries from modifying the contents of the Body element. As a result, the ultimate receiver has no way of knowing if the application-specific data has changed somewhere along the message path. SOAP 1.2 reduces this uncertainty by explicitly prohibiting certain intermediaries, called forwarding intermediaries, from changing the contents of the Body element and recommending that all other intermediaries, called active intermediaries, use a header block to document any changes to the Body element.

  • + Share This
  • 🔖 Save To Your Account