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 "Juha Viskari (JIRA)" <ax...@ws.apache.org> on 2005/11/22 15:47:41 UTC

[jira] Created: (AXIS-2313) Overlapping element and attribute names rendered incorrectly from WSDL to Java

Overlapping element and attribute names rendered incorrectly from WSDL to Java
------------------------------------------------------------------------------

         Key: AXIS-2313
         URL: http://issues.apache.org/jira/browse/AXIS-2313
     Project: Apache Axis
        Type: Bug
  Components: WSDL processing  
    Versions: 1.3    
 Environment: Windows XP
    Reporter: Juha Viskari


A sample WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://example.WebServices" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://example.WebServices" xmlns:intf="http://example.WebServices" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://sample.target.namespace" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <wsdl:types>
  <schema targetNamespace="http://sample.target.namespace" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ProblematicType">
        <sequence>
	        <element name="duplicatename" type="unsignedLong"/>
        </sequence>
        <attribute name="duplicatename" type="unsignedLong" use="required"/>
   </complexType>
  </schema>
 </wsdl:types>

   <wsdl:message name="ProblematicType">
      <wsdl:part name="fault" type="tns1:ProblematicType"/>
   </wsdl:message>
   <wsdl:message name="getSomethingRequest"/>

   <wsdl:portType name="bugSample">
      <wsdl:operation name="getSomething">
         <wsdl:input message="impl:getSomethingRequest" name="getSomethingRequest"/>
         <wsdl:fault message="impl:ProblematicType" name="ProblematicType"/>
      </wsdl:operation>
   </wsdl:portType>

   <wsdl:binding name="sample.SoapBinding" type="impl:bugSample">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="getSomething">
         <wsdl:input name="getSomethingRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://example.WebServices" use="encoded"/>
         </wsdl:input>
         <wsdl:fault name="ProblematicType">
            <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="ProblematicType" namespace="http://example.WebServices" use="encoded"/>
         </wsdl:fault>
      </wsdl:operation>
   </wsdl:binding>

   <wsdl:service name="bugSample">
      <wsdl:port binding="impl:sample.SoapBinding" name="bugSample.cfc">
         <wsdlsoap:address location="http://example.com/WebServices/sample"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

WSDL2Java + compilation of the generated Java code reports
    [javac] C:\...\gen-src\namespace\target\sample\ProblematicType.java:20: duplicatename is already defined in ProblematicType
    [javac]            org.apache.axis.types.UnsignedLong duplicatename) {
    [javac]                                               ^

The generated code looks like:

    public ProblematicType(
           org.apache.axis.types.UnsignedLong duplicatename,
           org.apache.axis.types.UnsignedLong duplicatename) {
        this.duplicatename = duplicatename;
        this.duplicatename = duplicatename;
    }

I found the following correction log:

tomj        2004/01/08 13:32:23
  Modified:    java/test/wsdl/clash clash.wsdl VerifyFilesTestCase.java
               java/src/org/apache/axis/wsdl/toJava JavaBeanWriter.java
  Log:
  Fix problem with names pointed out by Zhou Zhu [zhou.zhu@ericsson.com]
  Have the Bean Writer check the variable names for duplicate and
  append a number (starting with 2) on to the end of duplicates.

The referred correction made in axis/wsdl/toJava/JavaBeanWriter.java was clearly present in the sources, but this kind of a WSDL managed to reproduce the problem. I made a quick hack in writeFullConstructor() in my local version of JavaBeanWriter.java to check the names in the same manner as in the earlier submitted correction.




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira