Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-4071

WSDL11ToAxisServiceBuilder + RPC/Literal OR HTTP binding =~ Inconsistent XMLSchema object: duplicated global element declarations

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4, nightly
    • None
    • kernel
    • None
    • Windows XP. 4GB RAM Intel Xeon dual-core @2.75Ghz

    Description

      In WSDL11ToAxisServiceBuilder:

      1) Within the 'setup()' method, a map ('schemaMap') indexed by targetNamespace and values equal root (W3C) Elements is populated

      2) When either a RPC/Literal binding or an HTTP binding with message parts referencing type definitions is found, new global element declarations based on the WSDL operation name are created. These new elements can either be added to an existing (W3C) Document (in case the 'schemMap' contains a document with the same target namespace as the one that the newly created element has) or added to a newly created Document.:
      a) If a new document is created, an additional namespace mapping declaration is added to that document (see 'XMLNS_AXIS2WRAPPED' ). This helps distinguishing this document among the other original ones.
      b) If an additional document is NOT created, the new global element declarations are added to an existing document. No additional namespace mapping declaration is added.

      3) After all wrapped elements have been created, XmlSchema objects are created from the original, modified and newly created W3C Documents

      Note that all this leads to duplicate global element declarations any time there's already an element named after an operation name. This is very common and happens every time operation names across multiple bindings are the same. In general, all this is caused by the creation of XML schema elements while transforming operations using the RPC/Literal encoding style into the Document/Literal encoding style using the wrapped convention.

      There is more than one problem associated with the creation of new XML global element declarations:

      1) First of all, the XML schema documents end up with duplicated global element declarations which makes the Schema invalid. But why nobody seems to have noticed it? I think it's just a coincidence, let me explain: A XmlSchema object maintains a MAP, indexed by element name (QName) and XmlSchemaElement objects as values. This map is used for a faster object retrieval. At the same time, the XmlSchema object also maintains a LIST of all nodes (XmlSchemaObject objects I think). So whenever duplicate elements are added to the schema, the last-inserted elements overwrite the previous elements on the MAP of elements but they are inserted with no problems in the LIST of nodes and because the latter elements are usually what people is looking for (i.e. in case of databinding libraries that create the client stub for a single port), the 'correct' element is returned

      2) If the Definition object (from WSDL4J) is used to populate multiple AxisServices from different WSDL ports, for example, within the 'WSDL11ToAllAxisServicesBuilder' (which, by the way doesn't seem to work at all), the W3C Schema Document may end up with multiple duplicated global element declarations and the 'AxisService.getSchemaElement(QName)' method will fail to return the appropriate reference.

      Attachments

        1. JUnit Tests - Before.jpg
          45 kB
          Antonio Andrade
        2. AXIS2-4071.patch
          7 kB
          Antonio Andrade

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aandrade Antonio Andrade
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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