But if you take a more generic view of "web services" then REST-oriented services simply use HTTP GET and POST methods, which can certainly be implemented by servlets.
Given the current limitations of the servlet spec (up to 2.4) with reference to current web technologies using something like
Restlet or
Jersey (JSR-311; JAX-RS) would actually be more prudent as they do not have any dependencies on a servlet container.
Originally posted by somesh sai:
Can servlet perform the both the tasks or serving as webservice and processing requests through request/response at the same time?
The only way that could make any sense is with a representation format that can do "double-duty" - e.g. a response in XHTML that can be displayed in a browser while a
microformat supplies the meta-data for a programmatic consumer (IANA MediaType: application/xhtml+xml).
However as you earlier inquiries were regarding
SOAP web services with JAX-WS the answer to your question should be an emphatic NO.
Now, you can find code on the internet for SAAJServlets and as SOAP only uses HTTP POST you could build a servlet that serves regular HTML on the doGet while it "processes SOAP" on the doPost - however as was already previously pointed out - that would be a
really bad idea. And I'm not aware that you can actually do it with JAX-WS.
[ December 16, 2008: Message edited by: Peer Reynders ]