Hello,
Have been using Apache CXF cxf-codegen-plugin v2.1 in a project to
generate client code (using the default JAXB data binding) for a few
services and it worked has worked like a charm.
However, for the one I'm working on today, I got the following error:
[INFO] Thrown by JAXB : Element
"{http://my.services.namespace}ProblemElement" shows up in more than one
properties.
(note: I generified the namespace and element name in the error.)
Looking around for this error, I found a reference from Kenny MacLeod on
http://www.nabble.com/jaxb2---duplicate-element--issue-td16429810.html
stating "JAXB2 cannot generate code from that schema, sadly.
Consecutive elements of the same name have to be modelled as sequences. "
Just for an example, could the following cause such an exception? (There
are many more references to "ProblemElement" in the WSDL,
unfortunately.) What about it would be the problem? It it the multiple
sequences in a row containing the same element type as shown in
SomeElementGType below? If not, could you guess at what type of
structure might cause this error?:
...
<xsd:complexType name="MyElementType">
<xsd:sequence>
<xsd:element minOccurs="0" name="SomeElementA"
type="SomeElementAType"/>
<xsd:element minOccurs="0" name="SomeElementB"
type="SomeElementBType"/>
<xsd:element minOccurs="0" name="SomeElementC"
type="SomeElementCType"/>
<xsd:element minOccurs="0" name="SomeElementD"
type="SomeElementDType"/>
<xsd:element minOccurs="0" name="SomeElementE"
type="SomeElementEType"/>
<xsd:element minOccurs="0" name="SomeElementF"
type="SomeElementFType"/>
<xsd:sequence maxOccurs="unbounded" minOccurs="0">
<xsd:element name="SomeElementG" type="SomeElementGType"/>
<xsd:element minOccurs="0" name="ProblemElement"
type="ProblemElementType"/>
</xsd:sequence>
</xsd:sequence>
<xsd:attribute fixed="DefaultValue" name="someAttribute"
type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="SomeElementGType">
<xsd:sequence>
<xsd:sequence maxOccurs="unbounded" minOccurs="0">
<xsd:element name="SomeElementH" type="SomeElementHType"/>
<xsd:element minOccurs="0" name="ProblemElement"
type="ProblemElementType"/>
</xsd:sequence>
<xsd:sequence maxOccurs="unbounded" minOccurs="0">
<xsd:element name="SomeElementI" type="SomeElementIType"/>
<xsd:element minOccurs="0" name="ProblemElement"
type="ProblemElementType"/>
</xsd:sequence>
<xsd:sequence maxOccurs="unbounded" minOccurs="0">
<xsd:element name="SomeElementJ" type="SomeElementJType"/>
<xsd:element minOccurs="0" name="ProblemElement"
type="ProblemElementType"/>
</xsd:sequence>
</xsd:sequence>
<xsd:attribute fixed="DefaultValue" name="someAttribute"
type="xsd:string" use="required"/>
</xsd:complexType>
...
Thanks in advance for any help you can provide!
Gary