aspose file tools
The moose likes Web Services and the fly likes Axis wsdl2java overwriting class files Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "Axis wsdl2java overwriting class files" Watch "Axis wsdl2java overwriting class files" New topic
Author

Axis wsdl2java overwriting class files

Todd Farmer
Ranch Hand

Joined: May 28, 2004
Posts: 59
Hi,

I'm just beginning to work through web services, and I'm having a difficult time. I created a test business object (com.greenbuildingpages.services.DistanceCalculator) and ran java2wsdl against it:

java org.apache.axis.wsdl.Java2WSDL -o wp.wsdl -l"http://localhost:8080/axis/services/distance" -n "urn:Example" -p"com.greenbuildingpages.services" "urn:Example" com.greenbuildingpages.services.DistanceCalculator

This created the wdsl file:



I then ran wsdl2java against this generated wsdl document:

java org.apache.axis.wsdl.WSDL2Java -o ./main/src/java -d Session -s -S true -Nurn:Example com.greenbuildingpages.services wp.wsdl

When this completed, I had the additional artifacts that I was expecting (DistanceCalculatorService,java, DistanceCalculatorServiceLocator.java, etc.). But my original DistanceCalculator.java file had been modified (into an interface).

I'm sure I likely have the command line arguments mixed up. Can somebody help me or point me towards their favorite Axis tutorial that might help me through this?

Thanks!

Todd Farmer

[ July 06, 2005: Message edited by: Todd Farmer ]

[ July 06, 2005: Message edited by: Todd Farmer ]
[ July 08, 2005: Message edited by: Todd Farmer ]
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
I'm no expert, but sounds like you're doing it right - what you want to do is specify a different output directory for the generated files. I'm not sure of the command line option (-o, probably, which you already use), but the wsdl2java Ant task can be used like this:



In general, with Web services (regardless of the Java toolkit used) I find it necessary to:

  • Keep the client and server bindings in separate directories (or in separate JARs).
  • Never put the two directories/JARs on the same classpath, when compiling or running the client or server application. Only put the server JAR/dir on the server classpath, etc. This prevents the inevitable namespace clashes (if the same packages are used).
  • Have neither on the classpath when regenerating the binding files themselves (e.g., when running wsdl2java). On some platforms (e.g., Weblogic) having one on the classpath produces *baffling* errors.


  • I also find it simplifies things if you generate the client bindings into a different package than the server ones. E.g., org.jacksonwest.travel.client.binding for the client, and org.jacksonwest.travel.server.binding for ther server.

    -Tim

    [edit: it might be nice to edit your post and shorten that massive line that makes this thread so hard to read...]
    [ July 06, 2005: Message edited by: Tim West ]
    Todd Farmer
    Ranch Hand

    Joined: May 28, 2004
    Posts: 59
    Thanks for the help and for the suggestions!
     
    I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
     
    subject: Axis wsdl2java overwriting class files
     
    Similar Threads
    DataHandler error in WSDL
    de/serializers for ArrayLists
    WSDL2Java Question
    how to call web services.
    Consuming a web service using Java