SOAP and WSDL and inheritance by restriction

Apologies in advance for taking a long time to get to the question :)

The SOAP specification defines an XML representation of an Array using the
following definitions:

  <xs:group name="Array">
    <xs:sequence>
      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded"
processContents="lax" />
    </xs:sequence>
  </xs:group>

  <xs:complexType name="Array">
    <xs:group ref="tns:Array" minOccurs="0" />
    <xs:attributeGroup ref="tns:arrayAttributes" />
     <xs:attributeGroup ref="tns:commonAttributes" />
   </xs:complexType>

The full schema is available at: http://schemas.xmlsoap.org/soap/encoding/
As you can see, an Array is essentially a complex type containing a
unbounded number of xs:any's.

Typically, when you define arrays you inherit from this definition and
restrict the xs:any's in it to the particular of type in your array, so from
my reading of the inheritance rules, an array of floats should look as
follows:

<xs:complexType name="ArrayOfFloat">
  <xs:complexContent>
    <xs:restriction base="soapenc:Array">
      <xs:sequence>
        <xs:element name="item" minOccurs="0" maxOccurs="unbounded"
type="xs:float" />
      </xs:sequence>
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xs:float[]"/>
    </xs:restriction>
  </xs:complexContent>
</xs:complexType>

However, the WSDL specification ( http://www.w3.org/TR/wsdl ) contains the
following example of an array of floats:

<complexType name="ArrayOfFloat">
  <complexContent>
    <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:float[]"/>
    </restriction>
  </complexContent>
</complexType>

Now the Schema Primer states the following:

    Notice that types derived by restriction must repeat all
    the components of the base type definition that are to be
    included in the derived type

So (and here's the question), is the example from the WSDL specification
incorrect as it neither repeats the xs:any or replaces it with a more
restrictive element. Am I right in thinking that it actually defines an
complex type which can not contain child elements at all?

Thanks,

James.


Cape Clear Software Limited.
61 Fitzwilliam Lane
Dublin 2
Ireland

Email : james.pasley@capeclear.com
Switchboard  : + 353 (1) 2419900
Direct line  : + 353 (1) 2419957
Fax          : + 353 (1) 2419901
www          : www.capeclear.com

Visit www.capescience.com

Received on Tuesday, 11 December 2001 08:24:51 UTC