When I try to generate a client from a wsdl document, I get a client that seems to have a lot of JAXBElement atributes, for instance
protected List<JAXBElement<?>> nameOrLinkingNameOrFamilyName;
I use soapUI to generate with apache cxf 2.3.3 as tool, also as config file the following:
<jaxb:bindings version="2.1"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:globalBindings generateElementProperty="false"/>
</jaxb:bindings>
As far as I saw this is related with the choice tags in the wsdl document.
thanks in advance
A
JAXBElement
will be generated for choice properties where multiple XML elements will correspond to the same Java class. This is in order to preserve information about the element since this can not be derived from the type of the value.binding.xml
The following JAXB schema bindings file will ensure that a choice property is generated:
XML Schema That Will Produce
Object
PropertyIn this version of the XML schema, all of the XML elements will correspond to a different Java class:
Since the value of the choice property is sufficient to uniquely identify the element, the property does not contain a JAXBElement to preserve this information:
XML Schema That Will Produce
JAXBElement
PropertyNow we will modify the choice structure so that both the
note
andemail
methods will correspond to theString
class.Since the value of the choice property is no longer sufficient to uniquely identify the element, the property must contain a JAXBElement to preserve this information:
For More Information