cxf codegen-plugin generating List of JAXBElement even if generateElementProperty=false

1k views Asked by At

i'm using cxf-codegen-plugin wsdl2java with the following binding file:

<jaxb:bindings version="2.1"
           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
<jaxb:bindings>
    <jaxb:globalBindings generateElementProperty="false">
    </jaxb:globalBindings>
</jaxb:bindings>
</jaxb:bindings>

My problem is the following section of my xsd

<xs:complexType name="clientType">
            <xs:sequence>
                <xs:element name="name" type="xs:string" minOccurs="0" />
                <xs:choice>
                    <xs:sequence>
                        <xs:element name="phone1" type="xs:string"
                                    minOccurs="1" />
                        <xs:element name="phon2" type="xs:string"
                                    minOccurs="0" />
                    </xs:sequence>
                    <xs:element name="phone2" type="xs:string"
                                minOccurs="1" />
                </xs:choice>
            </xs:sequence>
        </xs:complexType>

I still get a list of

protected List<JAXBElement<String>> content;

and my ClientType class is annotated with

@XmlElementRefs({
    @XmlElementRef(name = "name", type = JAXBElement.class, required = false),
    @XmlElementRef(name = "phone1", type = JAXBElement.class, required = false),
    @XmlElementRef(name = "phone2", type = JAXBElement.class, required = false)
})

EDIT: the codegen plugin

<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<executions>
    <execution>
        <id>generate-sources</id>
        <phase>generate-sources</phase>
        <defaultOptions>
            <bindingFiles>
                <bindingFile>${basedir}/src/main/jaxb/bindings.xml</bindingFile>
            </bindingFiles>
            <noAddressBinding>true</noAddressBinding>
        </defaultOptions>
        <configuration>
            <sourceRoot>${basedir}/src/main/java</sourceRoot>
            <wsdlOptions>
                <wsdlOption>
                    <wsdl>${basedir}/src/main/resources/service.wsdl</wsdl>
                    <extraargs>
                        <extraarg>-server</extraarg>
                    </extraargs>
                </wsdlOption>
            </wsdlOptions>
        </configuration>
        <goals>
            <goal>wsdl2java</goal>
        </goals>
    </execution>
</executions>
</plugin>

Is there a way to avoid having list of JAXBElement instead of list of String ?

Thanks

0

There are 0 answers