I generated a set of classes with apache cxf based on a big wsdl we got from our client. It uses an anyType to let it contain a whole bunch of different types. This is the wsdl
<complexType name="PayloadBase">
<complexContent>
<restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
</restriction>
</complexContent>
</complexType>
This translates in the following java code
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PayloadBase")
public class PayloadBase {
// empty as you can see
}
It turns out that any class that desires to use a child of this class doesnt know how to work with it. Say, for example, a subclass of PayloadBase is added to a wrapping object that also contains a timestamp, the following XML is generated
<bericht timestamp="2012-02-14T16:03:34.331+01:00"><payload/></bericht>
This is the result of sending the following class through the webservice code
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BerichtDescription", propOrder = {
"payload"
})
public class BerichtDescription {
@XmlElement(required = true)
protected PayloadBase payload;
@XmlAttribute(name = "timestamp", required = true)
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar timestamp;
Any instance of PayloadBase used will never show in the resulting xml. I have verified with the debugger that the PayloadBase instance is indeed filled with content. How do I get java webservices to work with this setup?