Recent projects have provided or called other interfaces, in the end of the tangle is the use of servlets or webservice, so the internet to see the difference between them and RMI, easy to deepen understanding.
First compare under servlet and WebService
Request:
Servlet: Provides the request/Response mode, is a Java specification, can only be used in Java, to replace the difficult to understand the early use of CGI, is a stateless request response, the client accesses a server URL, only need to send a simple httprequest. Four ranges are specified: PageContext, request, session, application. Must depend on a variety of servlet containers, but the servlet can only accept a simple HTTP request;
WebService the first Microsoft proposed a XML as a carrier network information transmission specification, now almost all languages and platforms are supported, with a state mechanism, not dependent on the servlet container, you can send an XML as its request content, WebService is usually an HTTP-based remote method call (RMI) that can be reversed back to a remote object, in general the client segment can invoke the WebService method as if it were a local method.
Transmission:
The servlet uses the HTTP protocol to transmit data, and if you return XML with a servlet, the XML description frame is yours, and you must tell the user specific instructions that there is no uniform standard.
WebService is encapsulated into a SOAP message using a fixed XML format, which can use HTTP as the underlying data transfer, but is not limited to the HTTP protocol, and the method return message is standard.
return Result:
The servlet returns an HTML page;
WebService returns a binary file that can be complex objects or even use attachments or mutidata.
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:
The cross-platform feature of WebService is that servlets cannot be compared and can be called by various languages;
The servlet's relative speed advantage is not to be ignored.
Next look at the RMI and WebService
Both the client and server side of RMI must be java,webservice without this restriction
WebService is to pass an XML text file on the HTTP protocol, regardless of language and platform
RMI is the delivery of serializable Java objects on the TCP protocol and can only be used on Java virtual machines, binding language
RMI is the basis of the EJB remote call, only with RMI technology can realize remote invocation, using EJB is to implement components, things, resource pool, cluster and other functions.
WebService is the transfer of data through XML, the use of protocols such as HTTP can be transferred between heterogeneous systems, and can pass through the firewall, can be remotely called on the public network
The difference between servlet,rmi,webservice