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">
......
</xs:element>
then in the sub.xsd this element gets decorated with a minOccurs="0"
<xs:complexType name="Element_Type">
<xs:sequence>
.........
<xs:element ref="base:occurrenceNumber" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
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.
Thanks!
Versions:
1) jaxb 2.2.4
2) cxf 2.5.1-2
--
View this message in context:
http://cxf.547215.n5.nabble.com/Can-t-get-wsdlToJava-to-generate-an-element-of-type-JaxbElement-tp5722767.html
Sent from the cxf-dev mailing list archive at Nabble.com.