I want to implement JAX-WS API in an existing Web application which runs only in Tomcat and uses servlet. I dont have any knowledge on JAX-WS. As I worried about web application portability from tomcat to other servers, I am preferring to implement JAX-WS as standard alone application in tomcat. What's the better way of doing it, implementing JAX-WS on Java EE container or like standalone application in Tomcat. Is there any better way of doing it...? And also I would like to know pros and cons implementing JAX-WS in container VS standalone application. And also suggest me Best JAX-WS implementation framework.
So I think you are misusing the terms here. A standalone application usually means a Java SE application which runs outside of any server. So I guess your question is:
Should I add JAX-WS webservices to the existing Java EE application which I already have or make a new Java EE application on Tomcat?
The answer is: it depends. For the beginning I would say it's better to create a separate application and implement the endpoints there.
The simplest possible JAX-WS web service would be:
@WebService
public class MyExample {
public String sayHello() {
return "Hello";
}
}
You need to put this in a standard Dynamic Web Project in Eclipse. If you add Glassfish as a server, there's no more to do. If you will use Tomcat, you'll need to add some libraries. Then you can access the webservice at: http://localhost:8080/MyWsApp/MyExampleService
(this implies that you named your project in eclipse MyWsApp)