cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwstebb <>
Subject Can't get wsdlToJava to generate an element of type JaxbElement
Date Tue, 05 Feb 2013 17:39:40 GMT
We have an element that has the properties of nillable=true and minOccurs=0 ,
but wsdl2Java is only acknowledging the nillable=true

In order to accommodate a schema where an element is defined with attributes
nillable=true and minOccurs=0, I've updated our bindings by removing the
generateElementProperty="false" attribute from the global bindings. This
caused all elements with the attributes above to generate as the correct "3
state" capable type of JAXBElement e.g.

    @javax.xml.bind.annotation.XmlElementRef(name = "description", type =
null, required = false)
    protected javax.xml.bind.JAXBElement<java.lang.String> description;

Unfortunately this did not fix all of the situations. The reason I believe
is due to how our schemas are defined for these troublesome elements.

In a base.xsd, an element is defined with nillable=true

        <xs:element name="occurrenceNumber" type="xs:int" nillable="true">

then in the sub.xsd this element gets decorated with a minOccurs="0" 

	<xs:complexType name="Element_Type">
			<xs:element ref="base:occurrenceNumber" minOccurs="0"/>

But cxf's wsdlToJava only detects the nillable=true property and generates
the property as an Integer instead of a JaxbElement:

    @javax.xml.bind.annotation.XmlElement(namespace = "proper namespace",
nillable = true)
    protected java.lang.Integer occurrenceNumber;

Any help in figuring out how to get JAXB to recognize these fields as
nillable=true and minOccurs=0 and to generate a JaxbElement for them would
be much appreciated.


   1) jaxb 2.2.4
   2) cxf 2.5.1-2

View this message in context:
Sent from the cxf-dev mailing list archive at

View raw message