How are HTTP requests handled in Java Web Services?

java, servlets, web-services

Solution

Requests are handled by Something That Can Handle HTTP Requests, period.

It's convenient to use servlets or filters because the plumbing has already been written for you in the form of the servlet/application container, but this isn't a requirement. For example, a service running on Netty wouldn't need to follow the servlet spec. (Although IIRC there's a layer to allow Netty to call servlets directly.)

As long as both the client and server are talking HTTP the underlying implementation doesn't matter, and doesn't need to be servlets–it just needs to talk HTTP.

Problem

I am new to web services and am going through the book Java Webservices by Martin Kalin. I have gone through the initial basic concept of it and have a question: Say `producer` sends the HTTP request (containing SOAP Message envelope) to a Java web service (`consumer`). Is the request internally handled by Servlet which extracts the SOAP message and convert it to corresponding Java domain object and then service implementation bean is called? This question generic irrespective of any off the shelf framework like Metro and Axis. Just consider below code ``` Endpoint.publish("webserviceURL", new CustomerServiceImpl()) ``` Now if consumer sends the request to `webserviceURL`, will it be handled by Servlet always at the entry point or handled in some other way? (As this is how web request is handled in any web application)

Original source