Hi,
There is a WSDL file generated for a .NET web service. When wsdl2java maven
plugin is run to generate a CXF client, the plugin fails due to a name
collision. The WSDL has elements that only differ in case. JXB is case
insensitive. The cfx-codegen-plugin suggests to use a class customization. Even
there are similar examples for class customizations online, I haven't been able
to get mine to work.
Output of Maven cfx-codegen-plugin:
[INFO] Thrown by JAXB : A class/interface with the same name "com.sonicApi.Creat
ePassResponse" is already in use. Use a class customization to resolve this conf
lict.
1. Attempt at class customization:
<jaxws:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
wsdlLocation="sonic-api.wsdl">
<jxb:bindings
node="wsdl:definitions/wsdl:types/s:sche...@targetnamespace='http://www.cinemanow.com/api/']">
<jxb:bindings node="s:eleme...@name='createPassResponse']">
<jxb:class name="CreatePassResponseLowerCase"/>
</jxb:bindings>
</jxb:bindings>
</jaxws:bindings>
Result: Still the same error message
2. Attempt at class customization:
<jaxws:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
wsdlLocation="sonic-api.wsdl">
<jaxws:bindings
node="wsdl:definitions/wsdl:types/s:sche...@targetnamespace='http://www.cinemanow.com/api/']">
<jaxws:bindings node="s:eleme...@name='createPassResponse']">
<jaxws:class name="CreatePassResponseLowerCase"/>
</jaxws:bindings>
</jaxws:bindings>
</jaxws:bindings>
Result: Different error:
[INFO] Thrown by JAXB : Unexpected <jaxws:bindings> appears at line 0 column 0 o
f schema file:/C:/stuff/apache-maven-2.1.0/playground/cxfspring/cxf-spring/src/m
ain/wsdl/sonic-api.wsdl#types1
3. Attempt at class customization:
<jaxws:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
wsdlLocation="sonic-api.wsdl">
<jaxws:bindings
node="wsdl:definitions/wsdl:types/s:sche...@targetnamespace='http://www.cinemanow.com/api/']">
<jaxws:bindings node="//s:eleme...@name='createPassResponse']">
<jaxws:class name="CreatePassResponseLowerCase"/>
</jaxws:bindings>
</jaxws:bindings>
</jaxws:bindings>
Result: Yet another error:
[INFO] Could not find any node with the XPath expression: //wsdl:definitions/wsd
l:types/s:sche...@targetnamespace='http://www.cinemanow.com/api/']///s:element[@
name='createPassResponse']
SUMMARY: I have run a lot more attempts at translating one of the colliding
element names to something else. Yet, all of them provide only errors that
don't point to a solution. How can the XML elements be properly name to classes:
createPassResponse -> CreatePassResponseLowerCase
CreatePassResponse -> CreatePassResponseUpperCase
Thomas
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If the reader of this message is not the intended recipient,
you are hereby notified that your access is unauthorized, and any review,
dissemination, distribution or copying of this message including any
attachments is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete the material from any
computer.