Hello,
(I asked the CXF users list this already, but Daniel Kulp said this
would be the best place to post the following issue/question.)
Have been using Apache CXF v2.1 with cxf-codegen-plugin v2.1 in a
project to generate client code using 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. "
It appears that (something similar to) the following type in the WSDL
causes this issue:
...
<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>
...
because when I change that to the following, it doesn't have any problems:
...
<xsd:complexType name="SomeElementGType">
<xsd:attribute fixed="DefaultValue" name="someAttribute"
type="xsd:string" use="required"/>
</xsd:complexType>
...
I'm working on the developer of the webservice to see if they can
redefine that type such that the WSDL would have each of those 3
pairs/sequences encapsulated by a parent element. But, if they can't do
that, is there anything that I could do to get JAXB to handle this
situation?
Thanks in advance for any help you can provide,
Gary
--
Gary Weaver
Internet Framework Services
Office of Information Technology
Duke University