Java Web Services Container

I just started learning Java Web Services (JAX-WS) and asked one question. The help documentation always talks about the web services container. My question is: what is a web services container and why do we need it. I saw a simple JAX-WS example in the book โ€œjava web services up and down,โ€ where a web service is published using:

Endpoint.publish("http://127.0.0.1:9876/ts", new TimeServerImpl()); 

In this example, I did not need to host the web service on Web Server / App Server or in any container.

and I was also able to access this web service.

So what is a container, why is it needed for web services?

+4
source share
3 answers

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 because it is the "only" container for servlets (JBoss and Glassfish are J2EE application servers) and is the reference implementation of the servlet specification. You will find many integrated IDE systems and tutorials that also use it.

+4
source

Web service specifications are implemented by various providers (Websphere, Weblogic, JBoss) through a servlet, and you need a service container to support this servlet. This servlet is specifically designed to handle SOAP-based traffic (HTTP traffic with SOAP headers and body), not a simple HTTP-based POST / GET that you send from browsers.

+1
source

The created web service runs in the container, which in this case is the server. A server can run several applications, each of which has its own container. A container is necessary because it provides a stand-alone environment for running Java, which is contained in the source.

Containers provide security, so if one application crashes due to a problem, other applications do not crash. Depending on the implementation, each container can work in its own virtual machine or can work through several virtual machines. Basically they are there to run the code in a separate environment from another code.

Here is the old (ish) documentation on the idea of โ€‹โ€‹containers. Basically, they can be run in different secure containers, like running several Java applications simultaneously, which are controlled through a single application (web server).

0
source

All Articles