This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Axis wsdl2java generation duplicate file name issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis wsdl2java generation duplicate file name issue" Watch "Axis wsdl2java generation duplicate file name issue" New topic
Author

Axis wsdl2java generation duplicate file name issue

Rex Walter
Greenhorn

Joined: May 24, 2011
Posts: 3
Hi,
I am trying to generate java classes with a service provider WSDL, using Axis 1.4, JDK 1.5 (the package parameter is com.amanda.ws). I ended up with following exception. Not able to figure out why this is happening. Can anybody help please?

Thanks in advance:

Exception

org.apache.axis.wsdl.toJava.DuplicateFileException: Duplicate file name: src\com\amanda\ws\PaymentFrequencyType.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:113)
at org.apache.axis.wsdl.toJava.JavaBeanWriter.generate(JavaBeanWriter.java:1270)
at org.apache.axis.wsdl.toJava.JavaTypeWriter.generate(JavaTypeWriter.java:113)
at org.apache.axis.wsdl.toJava.JavaGeneratorFactory$Writers.generate(JavaGeneratorFactory.java:421)
at org.apache.axis.wsdl.gen.Parser.generateTypes(Parser.java:547)
at org.apache.axis.wsdl.gen.Parser.generate(Parser.java:432)
at org.apache.axis.wsdl.gen.Parser.access$000(Parser.java:45)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:362)
at java.lang.Thread.run(Thread.java:595)
Rudy Gireyev
Ranch Hand

Joined: May 03, 2011
Posts: 39
Hi Rex. Just wanted to mention a couple of things.
1. There's a newer version of Axis out.
2. I'm not sure how you are invoking the wsdl2java but you need to set the flag to overwrite the existing files.

Rudy
Rex Walter
Greenhorn

Joined: May 24, 2011
Posts: 3
import org.apache.axis.wsdl.WSDL2Java;

public class WsdlToJava {

public static void main(String[] args) {
args = new String[5];
//args[0] = "--package";
//args[1] = "com.amanda.ws";
args[0] = "--output";
args[1] = "src";
args[2] = "-v";
args[3] = "--overwrite";
args[4] = "epayment.WSDL";
WSDL2Java.main(args);
}
}

Rex
Rex Walter
Greenhorn

Joined: May 24, 2011
Posts: 3
Sorry, I posted the wrong code, the correct one is...

import org.apache.axis.wsdl.WSDL2Java;

public class WsdlToJava {

public static void main(String[] args) {
args = new String[5];
args[0] = "--package";
args[1] = "com.amanda.ws";
args[2] = "--output";
args[3] = "src";
args[4] = "epayment.WSDL";
WSDL2Java.main(args);
}
}

Thanks
Rex
Rudy Gireyev
Ranch Hand

Joined: May 03, 2011
Posts: 39
Hi Rex.

The option I had in mind was "-or" for Override Existing Code.

Generally speaking when I run Wsdl2java myself I usually do it from a command line. If you don't want to keep typing the command line parameters over and over you can simply create a batch file and invoke it.

Another suggestion I would make is to invoke the wsdl2java with the -h parameter only, or no parameter should work as well, so that you can see which parameters your version of wsdl2java accepts. That way you can check if that "src" parameter is correct.

Lastly, I wanted to mention that I now use Eclipse to generate the client code and no longer run wsdl2java manually.

HTH
Rudy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Axis wsdl2java generation duplicate file name issue
 
Similar Threads
axis wsdl2java nullPointerException
Null Pointer Exception while running WSDL file
While Parsing java.lang.InternalError: fillbuf
WSDL2JAVA DuplicateFileException
Trying to call WSDL2Java.main, but having issues when redirecting output