Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1340

wsdl2java overwrites objectFactory methods if multiple service classes are in the same package, causes value type inheritance problems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.3, 2.1
    • Invalid
    • Tooling
    • None
    • Windows XP, eclipse

    • Unknown

    Description

      If you have two wsdl-based services, who's wsdl2java output is in the same package, the outputted objectFactory retains only the most recent service's methods.

      For example:
      Given two wsdl files, CarService.wsdl and UserService.wsdl; if one executes the wsdl2java binary with both services; with CarService first and UserService second, and with both service classes being output in package org.example.api, then only one objectFactory.java class will be created. First, objectFactory will be created with the objects for CarService.wsdl, and then it will be overwritten with UserService.wsdl's objects.

      It just so happens that in this scenario, if the former service contains an object that is abstract, that is, that it contains types that inherit via wsdl's extension keyword, AND methods for creating instances of CarService.wsdl's outputted java are NOT present in objectFactory.java, then CXF does not include type information in the SOAP messages.

      For example:
      given an alternate CarService.wsdl with the following types:

      <complexType name="Car" abstract="true">
      ...
      </complexType>

      <complexType name="Jeep">
      <extension base="Car">
      ...
      </extension>
      </complexType>

      If CarService.wsdl also had a method called getCarById, and wsdl2java output 2 java classes: getCarById.java and getCarByIdResponse.java, AND wsdl2java on UserService.wsdl was executed AFTER it was executed on CarService (resulting in an objectFactory without create methods for getCar*), then CXF will send SOAP messages like the following

      <soap>
      <getCarByIdResponse> <!-- type information here would mistakenly be missing -->
      ...
      </getCarByIdResposne>
      </soap>

      The ultimate result is that if a project has more than 1 service being output in the same package AND if more than 1 type in those two services use type extension, then CXF will have problems marshalling those classes because it will end up leaving out the type information for all classes not included in the ObjectFactory. One alternative would be to have the wsdl2java classes be output to multiple packages. If the different services shared types, this would result in duplicated code in each service.

      Attachments

        1. cxf-issue-objectFactory.zip
          12 kB
          Incognito

        Issue Links

          Activity

            People

              seanoc Sean O'Callaghan
              incognito Incognito
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: