WSDL2Java overwrite files when generating code because the expectation is that it is 
overwriting files that *it* generated on a previous run.  The one file it does not 
overwrite is <service>Impl.java when used with the --server switch on the assumption 
that you may already have a implementation of the service that it should not overwrite 
with its skeleton version.

It should be trivial to specify an output directory for WSDL2Java and copy only the 
files you want to your actual src directory.

Tom Jordahl
Macromedia Server Development

-----Original Message-----
From: Joerg Buchberger [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 04, 2003 5:34 AM
To: [EMAIL PROTECTED]
Subject: Java2WSDL2Java overwrites pre-existing class

Hi all.

What am I doing wrong here ? 
What am I missing ?

1. Did define a simple Java interface (see description of interface and two
utility-classes below).
2. Used Java2WSDL on it.
3. Then used WSDL2Java on the resulting wsdd-file.

After that one (not none, not both, but one) of my utility-classes got
overwritten by WSDL2Java. The same is true for the initial interface. (No
original code, e.g. methods etc. is preserved at all.)

Then I separated my source dir from the axis-generated-source-dir.
That just helped me to preserve my sources, of course.
When it comes to compiling I either can't use the axis-generated-classes or my
utility-classes depending on which get compiled first and subsequently
overwrite the other. (As a consequence the whole thing doesn't compile
completely.)

Note: This example is a simplification of the real code; for ease of reading
and discussing.
If you need additional informations in order to help, please let me know which
wsdl, wsdd file or whatever else I should additionally post (didn't want to
include more, because the mail is already quite big).

Thanks a lot.
Cheers,
Joerg


p.s. here the descriptions of initial interface and the utility classes (Item
is part of the interface, i.e. it is the services return value; Key in turn is
part of the Item class.)


<INTERFACE-SNIP>
package com.project.services;
import com.util.Item;

public interface Foobar
{
    public Item getFoo();

} 
</INTERFACE-SNIP>



<ITEM-TYPE-SNIP>
package com.util;

import java.util.List;

public class Item extends Object
{
    public Item()
    {
    } 

    public Item(Key itemID, String itemName, List childrenList)
    {
        this.itemID       = itemID;
        this.itemName     = itemName;
        this.childrenList = childrenList;

    } // END constructor

    private Key    itemID;
    private String itemName;
    private List   childrenList;

    (... public getter / setter methods for above attributes ...)

}
</ITEM-TYPE-SNIP>


<KEY-TYPE-SNIP>
package com.util;

public class Key extends Object
{
    public Key()
    {
    } 

    public Key(int itemPos, int repositoryID)
    {
        this.itemPos      = itemPos;
        this.repositoryID = repositoryID;

    } // END constructor

    private int    itemPos;
    private int    repositoryID;

    (... public getter / setter methods for above attributes ...)

}
</KEY-TYPE-SNIP>

Reply via email to