RPC: (Remote Procedure Call)
A platform-neutral approach designed to communicate between applications, ignoring differences between operating systems and languages. Multi-lingual support
RMI: (Remote Method invocation)
The Java version of RPC, the underlying technology of EJB
RMI uses JRMP (Java Remote method Protocol) communication protocol, which is a kind of remote calling method built on TCP/IP protocol.
RMI uses stubs and skeletons to communicate with remote objects.
The stub acts as the client proxy for the remote object and has the same remote interface as the remote object.
The invocation of the remote object is actually done by invoking the client proxy object stub for the object.
5 Steps to create a remote method call:
1) Define an interface that extends the remote interface, and each method in the interface must declare that it will produce a remoteexception exception;
2) Define a class that implements the interface;
3) Use the Rmic program to generate the necessary stubs and frameworks for remote implementations;
(for example, run in the directory where Demo.rmi.EchoServer.java is located: Rmic demo.rmi.EchoServer)
4) Create a client program and server to make RMI calls;
5) Start the rmiregistry and run your own service programs and client programs.
The difference between RMI and RPC is that:
1) How the method is called
For RMI, if a method executes on the server, but no matching signature is added to the remote interface, the new method cannot be called by the RMI client.
In RPC, when a request arrives at the RPC server, the request contains a parameter set and a literal value, usually in the form of "Classname.methodname".
This indicates that the requested method is called "MethodName" in the "ClassName" class.
The RPC server then searches for the class and method that matches it, and takes it as input to that method parameter type.
The parameter type here is matched to the type in the RPC request. Once the match is successful, the method is called, and the result is encoded and returned to the client side.
2) Restrictions on the delivery of information
RMI invokes remote object methods, allowing methods to return Java objects and basic data types.
While RPC does not allow the delivery of objects, the RPC service message is represented by the external data representation (External data representation,xdr) language.
In addition, the one thing that RMI outperforms RPC or SOAP is that errors caused by object or method mismatches during program development can be discovered at compile time without waiting for the run time.
###########################
Note: Another article describes the difference between RPC and RMI:
The RMI underlying protocol is the TCP/IP;RPC underlying protocol: UDP.
Two nouns are not comparable because they are not a class of things:
RMI is a Java distributed framework defined by Sun, including some Java interfaces, and RPC is a network protocol.
http://kylinsoong.iteye.com/blog/801072
###########################
JMS:
JMS is a message specification on the Java platform. A generic JMS message is not an XML, but a Java object.
The difference between JMS and RMI is that:
With JMS services, objects are physically asynchronously moved from one JVM on the network to another.
The RMI object is bound to the local JVM, and only the function parameters and return values are transmitted over the network.
Soap vs. JMS:
1) SOAP focuses on remote service invocation, and JMS focuses on information exchange.
2) In most cases soap is a direct interaction between two systems (Consumer <--> Producer), and in most cases JMS is a tripartite system interaction (Consumer <-Broker, Producer).
Of course, JMS can also implement Request-response mode of communication, as long as the consumer or producer one side of the broker.
3) In most cases, WS is synchronous and JMS is asynchronous. Although WS can also be asynchronous, JMS can also be synchronous.
Reference Documentation:
http://visionsky.blog.51cto.com/733317/438693 (Comparison of Java RMI and RPC,JMS)
Http://wenku.baidu.com/view/309850c66137ee06eff91892.html (RMI and RPC)
HTTP://BLOG.CSDN.NET/YANGDELONG/ARTICLE/DETAILS/4557512 (drill down into soap, RPC, and RMI)
Http://www.blogjava.net/fanyingjie/archive/2011/09/24/359401.html (RMI for Java RPC communication mechanism, including simple examples)
http://blog.csdn.net/arau_sh/article/details/6696178 (Rpc,rmi,web SERVICES,JMS)
Thinking about the question: comparison between Java RMI and RPC,JMS