Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

XmlAccessorOrder and inheritance

$
0
0
I am using cxf 2.3.11.

I have a base class called InvoiceBase and a derive class called Invoice in
my web service.
Some elements are present in the base and some in the child.
When I call a method that required Invoice as a parameter, I need to send
elements from both invocie and its base.

Here is how my Invoice class is annotated:

@XmlAccessorOrder(value = XmlAccessOrder.UNDEFINED)
@XmlRootElement(name = "Invoice")
@XmlType(name = "Invoice")
public class Invoice extends InvoiceBase

@XmlAccessorOrder(value = XmlAccessOrder.UNDEFINED)
@XmlRootElement(name = "InvoiceBase")
@XmlType(name = "InvoiceBase")

When I try to validate the generated schema, I get the following error:

File C:\Service.xml is not valid.
Invalid XML schema: 'In case of complex type extension, an 'all' model
group is neither allowed in the base type 'InvoiceBase' nor in its extension
'Invoice'.'
Error location: schema / complexType / complexContent / extension / all
Details

When I did not have the @XmlAccessorOrder annotation and had the propOder
defined in the XmlType of both the classes, the schema that got generated
for Invoice and InvoiceBase has xs:sequence. After I removed the propOrder
and added the UNDEFINED XmlAccessOrder, the xs:sequence got replaced by
xs:all, which is not allowed in a schema.

Since I do not have a physical schema and it gets auto generated by cxf, how
do I fix this error in my code?

Regards,
Jasmina

Viewing all articles
Browse latest Browse all 5648

Trending Articles