Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Axis wsdl2java generation duplicate file name issue

 
Rex Walter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic