RE: Announce: A Busy Developer's Guide to SOAP 1.1

Martin Gudgin wrote: "My point is that the [Busy Developer's Guide]
implies that xsi:type will always be used whereas my feeling is it will
only be used in dynamically typed systems..."

Martin is correct.  Let me try to elaborate, and please forgive me for
the somewhat wordy explanation, but I think that careful terminology is
beneficial to eventual clarity

The SOAP specification, section 5.1 [1] says 

2. For each element containing a value, the type of the value MUST be
represented by at least one of the following conditions: (a) the
containing element instance contains an xsi:type attribute, (b) the
containing element instance is itself contained within an element
containing a (possibly defaulted) SOAP-ENC:arrayType attribute or (c) or
the name of the element bears a definite relation to the type, that type
then determinable from a schema.

Clearly, it is permissible to omit the xsi:type attribute under certain
circumstances.  The primary condition under which the attribute can be
omitted is given by clause c, namely if the name of the element alone
gives sufficient information to determine the type of the element's
value.  Since all of section 5 is written in the context of mapping from
a non-XML type model to XML syntax, this means that the xsi:type
attribute can be validly omitted if the element name, in the context of
the non-XML metadata, adequately provides the type.

For example, the following instance fragment

	<price>12345</price>

would be valid and sufficient (not require an xsi:type attribute) if the
metadata were like

	int price;

but would be insufficient (require an xsi:type attribute) if the
metadata were like

	Object price; 


[1] http://www.w3.org/TR/SOAP/#_Toc478383513

Received on Thursday, 29 March 2001 14:34:50 UTC