Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2876

Order of type mappings in generated WSDD depends on Java version

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.4
    • 1.4.1
    • WSDL processing
    • None

    Description

      The order of the type mappings in the WSDD generated by wsdl2java depends on the Java version and is not the same with Java 1.5 and 1.6. In principle this should not be a problem, but in some cases, a change in the order of type mappings triggers other issues. The consequence is that builds are not reproducible across different Java versions.

      The issue can be demonstrated with the ComplexEchoServiceTestCase#test2ComplexEchoServiceEcho21 test case. The WSDD file for that test case has two type mappings for the test.wsdl.echo.NamedValue[] Java type:

      <arrayMapping
      xmlns:ns="http://types.echo.services"
      qname="ns:>MyElement2Response"
      type="java:test.wsdl.echo.NamedValue[]"
      innerType="cmp-ns:NamedValue" xmlns:cmp-ns="http://types.echo.services"
      encodingStyle=""
      />

      <arrayMapping
      xmlns:ns="http://types.echo.services"
      qname="ns:ArrayOfNamedValue"
      type="java:test.wsdl.echo.NamedValue[]"
      innerType="cmp-ns:NamedValue" xmlns:cmp-ns="http://types.echo.services"
      encodingStyle=""
      />

      The test case attempts to serialize an instance of test.wsdl.echo.NamedValue[] as the value of an element with type xsd:anyType. In that case, Axis needs to identify the XML type in order to generate the xsi:type attribute. The code in TypeMappingImpl determines that XML type by looking at the last registered type mapping with the given Java type, and therefore the order of type mappings is relevant. With Java 1.5, the mapping with ns:ArrayOfNamedValue is registered last and the test case succeeds. With Java 1.6, the mapping with ns:>MyElement2Response is registered last. The test case fails because an anonymous type can't be used with xsi:type.

      Obviously the real problem in this example is that Axis attempts to use an anonymous type where this is not possible. Nevertheless, this kind of issue should not be triggered by a change of the Java version.

      Attachments

        1. AXIS-2876.patch
          2 kB
          Andreas Veithen

        Activity

          People

            Unassigned Unassigned
            veithen Andreas Veithen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: