aspose file tools*
The moose likes Web Services and the fly likes JAX-WS+Eclipse+Tomcat+Annotations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS+Eclipse+Tomcat+Annotations" Watch "JAX-WS+Eclipse+Tomcat+Annotations" New topic
Author

JAX-WS+Eclipse+Tomcat+Annotations

Bhairava Surya
Ranch Hand

Joined: Aug 19, 2007
Posts: 45
Hi All,

Can someone clearly explain the step by step process of implementing a webservice using annotations with JAX-WS.
IDE should be - Eclipse & Server - Tomcat.

Thanks & Regards,
Ravi.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Have you seen the instructions on the Metro web site on how to install Metro in Tomcat?
If not, here they are: https://metro.dev.java.net/2.0.1/
I have occasionally had minor problems when running Metro in Tomcat, but they have always been resolved by reinstalling Metro.
With Metro installed in Tomcat, you should be able to follow pretty much any JAX-WS tutorial.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Bhairava Surya
Ranch Hand

Joined: Aug 19, 2007
Posts: 45
Hi Ivan,

Thank you verymuch for your response. But, I have no idea about Metro.
So, Could you please send me the proper steps for writing/executing a webservice+Tomcat+Annotations(JDK1.6)

Thanks & Regards,
Ravi.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
In order to be able to run a web service inside Tomcat, you must have a web service stack.
There are many to choose from, such as Metro, Apache CXF, Axis etc.
I would personally recommend Metro, due to it being very easy to work with - install it and, more or less, forget it.
The steps would be:
- Install Tomcat.
- Install Metro.
- Create a Dynamic Web Project in Eclipse.
- Develop a web service endpoint implementation class in the Eclipse project.
Use JAX-WS annotations to annotate the class, a minimum would be to annotate the class with @WebService.
- Deploy the project to Tomcat.
- Test the web service using soapUI or similar tool.
Best wishes!
Bhairava Surya
Ranch Hand

Joined: Aug 19, 2007
Posts: 45
Hi Ivan,

This is my immediate response after seeing your mail.

Thank you so much. Let me try the steps what ever you have explained here and will let you whether I have succeeded in that or not.

But small doubts,
1) without the Webservices stack (Metro or something). Cant I write a webservice with normal tomcat 6.x(or any other versions)??
2) Does this Webservices stack Metro etc are required only when we want to write a webservice using annotations? because I think earlier using JAX-RPC we used to write in any tomcat right?

Thanks & Regards,
Ravi.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I guess it is possible to write a web service and deploy it to Tomcat without a web service stack, but it will mean much more work. You would basically have to implement a web service stack yourself.
Are there any obstacles that prevent you from installing Metro, for instance, in the Tomcat instance to which you will deploy your web service?

Though I have not tried, you may be able to deploy the Metro libraries as application-specific libraries, in the WEB-INF/lib directory of your application.
I cannot promise it will work - perhaps someone with some experience in this area care to step forward.

I think JAX-RPC also required a web service stack. Perhaps it was not as obvious back then - just a bunch of JARs.
I also suspect that they were included on a per-application basis.
Best wishes!
Bhairava Surya
Ranch Hand

Joined: Aug 19, 2007
Posts: 45
Hi Ivan,

Thank you very much for the info, please look into your PMs.

Thanks & Regards,
Ravi.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JAX-WS+Eclipse+Tomcat+Annotations