Remote Procedure Call (RPC)

Suthesana
3 min readJul 18, 2020

Remote Procedure Call (RPC) is a interprocess communication technique that one program can use to request a service from a program located in another computer on a network without having to understand the network’s details. RPC is used to call other processes on the remote systems like a local system. A procedure call is also known as a function call or a subroutine call.

How does RPC work?

At the point when a remote procedure call is invoked, the calling environment is suspended, the procedure parameters are moved over the network to the environment where the procedure is to execute, and the procedure is then executed in that environment.

At the point when the procedure completes, the outcomes are moved back to the calling environment, where execution resumes as if returning from a regular procedure call.

The sequence of events in a remote procedure call

  1. The client calls the client stub. The call is a local procedure call with parameters pushed onto the stack in the normal way.
  2. The client stub packs the procedure parameters into a message and makes a system call to send the message.
  3. There are created 4 files for hello world JAX-WS example:The message is sent from the client to the server by the client’s operating system.
  4. The message is passed to the server stub by the server OS.
  5. The parameters are removed from the message by the server stub.
  6. Then, the the server stub calls the server procedure.

JAX-WS example in RPC style.

Four files are created for hello world JAX-WS example:

  1. HelloWorld.java
  2. HelloWorldImpl.java
  3. Publisher.java
  4. HelloWorldClient.java

The HellWorldClient.java file is created for client side and the rest of three files are created for the server side.

  1. HelloWorld.java

2.HelloWorldImpl.java

3.Publisher.java

4.HelloWorldClient.java

The output is

--

--