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

3.2. Serialization Rules

The XML elements in a SOAP message are either independent or embedded. Because of the hierarchical nature of XML, most elements are embedded as subelements of other elements. Independent elements, then, are not subelements of any other elements; they appear at the top level of a serialization.

All of the values in a SOAP message are encoded as the content of an element. Data values cannot appear by themselves outside the confines of an element. That does not mean, however, that every XML element contains a value. For instance, compound data types like structs or arrays contain subelements that contain the actual data values. The elements that define these compound data values do not contain the data directly. Compound types will be covered a little later.

3.2.1. References

SOAP Section 5 also permits elements to reference the values contained in other elements. In this case, no value is provided with the element; instead, an attribute identifies the element in which the actual data value is to be found. The data value must be contained in an independent element, appearing at the top level of a serialization.

The element containing the data value must contain an attribute named id of type ID. The value of the id attribute is the name that other elements use to reference the value. Here is such an element:

<lastName id="name-1">Englander</lastName>

The lastName element is a perfectly valid accessor in its own right. In addition, it has an identifier ...

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