I have just started learning Java Web Services ( JAX-WS ) and have one question. The reference documentation always talks about Web Services container. My question is : What is a Web Services container and why do we need it. I saw a simple example of JAX-WS in book "java web services up and running" where the web service is published using:
Endpoint.publish("http://127.0.0.1:9876/ts", new TimeServerImpl());
This example did not require me to host a web service in a Web Server / App Server or any container.
and I was also able to access this web service.
So what is a container, why do we need it for web services?
The concept of a Web Services Container is a layer of abstraction that holds the enterprise-wide services, which are exposed as Web Services. This draws a parallel to the J2EE container for managing enterprise beans. It maintains a pool of Web Service Beans that services the requests from the request queues.
Containers are the interface between a component and the low-level platform-specific functionality that supports the component. Before a web, enterprise bean, or application client component can be executed, it must be assembled into a Java EE module and deployed into its container.
Basically you just need something that can run Java servlets. Typical examples are Tomcat, Glassfish, JBoss, Jetty and many others.
Of these Tomcat is the lightest weight as it is "only" a servlet container (JBoss and Glassfish are J2EE application servers) and is the reference implementation for the servlets specification. You'll find lots of IDE integration and tutorials that use it too.
The web service specification implementation by the various vendors( Websphere,Weblogic, JBoss) are through a servlet and you would need a servelet container to support this servlet. This servlet is specifically designed to handle SOAP based traffic (HTTP traffic with SOAP headers and body) rather than plain HTTP based POST/GET that you send from browsers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With