Using wsgen to generate JAX-WS web service related classes, WSDL and XSD
-
01-07-2022 - |
Question
I am trying out a Hello World JAX-WS web service (a Document styled, instead of RPC) in eclipse. I am following this tut.
Here is my project setup:
Now I want to create web service support classes for deployment of web service using wsgen
as explained in the tut. So in windows command prompt I navigated to my apps' bin directory (>cd bin
)
and then executed the given command:
So in bin\com\Mahesh\ws\jaxws
it created following four files
- GetHelloWorldAsString.class
- GetHelloWorldAsString.java
- GetHelloWorldAsStringResponse.class
- GetHelloWorldAsStringResponse.java
Since source files are put in bin\com\Mahesh\ws\jaxws
folder but not in src\com\Mahesh\ws\jaxws
, doing package refresh in eclipse does not show newly generated source files in Package Explorer
1. I want these source files to be generated in src\com\Mahesh\wssrc
- an empty package you can see in first image.
2. Also when I published this web service and saw its WSDL file, I realized a separate XSD is getting created behind the scenes. So I want to use wsgen to create this WSDL and XSD and put it in another empty package src\com\Mahesh\rsc
you can see in first image.
After reading wsgen
's help I found these two options:
-r <directory>
: resource destination directory, specify where to place resouce files such as WSDLs-s <directory>
: specify where to place generated source files
But still I am unable to figure out how I can accomplish this.
3. Also the tut says:
Wait, when you run the end point publisher, you will hits following error message :
Wrapper class com.mkyong.ws.jaxws.GetHelloWorldAsString is not found. Have you run APT to generate them?
However I did not get any such error and my endpoint was published without any error. So do we still need to explicitly generate classes for web service deployment using wsgen
or this is handled by JAX-WS internally.
No correct solution