Title: Multiple import problem

Hi,
I am using WSDL2Java tool (beta-2 version), trying to generate Java classes and run into problem when one of my imported xsd was already been imported in another xsd. Generally the structure is similar to this:

MyWSDL. wsdl
        |
        +-- import comp.xsd
                |
                +--- import CompGlobals.xsd
                |               |
                |               +-- import OtherGlobals.xsd
                |
                +--- import TableGlobals.xsd
                |
                +--- import tbl1.xsd
                |               |
                |               +--- import TableGlobals.xsd
                +--- import tbl2.xsd
                |               |
                |               +--- import TableGlobals.xsd
                ...
                |
                +--- import tblN.xsd
                                |
                                +--- import TableGlobals.xsd

tbl1...tblN files define types that refer to the types defined in TableGlobals.xsd. The error occurs when WSDL2Java tool tryies to look for imports in tbl1.xsd and processes TableGlobals.xsd which was already processed. Error message says that MyUserDefinedType already exists and this happens in SymbolTable.symbolTablePut method.

I tried to move definitions from TableGlobals to OtherGlobals and reference OtherGlobals instead of TableGlobals in tbl1...tblN files, but this does not help by the same reason.

The only work around I found so far is to comment out import statement in all tbl1...tblN files, tool does not complain and generates all Java source files for me, but this makes all tbl1...tblN files invalid.

Another thing is that debug mode in this case did not help me, because this exception happens before   
if (bDebug) {   symbolTable.dump(System.out);     } in Emitter.emit method. So I found helpful to have next code in WSDLRunnable.run() method in WSDL2Java.java in its catch clause:

if (bDebug){
         emitter.getSymbolTable().dump(System.out);
                failure = e;
}

In this case at least dump is available and there is no need to debug source code.
May be it worth including that bit of code??

Otherwise it is nice tool which I like better than JAX-RPC RI, which did not work for me.

Thanks,

Michael Sapozhnikov

Reply via email to