The relationship between Servlet and WebService

Source: Internet
Author: User
Tags wsdl

Transferred from: http://www.cnblogs.com/cy163/archive/2008/04/16/1155767.html

In fact, they are very similar from the effect of implementation.

Same point:
The client accesses the URL of a server and then gets the result returned.
The servlet we use is an HTTP-based request-answering pattern.
Most webservice low-level also use HTTP as the implementation.

Client side,
2 is not limited, as long as it is able to send HTTP requests to the client, but the ordinary application can be a browser, but the J2me,jese platform and even other languages of any form of client. This is determined by the characteristics of the HTTP protocol.


Difference:
However, the servlet can only accept a simple HTTP request, and WebService is sending an XML as its requested content.
As a result of the return, the servlet is an HTML page, and WS can be a complex object or even use an attachment or a Mutidata 2 binary file.

Server aspects of the same, the former need to adhere to the Java EE Web Application specification deployed in Tomcat,weblogic such an application server. WebService requires a WSDL file to deploy the service, or to register with UDDI.


In fact, I saw the title at the beginning that the two are irrelevant, how can compare it.
This next analysis, because their underlying HTTP implementations make them really similar.
WebService's cross-platform feature is not comparable to servlet
And the servlet's relative speed advantage is not to be ignored.
Top

2/F Gstart (Hawk)Responded at 2005-08-08 17:05:38 score 0

I asked an EJB and a Web service question in this version, and no one was listening. Upstairs this guy is good at the difference between Servlets and Web service, and by the way, EJB and Web service, I think Web service is used instead   A stateless session bean is a good idea. Web service seems to be deployable on Tomcat, and EJB requirements for running environments are more demanding.

The top of the upstairs can point to the EJB and Web service respectively used in what situation is more appropriate

3 Floor Layueer (Love sad, strive to ascend cents)Responded at 2005-08-08 17:30:40 score 0

Strong top

4/F Jfresh_man (November Chopin-nocturne)Responded at 2005-08-08 19:15:06 score 0

I don't actually have ejbs, because I don't like the stuff that EJB is so cumbersome about.
But webservice in the efficiency is not good, but it is in the application of XML, then the inevitable platform-independent language irrelevant, this is my favorite place.
Tomcat can be used to deploy WS using axis (a WS project of Apache), which is relatively straightforward. Top

5 Floor launch401 (Ulaanbaatar night so quiet and quiet)Responded at 2005-08-09 10:02:35 score 0

The Jax-rpc,servlet and stateless session beans can be packaged as WebServices server-side components, run in servlet containers and EJB containers, and can actually be treated as special servlets and EJBS.

It's just a soap transfer, not an HTTP transmission. Top

6/F Jfresh_man (November Chopin-nocturne)Responded at 2005-08-09 10:05:43 score 0

It's just a soap transfer, not an HTTP transmission.
---------
The underlying implementation of the SOAP transport is the HTTP request, and SOAP actually wraps the request information in its fixed XML format top

7/F Adamyong (Ayón)Responded to 2005-08-12 00:31:33 score 5

Basically agree with Jfresh_man's point of view. Soap just encapsulates the message, and it has nothing to do with the transfer. When we use soap we have to do it through the transport Protocol, of course HTTP is the most used. In SOAP spec, you do not qualify what transport protocol you are using.
To illustrate the difference between a servlet and a Web service, let me describe the implementation of Axis in general. When an HTTP request with a SOAP message is transmitted to axis, Axisservlet's Dopost method corresponds to that request. Our requests are often http://localhost:8080/axis/services/ServiceName, in accordance with the default deployment of axis, through http://localhost:8080/axis/ Services navigates to Axisservlet,axisservlet, inherits from HttpServlet, and then navigates to the requested service by resolving ServiceName, which are all well-implemented by axis. Deployed services you can understand this: dynamically binding to some modules on axis.
。 Axis then parses the SOAP message of the HTTP band through its own series of handler, and of course you can implement your own handler. Which method is called by parsing the SOAP message, and then called by the message value in soap, if the method is Req-res, also constructs a return SOAP message. Top

8 Floor Layueer (Love sad, strive to ascend cents)Responded at 2005-08-12 09:23:59 score 0

Learning Top

9/F Dddddy (with the lucky)Responded at 2005-08-12 18:25:05 score 0

This post should be added to the essence. Top

10 Floor Dianweihu (Forget it)Responded at 2005-08-26 12:52:23 score 0

Summarize (please correct):

The similarities and differences between Servelt and WebService:

Request:
The client accesses the URL of a server and only needs to send a simple httprequest.
But the servlet can only accept a simple HTTP request;
And WebService is able to send an XML as its requested content.

Transmission:
The servlet transmits data using the HTTP protocol.
WS is encapsulated in a fixed XML format as a SOAP message, and HTTP can be used as the underlying data transfer, but is not limited to the HTTP protocol.

return Result:
The servlet returns an HTML page;
The WS returned can be a complex object or even use an attachment or a Mutidata 2 binary file.

Deployment:
Servlets need to adhere to the Java EE Web Application Specification deployed on the application server, such as Tomcat,weblogic,websphere;
WebService requires a WSDL file to deploy the service, or to register with UDDI.

Advantage:
WebService's cross-platform features are not comparable to servlets;
And the servlet's relative speed advantage is not to be ignored.

Top

11 Floor simon0512 (insect pest)Responded at 2005-08-27 00:13:35 score 0

Learn
Top

12 floor gaoan (Wandering flowers---not angry, not two. )Responded at 2005-08-27 00:38:26 score 0

Learn

No experience with Web service ... Top

13 Floor ytcx_lt_82 (shouts)Responded at 2005-09-01 19:49:49 score 0

Top Ah! Top

14 Floor metaphy (6,000 feet away Zarathustra)Responded at 2005-09-05 09:50:55 score 0

Advantage:
WebService's cross-platform features are not comparable to servlets;
And the servlet's relative speed advantage is not to be ignored.
------------------------------------------------
Puzzled, what does this "cross-platform" mean?
Is it a cross-platform of data that is in XML format?
But no matter where you look, WebService doesn't seem to have much of an advantage.
Top

15/F Kingofhawks (Biancocelesti)Responded at 2005-09-06 11:57:44 score 0

Oh, learn something you don't know. Top

16 Floor Dianweihu (Forget it)Responded at 2005-09-07 09:17:03 score 0

Cross-platform
Independent of the specific development platform
Servlets must rely on the Java platform
WS can be done under any platform, as long as it conforms to its description specification OK top

17/F irvine007 (┣━┫rvine)Responded at 2005-09-07 20:56:46 score 0

Top ~ ~
Top

18/F Sqlink ()Responded to 2005-09-07 21:36:23 score 5

In addition to working with Web service, Servlets can handle standard HTML.
But Web service is too inefficient to be a rich client's means of communication, but it's a very good compatibility.

The relationship between Servlet and WebService

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.