RPC — Remote Procedure Call

Sameera Hewamadduma
2 min readJul 26, 2020

--

RPC is used to client server based applications and it is a powerful for constructing distributed. Without having to understand the network’s details RPC can use to request a service from a program located in another computer. The service providing program working as a server and the requesting program working as a client.

RPC Working Flow

The client has a request message. Then that message RPC translate and send to the server. This request message can be a procedural or a function call to a remote server. After the server receive the message request server send the response back to the client. While the server is processing the call client is blocked.

RPC Diagram
  1. Client is called to Client Stub.
  2. Client Stub makes system calls to send message to the server.
  3. Using client’s operating system the message is sent client to server.
  4. The message is passed to the server stub by the server operating system.
  5. The parameters what set by the client stub are removed from the message.
  6. Finally, the server procedure is called.

Practical example for RPC

Let’s see a simple example for RPC.

In this scenario client send some String HelloWorld value and sever display that String.

Server Side Code

RPCHelloWorld.java

RPCHelloWorldImpl.java

RPCHelloWorldPublisher.java

Then run Publisher code . After running the Publisher code we can get XML output when browse below URL.

http://localhost:7779/RPC/hello?wsdl

Client Side Code

RPCHelloWorldClient.java

Then execute this part and output will be like this.

--

--