Hi folks

I've got wsdl with three xsd-s:
        tpml-trade_2_0.xsd - imports two others
        fpml-4-6-7-rec-1/www.fpml.org/spec/2009/fpml-4-6-7-rec-1/fpml1.xsd
        fpml-4-6-7-rec-1/www.fpml.org/spec/2009/fpml-4-6-7-rec-1/fpml2.xsd -
includes fpml1.xsd


*tpml-trade_2_0.xsd*:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns="urn:x-schema-db-com:tpmbase/tpml/tpml_2"
xmlns:fpml="http://www.fpml.org/2009/FpML-4-6";
targetNamespace="urn:x-schema-db-com:tpmbase/tpml/tpml_2">
        <xs:import namespace="http://www.fpml.org/2009/FpML-4-6";
schemaLocation="fpml-4-6-7-rec-1/www.fpml.org/spec/2009/fpml-4-6-7-rec-1/fpml1.xsd"/>
        <xs:import namespace="http://www.fpml.org/2009/FpML-4-6";
schemaLocation="fpml-4-6-7-rec-1/www.fpml.org/spec/2009/fpml-4-6-7-rec-1/fpml2.xsd"/>
        <xs:complexType name="Role">
                <xs:sequence>
                        <xs:element name="Entry1" type="fpml:Entry1"/>
                        <xs:element name="Entry2" type="fpml:Entry2"/>
                </xs:sequence>
        </xs:complexType>
</xs:schema>

*fpml1.xsd*:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns="http://www.fpml.org/2009/FpML-4-6";
targetNamespace="http://www.fpml.org/2009/FpML-4-6";>
        <xsd:complexType name="Entry1">
                <xsd:sequence>
                        <xsd:element name="Id" type="xsd:string" />
                </xsd:sequence>
        </xsd:complexType>
</xsd:schema>


*fpml2.xsd*:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns="http://www.fpml.org/2009/FpML-4-6";
targetNamespace="http://www.fpml.org/2009/FpML-4-6";>
        <xsd:include schemaLocation="fpml1.xsd" />
        <xsd:complexType name="Entry2">
                <xsd:sequence>
                        <xsd:element name="Id" type="xsd:string"/>
                        <xsd:element name="Entry1" type="Entry1"/>
                </xsd:sequence>
        </xsd:complexType>
</xsd:schema>



I run ant wsdl2java and get generated java classes without errors:
wsdl2java -verbose -d D:\Projects\workspace\wsdl_test\src\gen-api
D:\Projects\workspace\wsdl_test\src\schema/calcservice.wsdl

Then I deploy webservice on server, try to generate java classes and receive
errors:

     [java] wsdl2java -verbose -d
D:\Projects\workspace\wsdl_test\src\gen-api
http://localhost:8399/service/services/gate?wsdl
     [java] wsdl2java - Apache CXF 2.7.2
     [java] WSDLToJava Error:
http://localhost:8399/service/services/gate?xsd=fpml-4-6-7-rec-1/www.fpml.org/spec/2009/fpml-4-6-7-rec-1/fpml1.xsd
[0,0]: 'Entry1' is already defined
     [java] http://localhost:8399/service/services/gate?xsd=fpml1.xsd [0,0]:
(related to above error) the first definition appears here
     [java] org.apache.cxf.tools.common.ToolException:
http://localhost:8399/service/services/gate?xsd=fpml-4-6-7-rec-1/www.fpml.org/spec/2009/fpml-4-6-7-rec-1/fpml1.xsd
[0,0]: 'Entry1' is already defined
     [java] http://localhost:8399/service/services/gate?xsd=fpml1.xsd [0,0]:
(related to above error) the first definition appears here

Seems that CXF is still unable to resolve same xsd from different
import/include.
I used JAXB 2.2.2, CXF 2.7.2 and Apache Tomcat 7.0.22.

I found some resolved Jira issues related to this problem. Looks like this
problem were discussed but hadn't been resolved.

CXF-3968 <https://issues.apache.org/jira/browse/CXF-3968>  
CXF-3927 <https://issues.apache.org/jira/browse/CXF-3927>  
CXF-4163 <https://issues.apache.org/jira/browse/CXF-4163>  


Are there any workarounds or attributes I should use during generation java
classes?



--
View this message in context: 
http://cxf.547215.n5.nabble.com/WSDLToJava-Error-is-already-defined-tp5721645.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to