The WSDL2Java ADB binding doesn't take namespace into account
-------------------------------------------------------------

                 Key: AXIS2-5258
                 URL: https://issues.apache.org/jira/browse/AXIS2-5258
             Project: Axis2
          Issue Type: Bug
          Components: adb
            Reporter: Martin Steiger


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(packageName))
    {
      this.packageNameToClassNamesMap.put(packageName, new ArrayList());
    }
    List listOfNames = (List) this.packageNameToClassNamesMap.get(packageName);
    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;
  }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to