O'Reilly logo

Java and SOAP by Robert Englander

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.4. The SOAP Envelope

The SOAP envelope represents the entirety of the XML for a SOAP request or response.[3] The Envelope is the highest-level XML element in the message, and it must be present for the message to be considered valid. So in essence, the Envelope represents the XML document that contains the SOAP message. The Envelope can contain an optional Header element that, if present, has to be the first subelement of the Envelope. The Envelope must contain a Body element.[4] If the Envelope contains a Header element, then the Body element has to come right after the Header; otherwise the Body has to be the first subelement of the Envelope.

[3] An exception to this occurs where an attachment is included. We'll look at that possibility in Chapter 8.

[4] There have been some discussions about providing for a Body-less Envelope in SOAP 1.2.

A SOAP envelope packaged and transported using HTTP is similar to a paper envelope sent using the postal service. The SOAP envelope is the paper envelope; the SOAP header (if present) and the SOAP body are the contents of the paper envelope; and the HTTP headers are the physical address information on the outside of the paper envelope.

With a little imagination we can complete the analogy. The return address on a paper envelope has no direct counterpart in the SOAP process; however, in both cases an undeliverable message is returned to sender. The only thing missing is the stamp. I guess this is where the analogy may break down a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required