You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jasminadesai <ja...@yahoo.com> on 2014/02/06 01:55:26 UTC

XmlAccessorOrder and inheritance

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




--
View this message in context: http://cxf.547215.n5.nabble.com/XmlAccessorOrder-and-inheritance-tp5739539.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: XmlAccessorOrder and inheritance

Posted by Daniel Kulp <dk...@apache.org>.
On Feb 7, 2014, at 9:42 PM, jasminadesai <ja...@yahoo.com> wrote:

> Does anyone have an answer for this issue?
> 

I thought you pretty much answered your own question…. if you need inheritance, you HAVE to not use XmlAccessOrder.UNDEFINED.


Dan



> Regards,
> Jasmina
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/XmlAccessorOrder-and-inheritance-tp5739539p5739707.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: XmlAccessorOrder and inheritance

Posted by jasminadesai <ja...@yahoo.com>.
Does anyone have an answer for this issue?

Regards,
Jasmina



--
View this message in context: http://cxf.547215.n5.nabble.com/XmlAccessorOrder-and-inheritance-tp5739539p5739707.html
Sent from the cxf-user mailing list archive at Nabble.com.