injoy
injoy

Reputation: 4383

Is servlet also a kind of RPC?

As far as I understand, RPC is a client-server model while the client sends some requests to the server side and get some results back. Then, is Java servlet also a kind of RPC which uses HTTP protocol? Am I right?

Upvotes: 0

Views: 871

Answers (1)

JB Nizet
JB Nizet

Reputation: 692281

Here is the very first sentence of the wikipedia article on RPC:

In computer science, a remote procedure call (RPC) is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding the details for this remote interaction.1 That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote.

So, Servlets would be an RPC mechanism if you could invoke a servlet from a client using

SomeResult r = someObject.doSomething();

That's not the case at all. To invoke a servlet, you need to explicitely send a HTTP request and encode parameters in the way the servlet expects them, then read and parse the response.

Upvotes: 2

Related Questions