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 bu...@apache.org on 2002/09/23 22:07:49 UTC

DO NOT REPLY [Bug 12935] New: - WSDL2Java generates bad code for elements with Anonymous simple/complexTypes

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12935>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12935

WSDL2Java generates bad code for elements with Anonymous simple/complexTypes

           Summary: WSDL2Java generates bad code for elements with Anonymous
                    simple/complexTypes
           Product: Axis
           Version: 1.0-rc1
          Platform: Sun
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Basic Architecture
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: harishp@mail.finex.com


When generating code for anonymous nested simpleTypes within a complexType in
a schema definition, I noticed that WSDL2Java generates <elementName>.java,
<elementName>Type0.java so on. For example, If there is a complexType with name
foo and another complex type with bar  both these complex types declare an
anonymous simpletype element with a name "baz". The WSDL2Java generates
Baz.java and BazType0.java so on.. It just seems that nested classes seems like
an  obvious solution for this.  I was wondering why  WSDL2Java does not generate
nested classes  instead. Using the element name in the toplevel 
name space can cause a lot of potential conflicts.

I also noticed that WSDL2Java generates a class even if all one does is add a
pattern/length restriction - this seems very inefficient. Are there any plans to
optimize/clean this up?

I am attaching a modified AddressBook.wsdl that demonstrates the issue that I
mentioned below.  When I run wsdl2java on this wsdl file,  I get the following
exception:

java.io.IOException: Duplicate file name: AddressFetcher2/PhoneNumber.java.
Hint: you may have mapped two namespaces with elements of the same name to the
same package name.
       at org.apache.axis.wsdl.toJava.JavaWriter.generate(JavaWriter.java:139)
       at
org.apache.axis.wsdl.toJava.JavaTypeWriter.generate(JavaTypeWriter.java:144)
       at
org.apache.axis.wsdl.toJava.JavaGeneratorFactory$Writers.generate(JavaGeneratorFactory.java:286)
       at org.apache.axis.wsdl.gen.Parser.generateTypes(Parser.java:357)
       at org.apache.axis.wsdl.gen.Parser.generate(Parser.java:286)
       at org.apache.axis.wsdl.gen.Parser.access$000(Parser.java:83)
       at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:248)
       at java.lang.Thread.run(Thread.java:536)                              
WSDL2Java is attempting to create 2 classes within the same namespace
(PhoneNumber.java).


Harish