CXF
  1. CXF
  2. CXF-4163

WSDLToJava Error: Thrown by JAXB: 'CodeGroup' is already defined ... OTA_CommonTypes.xsd

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.2, 2.5.2
    • Fix Version/s: 2.4.7, 2.5.3
    • Component/s: Tooling
    • Labels:
    • Environment:

      Windows XP
      Java SDK 1.6.0_26
      Eclipse IDE 3.5.2

    • Estimated Complexity:
      Advanced

      Description

      My WSDL imports several schemas. Some schemas import/include other schemas. Some schemas are imported/included by several schemas.
      Running WSDL2java with an ant task with the following options

      wsdl2java -d src -b custom.xml -exsh true -autoNameResolution -verbose MyExample.wsdl

      (custom.xml is used to disable wrapper-style)

      I got several errors such as:

      [java] WSDLToJava Error: Thrown by JAXB:
      [java] Thrown by JAXB:
      [java] 'CodeGroup' is already defined
      [java] at line 175 column 2 of schema file:.../OTA/2010B/OTA_CommonTypes.xsd
      [java] (related to above error) the first definition appears here
      [java] at line 45 column 2 of schema file:/.../My_CommonTypes.xsd

      OTA_CommonTypes.xsd defines the following type:

      <xs:attributeGroup name="CodeGroup">
      ...
      </xs:attributeGroup>

      My_CommonTypes.xsd defines the following type:

      <xs:attributeGroup name="CodeGroup">
      ...
      </xs:attributeGroup>

      OTA_CommonTypes.xsd is included by a schema defining a target namespace "http://www.opentravel.org/OTA/2003/05/OTA2010B"
      My_CommonTypes.xsd is included by a schema defining a target namespace "http://xml.example.com/MyTypes"

      XML schemas as well as WSDL are valid (other frameworks generates code without any issue - and even CXF WSDL validator returns a success) and the types should be generated in distinct packages, therefore without any conflicts.

      My assumption is that CXF wsdl2java fails at resolving the type namespace with schemas which are chameleon schemas (no targetNamespace attributes) which is the case for all OTA type schemas.

      A work-around that I would like to avoid as I'm exposing the WSDL to different clients using different frameworks and I don't want to create 1 WSDL per framework, would be to add targetNamespace attributes to all chameleon schemas.

      1. JIRA-CXF-4163.zip
        80 kB
        Yoann Guerro

        Activity

        Yoann Guerro created issue -
        Yoann Guerro made changes -
        Field Original Value New Value
        Description My WSDL imports several schemas. Some schemas import/include other schemas. Some schemas are imported/included by several schemas.
        Running WSDL2java with an ant task with the following options I got several errors such as:

             [java] WSDLToJava Error: Thrown by JAXB:
             [java] Thrown by JAXB:
             [java] 'CodeGroup' is already defined
             [java] at line 175 column 2 of schema file:.../OTA/2010B/OTA_CommonTypes.xsd
             [java] (related to above error) the first definition appears here
             [java] at line 45 column 2 of schema file:/.../My_CommonTypes.xsd

        OTA_CommonTypes.xsd defines the following type:

        <xs:attributeGroup name="CodeGroup">
         ...
        </xs:attributeGroup>

        My_CommonTypes.xsd defines the following type:

        <xs:attributeGroup name="CodeGroup">
         ...
        </xs:attributeGroup>

        OTA_CommonTypes.xsd is included by a schema defining a target namespace "http://www.opentravel.org/OTA/2003/05/OTA2010B"
        My_CommonTypes.xsd is included by a schema defining a target namespace "http://xml.example.com/MyTypes"

        XML schemas as well as WSDL are valid (other frameworks generates code without any issue - and even CXF WSDL validator returns a success) and the types should be generated in distinct packages, therefore without any conflicts.

        My assumption is that CXF wsdl2java fails at resolving the type namespace with schemas which are chameleon schemas (no targetNamespace attributes) which is the case for all OTA type schemas.

        A work-around that I would like to avoid as I'm exposing the WSDL to different clients using different frameworks and I don't want to create 1 WSDL per framework, would be to add targetNamespace attributes to all chameleon schemas.
        My WSDL imports several schemas. Some schemas import/include other schemas. Some schemas are imported/included by several schemas.
        Running WSDL2java with an ant task with the following options

        wsdl2java -d src -b custom.xml -exsh true -autoNameResolution -verbose MyExample.wsdl

        (custom.xml is used to disable wrapper-style)

        I got several errors such as:

             [java] WSDLToJava Error: Thrown by JAXB:
             [java] Thrown by JAXB:
             [java] 'CodeGroup' is already defined
             [java] at line 175 column 2 of schema file:.../OTA/2010B/OTA_CommonTypes.xsd
             [java] (related to above error) the first definition appears here
             [java] at line 45 column 2 of schema file:/.../My_CommonTypes.xsd

        OTA_CommonTypes.xsd defines the following type:

        <xs:attributeGroup name="CodeGroup">
         ...
        </xs:attributeGroup>

        My_CommonTypes.xsd defines the following type:

        <xs:attributeGroup name="CodeGroup">
         ...
        </xs:attributeGroup>

        OTA_CommonTypes.xsd is included by a schema defining a target namespace "http://www.opentravel.org/OTA/2003/05/OTA2010B"
        My_CommonTypes.xsd is included by a schema defining a target namespace "http://xml.example.com/MyTypes"

        XML schemas as well as WSDL are valid (other frameworks generates code without any issue - and even CXF WSDL validator returns a success) and the types should be generated in distinct packages, therefore without any conflicts.

        My assumption is that CXF wsdl2java fails at resolving the type namespace with schemas which are chameleon schemas (no targetNamespace attributes) which is the case for all OTA type schemas.

        A work-around that I would like to avoid as I'm exposing the WSDL to different clients using different frameworks and I don't want to create 1 WSDL per framework, would be to add targetNamespace attributes to all chameleon schemas.
        Yoann Guerro made changes -
        Attachment JIRA-CXF-4163.zip [ 12517089 ]
        Daniel Kulp made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Daniel Kulp [ dkulp ]
        Fix Version/s 2.4.7 [ 12319492 ]
        Fix Version/s 2.5.3 [ 12319491 ]
        Resolution Fixed [ 1 ]
        Daniel Kulp made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Daniel Kulp
            Reporter:
            Yoann Guerro
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 168h
              168h
              Remaining:
              Remaining Estimate - 168h
              168h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development