Search code examples
javaweb-serviceswsgen

java webservice - wsgen


I've got a task to create a webservice for school. The problem is for some reason I won't get wsgen to work correctly. I've got a class named Warehouse, which is in the package: com.horstmann.corejava.

Now I build this project named Warehouse, and after this I go into commandprompt(cmd) and type "cd C:\Program Files (x86)\Java\jdk1.6.0_20\bin" where wsgen.exe is.

Next line I type is: "wsgen -cd C:\Users\Julian\Documents\NetbeansProjects\Warehous com.horstmann.corejava.Warehouse"

Now I get an error that he wont find the class, so I change it to: "wsgen -cd C:\Users\Julian\Documents\NetbeansProjects\Warehouse\build\classes com.horstmann.corejava.Warehouse"

The next error I get here is that he wont be able to put the files in the directory...

Anyone got an solution, would be very appriciated!


Solution

  • According to the wsgen doc, there is not -cd option. You should use -cp, I think.

    wsgen -cp <location of the jar> com.horstmann.corejava.Warehouse
    

    When you use -cd, I suspect the command is confused with -d which is the target directory where to generate the output files, and explain the second message.

    Maybe this blog post will provide some help. I was using wsgen successfully.