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

The WSDL2Java ADB binding doesn't take namespace into account

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.6.2, 1.7.0
    • adb
    • None

    Description

      I have 3 complex types defined with the same name, but they are in different namespaces. However, when the ADB code is generated it still appends a unique counter to the end of the third class name. This shouldn't be necessary since they are in different namespaces.

      With the fix of issue 3136, for the second type with the same name an "E" is appended instead of the counter. But for the third type still the counter is applied.

      The Problem seems to be that the package name is not taken in account as long as it isn't a wrapped type.

      I Fixed this by patching the method org.apache.axis2.schema.writer.JavaBeanWriter.makeFullyQualifiedClassName(QName)

      The patch is based on Revision 606099

      public String makeFullyQualifiedClassName(QName qName)
      {

      String namespaceURI = qName.getNamespaceURI();
      String packageName = getPackage(namespaceURI);
      String originalName = qName.getLocalPart();
      String packagePrefix = null;
      if (wrapClasses)

      { packagePrefix = (this.packageName == null ? DEFAULT_PACKAGE + "." : this.packageName) + WRAPPED_DATABINDING_CLASS_NAME; }

      else if (writeClasses)

      { packagePrefix = packageName; }

      String className = null;
      if (!this.packageNameToClassNamesMap.containsKey(packagePrefix ))

      { this.packageNameToClassNamesMap.put(packagePrefix , new ArrayList()); }

      List listOfNames = (List) this.packageNameToClassNamesMap.get(packagePrefix );
      className = makeUniqueJavaClassName(listOfNames, originalName);

      String fullyqualifiedClassName;
      if (packagePrefix != null)

      { fullyqualifiedClassName = packagePrefix + (packagePrefix.endsWith(".") ? "" : ".") + className; }

      else

      { fullyqualifiedClassName = className; }

      // return the fully qualified class name
      return fullyqualifiedClassName;
      }

      Attachments

        1. JavaBeanWriter.java.patch
          2 kB
          Martin Steiger
        2. my.wsdl
          23 kB
          Martin Steiger

        Issue Links

          Activity

            People

              sagara Sagara Gunathunga
              wetar Martin Steiger
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: