Remote Procedure Call-RPC

suji guna
3 min readJul 18, 2020
RPC

Remote Procedure Call aka RPC is an interprocess communication strategy that is used inclient-server based applications.

A client features a request message that the RPC translates and sends to the server. This request could also be a procedure or a call to a remote server. When the server receives the request, it sends the specified response back to the client. The client is blocked while the server is processing the call and only resumed execution after the server is finished.

The events in RPC takes place as mentioned in the below sequence.

  • The client calls the client stub.
  • The client stub makes a system call for sending the message to the server and places the parameters in the message.
  • The message is sent to the server by the client’s operating system.
  • From there, the server’s operating system passes the message to the server stub.
  • The server stub removes the parameters from the message.
  • The server stub calls the server procedure.

Example:

Designing a HelloWorld System which incorporates the JAVA RPC.

We have to create 4 files for hello world JAX-WS such as:

  • HelloWorld.java
  • HelloWorldImpl.java
  • Publisher.java
  • HelloWorldClient.java

The prior 3 are for the server side and the rest one is for client side.

Server side implementation

  1. Helloworld.java

2. HelloWorldImpl.java

3. Publisher.java

By the above class, we are calling create method of Endpoint class for creating the endpoint for the given implementation object. And calling publish method of Endpoint class which is employed to publish the endpoint.

we can see the generated WSDL file by visiting the URL:

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

Client side implementation

HelloWorldClient.java

User client interface is for marshalling and demarshalling.

The output is below:

THANK YOU:)

--

--

suji guna

B.Sc in Software Engineering. University of Kelaniya, SriLanka.