I am considering standardized web services, such as JAX-WS and JAX-RS:
As far as I am concerned, some important advantages with standardized solutions are:
- They have been tested.
- They are probably taking more things into consideration than I am able to do if designing a custom solution.
- They are documented.
- There are other people using these solutions that you can ask and share experiences with.
- They are often portable; there are several JAX-WS implementations etc.
Web services operate on a higher level than servlets, thus making it easier to implement advanced functionality. But note that almost all widely used WS implementations (Axis, CXF, JAX-WS RI, JAX-RS RI, Restlet) are implemented as web apps using the servlet API, so whatever you can do with those you can do with servlets directly - it's just way more work to implement.
I don't really agree with Ivan's list as a differentiator between "standard" WS APIs (like JAX-WS and JAX-RS) and other WS implementations (like Restlet, Axis and CXF). Those points apply to all frameworks I mentioned above to a large degree, not just the reference implementations.
Ulf Dittmer wrote:I don't really agree with Ivan's list as a differentiator between "standard" WS APIs (like JAX-WS and JAX-RS) and other WS implementations (like Restlet, Axis and CXF). Those points apply to all frameworks I mentioned above to a large degree, not just the reference implementations.
What I meant was that I only wanted to consider standardized solutions versus homebrewed solutions. The realm of other solutions may encompass things that I know little, or nothing, about - thus my reluctance to say anything about it.
The most obvious difference between Servlet and Web Service is:
You access servlet via HTTP while access Web Service via SOAP (Simple Object
But, in fact, you can not directly invoke a servlet, you can only open URL
connection and put some parameter to the servlet if the caller is out of
your application. And you can not restrict what parameters the caller can
put. The caller does not know what parameters your servlet can receive
So, You'd better use web service to provide API to other applications, the
WSDL file of your web service can give the caller enough information to
invoke your web service.
I suggest you can learn more about web service.