Great tip Stuart!  here's some additional tricks.

the destination directory for all generated source files should be /build/work 
directory.   usually i have /build/work/schema for wsdl and /build/work/com/... for 
java source.

after generating the java source, copy the implementation file over into the main 
source tree, and compile the /build/work tree. after compilation, use Ant to delete 
the class file.  The customized implementation file in the source tree can now be 
compiled and 'synched up' with the generated code.


/Chris

---------- Original Message ----------------------------------
From: Stuart Barlow <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date:  Thu, 28 Aug 2003 09:28:52 +0100

>You are right that its a bit fiddly. But with ANT you can automate
>the whole process.
>
>My process...
>1. Take original API classes and build.
>2. Run Java2WSDL to generate WSDL.
>3. Run WSDL2Java to generate new API .java files and bindings.
>4. Chuck away original API classes and copy new .java files into main
>    source tree.
>5. Compile all the classes.
>6. Take the generated deploy.wsdd and copy into server-config.wsdd
>    so that when tomcat deploys war file the service is included.
>7. Change the service 'className' to my real implementation that is
>    part of my original code.
>
>Most important part - Get ANT to do the whole thing!
>If eclipse can't cope then chuck it and use jEdit. :-)
>Keep implementation completely separate from API.
>
>Mayne, Peter wrote:
>> I'm just starting out with Axis, so I haven't learned the tricks of the
>> trade yet.
>> 
>> I have a class p.C, which contains at least one method that returns an
>> object of class p.R and throws an exception p.E.
>> 
>> I use axis-java2wsdl (from Ant within Eclipse) to generate a .WSDL file from
>> p.C, and then axis-wsdl2java to generate the .java files in the package
>> p.axis.
>> 
>> However, my p/R.java and p/E.java files are overwritten by wsdl2java, which
>> isn't nice.
>> 
>> If I now add my functionality to the generated p/R.java and p/E.java, and
>> then later on modify my p.C class and regenerate the WSDL and Axis .java
>> files, my p/R.java and p/E.java files will get overwritten again by the
>> plain wsdl2java generated classes.
>> 
>> On the other hand, if I add another method to p.C that returns an object of
>> class p.R2, I need to implement p.R2 to write my method, but I want
>> wsdl2java to generate p/R2.java so I can manually merge my p.R2 with the
>> Axis-generated p.R2, without overwriting my existing p/R.java and p/E.java.
>> 
>> I can do what the axis-wsdl2java doc suggests, and generate the .java files
>> somewhere else and use a <copy> task to copy the ones I want, but I still
>> have to manually change
>> 
>> Whatever happens, it seems there's no way around a fair amount of manual
>> work every time something changes.
>> 
>> Am I missing something here? What's the best way to do code management,
>> particularly in an Eclipse environment?
>> 
>> Thanks.
>> 
>> PJDM
>
>

Reply via email to