Also - Most of the code generation I have seen, both with wsimport (JDK6/Metro) and wsdl2Java (CXF), will not preserve the underscore character like you have in your classes. I have seen WSDL/XSD files that contain things like this - *some_class_Name* - which results in a collision because it tries to generate classes and ObjectFactory classes that use the name *SomeClassName*. This was the result of WSDL that was generated by some 3rd party .NET tool and it was messy.
If you have control of this (you own the XSD types), perhaps changing the name of the element (the one that starts with the underscore character "_'" ) would resolve the issue - otherwise, the suggested custom binding approach may be your only choice. On Tue, Mar 20, 2012 at 7:12 AM, Adrien DAO-LENA <[email protected]>wrote: > Hi, > These elements share the same name, and the same namespace, so there is a > conflict, you should have a look at this: > > > http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/2.0/tutorial/doc/JAXBUsing4.html > > here a quick sample: > <jaxb:bindings schemaLocation="myFile.xsd"> > <jaxb:bindings node="//xsd:element[@name='XpathOfYourNode']"> > <jaxb:class name="XpathOfYourNodeWithANewName" /> > </jaxb:bindings> > </jaxb:bindings> > Adrien. > > 2012/3/20 Pasqualino Imbemba <[email protected]> > > > Hello, > > > > I'm using CXF 2.5.2. > > When I try to run wsdl2Java against this WSDL ( > > http://cooperazione.sian.it/wspdd/services/AllineamentoGIS?wsdl) I get > > this > > following error: > > WSDLToJava Error: Thrown by JAXB: > > Thrown by JAXB: > > Two declarations cause a collision in the ObjectFactory class. > > at line 21 column 3 of schema > > file:/tmp/tempdir769259763399432743.tmp/feature.xsd > > > > (Related to above error) This is the other declaration. > > at line 20 column 3 of schema > > file:/tmp/tempdir769259763399432743.tmp/feature.xsd > > > > org.apache.cxf.tools.common.ToolException: Thrown by JAXB: > > Thrown by JAXB: > > Two declarations cause a collision in the ObjectFactory class. > > at line 21 column 3 of schema > > file:/tmp/tempdir769259763399432743.tmp/feature.xsd > > > > (Related to above error) This is the other declaration. > > at line 20 column 3 of schema > > file:/tmp/tempdir769259763399432743.tmp/feature.xsd > > > > (...) > > > > Caused by: com.sun.istack.SAXParseException2: Two declarations cause a > > collision in the ObjectFactory class. > > > > The above WSDL refers to > http://schemas.opengis.net/gml/2.0.0/feature.xsd. > > Lines 20 and 21 of this schema relate to the following: > > > > <element name="_geometryProperty" type="gml:GeometryPropertyType" > > abstract="true"/> > > <element name="geometryProperty" type="gml:GeometryPropertyType"/> > > > > Could you please help me in getting me wsdl2Java work in this case? > > > > Thanks, > > ~pasquale > > > * *
