Re: using xsi:type with the SOAP encoding rules

Tim:  on February 23rd you sent the note at [1].  You inquired about the 
interpretation in a SOAP message of an xsi:type attribute that references 
a schema complex type.  Although the workgroup has not formally opened an 
issue in response to your inquiry, I have been asked on behalf of the 
workgroup respond to you.

You asked:

"What happens if a SOAP encoded message uses xsi:type to describe an 
element's content in terms of a XSD complexType? Is this explicilty 
allowed or disallowed under the SOAP encoding rules, or is it simply not 
addressed?"

As you will see from the publicly posted editors draft of part 2 [2] and 
specifically the discussion of types [3], the relationship between SOAP 
and XML schema has been clarified.  In brief, SOAP encoding no longer 
makes normative use of any particular schema language, except for the fact 
that we continue to use xsi:type as the attribute to signal the name of a 
type  (and we acknowledge that attribute currently isn't much use to any 
schema language other than W3C schemas...we couldn't find a 
schema-language-neutral way to carry a type name, and still have it be 
understood by the W3C schema langauge.)  Also supplied is a nonnormative 
appendix giving information about how the W3C schema language can be used 
to validate encoded soap messages, should you wish to do so [4]. 

The graphs that are the subject of SOAP encoding carry in their nodes the 
optional qualified >>name<< of a type, but no other information about the 
definition or interpretation of a type.  In other words, you cannot at the 
SOAP level tell the difference between a simple and a complex type.  You 
know only its name.

Of course, if you find an xsi:type on an element that has child elements 
(probably a struct or array), and if you try to validate with a W3C 
schema, it better be the case that the type name is indeed a complex type, 
or your validation will surely fail.  Interestingly, the converse is not 
necessarily true.  If you consider the element:

        <a xsi:type="ns:someInteger">123</a>

you might be tempted to believe that ns:someInteger must be a simple type. 
  Actually, that's not true.  It could also be a complex type with simple 
content and optional attributes.   You cannot tell until you get the 
actual schema and try the validation.

I hope you find this clarification useful, and that the new version of our 
specification resolves your concern.  If it does not, I'm sure the 
workgroup will be pleased to open a formal issue (though I cannot speak 
for the workgroup as to whether that would lead to any change in 
resolution).  Thank you very much.

Noah

[1] http://lists.w3.org/Archives/Public/xml-dist-app/2002Feb/0404.html
[2] http://www.w3.org/2000/xp/Group/2/03/23/soap12-part2-1.46.html#soapenc
[3] 
http://www.w3.org/2000/xp/Group/2/03/23/soap12-part2-1.46.html#enctypename
[4] 
http://www.w3.org/2000/xp/Group/2/03/23/soap12-part2-1.46.html#encschema

------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------

Received on Tuesday, 2 April 2002 22:52:13 UTC