XML Schema: complexContent/extension
Hi!
i want to define a base type (CasDataType) and then "subclass" it.
I found the XML Schema element complexContent+extension which seems to fit for my needs.
Please look at my XML Schema snippet.
Code:
<complexType name="CasDataType">
<sequence>
<element name="key" type="long" nillable="false minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
<complexType name="AddressDataType">
<complexContent>
<extension base="tns:CasDataType">
<sequence>
<element name="FirstName" nillable="true" minOccurs="0" type="string"/>
<element name="LastName" nillable="true" minOccurs="0" type="string"/>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="ArrayOfCasDataTypes">
<sequence>
<element name="casDataTypes" type="tns:CasDataType" nillable="false" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
</complexType>
<element name="createDataTypesRequest" type="tns:ArrayOfCasDataTypes"/>
<element name="createDataTypesResponse" type="tns:ArrayOfCasDataTypes"/>
I'm creating AddressDataType objects in my endpoint method invokeInternal(...) and want to returm this objects. But i get an validation error ant my soap message looks like this:
Code:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header />
<SOAP-ENV:Body>
<createDataTypesResponse xmlns="http://springws.cas.de">
<casDataTypes>
<key>123</key>
<FirstName>Ingo</FirstName>
<LastName>Siebert</LastName>
</casDataTypes>
<casDataTypes>
<key>456</key>
<FirstName>Ingo</FirstName>
<LastName>Siebert</LastName>
</casDataTypes>
</createDataTypesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
As we can see, i get casDataTypes and not AddressDataType. Why? I thought that "casDataTypes" is only the name of the array. Instead this is the element name of array elements.
Has anyone an idea, how i can provide one method for several "subclassed" (with complexContent/extension) XML schema elements?
Cheers,
Ingo