You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Martin Steiger (Updated) (JIRA)" <ji...@apache.org> on 2012/03/02 10:13:59 UTC

[jira] [Updated] (AXIS2-5258) The WSDL2Java ADB binding doesn't take namespace into account

     [ https://issues.apache.org/jira/browse/AXIS2-5258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Steiger updated AXIS2-5258:
----------------------------------

    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;
  }

  was:
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;
  }

    
> 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(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;
>   }

--
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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org