Can't get JAX-WS binding customization to work

Posted by Florian on Stack Overflow See other posts from Stack Overflow or by Florian
Published on 2010-03-15T12:37:57Z Indexed on 2010/03/15 12:39 UTC
Read the original article Hit count: 411


I'm trying to resolve a name clash in a wsdl2java mapping with CXF 2.2.6 The relevant wsdl snippets are:

    <xs:element name="GetBPK">
                    <xs:element name="PersonInfo" type="szr:PersonInfoType" />
                    <xs:element name="BereichsKennung" type="xs:string" />
                    <xs:element name="VKZ" type="xs:string" />
                    <xs:element name="Target" type="szr:FremdBPKRequestType" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element name="ListMultiplePersons" type="xs:boolean" minOccurs="0" />
        <xs:element name="GetBPKResponse">
                    <xs:element name="GetBPKReturn" type="xs:string" minOccurs="0" />
                    <xs:element name="FremdBPK" type="szr:FremdBPKType" minOccurs="0" maxOccurs="unbounded" />
                    <xs:element name="PersonInfo" type="szr:PersonInfoType" minOccurs="0" maxOccurs="5" />

<message name="GetBPKRequest">
    <part name="parameters" element="szr:GetBPK" />
<message name="GetBPKResponse">
    <part name="parameters" element="szr:GetBPKResponse" />

    <operation name="GetBPK">
        <wsdlsoap:operation soapAction="" />
        <input name="GetBPKRequest">
            <wsdlsoap:header message="szr:Header" part="SecurityHeader" use="literal" />
            <wsdlsoap:body use="literal" />
        <output name="GetBPKResponse">
            <wsdlsoap:body use="literal" />
        <fault name="SZRException">
            <wsdlsoap:fault use="literal" name="SZRException" />

As you can see, the GetBPK operation takes a GetBPK as input and returns a GetBPKResponse as an output. Each element of both the GetBPK, as well as the GetBPKResponse type would be mapped to a method parameter in Java. Unfortunately both GetBPK, as well as the GetBPKResponse have an element with the name "PersonInfo", which results in a name clash.

I'm trying to resolve that using a binding customization:

<jaxws:bindings wsdlLocation="SZ2-aktuell.wsdl"
    xmlns:jaxws="" xmlns:xs=""
    xmlns:jxb="" xmlns:wsdl=""
         <!-- See page 116 of the JAX-WS specification version 2.2 from 10, Dec 2009 -->
            childElementName="szr:PersonInfoType" name="PersonInfoParam" />


and call wsdl2java with the -b parameter. Unforunately, I still get the message:

WSDLToJava Error: Parameter: personInfo already exists for method getBPK but of type at.enno.egovds.szr.PersonInfoType instead of java.util.List<at.enno.egovds.szr.PersonInfoType>.  Use a JAXWS/JAXB binding customization to rename the parameter.

I have tried several variants of the binding customization, and searched Google for hours, but unfortunately I cannot find a solution to my problem.

I suspenct that the childElementName attribute is wrong, but I can't find an example of what would have to be set to make it work.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about java

Related posts about jax-ws