2

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:

enter image description here

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:

enter image description here

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.

Mahesha999
  • 22,693
  • 29
  • 116
  • 189
  • Deploy your Web service on servlet container (e.g. Tomcat) or some application server (e.g. Glassfish) and get rid of all unnecessary `wsgen` stuff. You are aware that tutorial you are following is for Web services written as standalone applications (and this is very rarely case in practice)? – Miljen Mikic Oct 29 '13 at 10:55
  • Yes I know that tut builds web services as a standalone application. and Do you mean instead of using `wsgen`, deploy it on the web server and get the necessary files? – Mahesha999 Oct 30 '13 at 08:27
  • Exactly. If you deploy it, all necessary files will be auto-generated and you don't have to take care about them. Additionally, in that case you won't use `Endpoint.publish(..)` method, but just annotate your service appropriately and server will take care about the rest (except in case of Tomcat, there you'll have to supply some configuration files as well). – Miljen Mikic Oct 30 '13 at 09:34
  • Yeah I know that but I just want to know how `wsgen` works in this specific situation and in fact if this is possible with `wsgen` – Mahesha999 Oct 30 '13 at 10:27

0 Answers0