Remote Procedure Call

Sangeevan Siventhirarajah
3 min readJul 18, 2020
Remote procedure call

Remote procedure call is a good approach to design distributed, client server based applications. It’s a kind of extending the conventional local procedure calling, so the called procedure don’t need to exists in the same address space as calling procedure. Those two processes can be exists on the same system, or they can be exists on different systems connected by the network.

Client has request that the RPC translates and sends to server. This request can be a procedure or a function call to a remote server. Server receives the request and sends the required response back to the client. Clint will be blocked while the server is processing the call and resume execution after server is finished.

Sequence of events in remote procedure call

  1. Client stub is called by the client.
  2. Client stub makes system call to send message to server and puts the parameters in message.
  3. Message sent from client to server by client’s operating system.
  4. Message passed to server stub by server operating system.
  5. Parameters are removed from message by server stub
  6. Server procedure is called by the server stub.
Sequence of events in remote procedure call

Advantages of RPC are It support process oriented and thread oriented models, Internal message passing mechanism of RPC is hidden from the user, Effort to re write and re develop the code is minimum in RPCs, RPCs can be used in distributed environment as well as local environment and many protocol layers are omitted by RPC to improve performance.

Creating JAX-WS requires no extra configuration settings. JWX-WS API is inbuilt in JDK, so no need to load any extra jar file for it. Lets look a simple example of JAX-WS example in RPC style.

There are created four files for hello world JAX-WS example. First three for server side and other one for client side.

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

JAX-WS Server Code

View generated WSDL

After running the publisher code, can view the generated WSDL file by visiting the URL: http://localhost:7779/ws/hello?wsdl

JAX-WS Client Code

Output

Hello World JAX_WS javapoint rpc

--

--