Hi, I'm having a strange problem with CXF RESTful service marsahlling base and derived xsd types.
XSD: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns="http://www.cisco.com/dms/xml/ns/dsmCommonService" targetNamespace="http://www.cisco.com/dms/xml/ns/dsmCommonService" elementFormDefault="unqualified" jaxb:version="2.0"> <xs:complexType name="BaseType"> <xs:sequence> </xs:sequence> </xs:complexType> <xs:complexType name="DerivedType"> <xs:complexContent> <xs:extension base="BaseType"> <xs:sequence> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="ListType"> <xs:sequence> <xs:element name="item" type="BaseType" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> <xs:element name="base" type="BaseType" /> <xs:element name="derived" type="DerivedType" /> <xs:element name="list" type="ListType" /> </xs:schema> xjc has been used to jenerate java code from xsd. After that: 1) @XmlSeeAlso pointing to DerivedType class and @XmlRootElement annotations have been added to BaseType java class code 2) @XmlRootElement has been added to DerivedType java class code 3) @XmlRootElement has been added to ListType java class code When my CXF rest service returns list of the Derived objects it produces xml correctly: <list> <base xsi:type="DerivedType">...</base> ... <base xsi:type="DerivedType">...</base> </list> But when I'm requesting 1 instance of the Derived object XML is wrong (as I understand) <derived>...</derived> Since I did not specify substitution group in my opinion xml should be like in list: <base xsi:type="DerivedType">...</base> Could you please clarify the issue for me and may be help me to solve this problem. Forgot to mention that I'm using CXF 2.2 Thanks in advance --- Karen
