Designing a System Incorporating with JAVA RPC(JAX-WS)…

Web Services

Dulith Senanayake
3 min readJul 15, 2020

Simply Web Service may be a client-server application so as to speak in between applications over the network. it’s a language independent way of communication.

Web Services…

Web Services can be mainly categorized in to two types as follows,

  1. SOAP Web Services — Simple Object Access Protocol.
  2. RESTful Web Services — REpresentational State Transfer.

Java Web Services API

For the developing of Web Services java has defined two main APIs.

  1. JAX-WS
  2. JAX-RS

JAX-WS is SOAP Web Services and RESTful Web Services is JAX-RS.There are two ways to develop JAX-WS.

  1. JAVA RPC style.
  2. JAVA Document style.
JAX-WS

There are two main implementations of JAX-RS.Them are;

  1. Jersey.
  2. RESTEasy.
JAX-RS

The RPC is compatible for client server interaction flow control over switch between caller and callee.Of course, at an equivalent time the client and the server do not do both.Instead, the death cord jumps from the caller to callee then comes back again.
Now let’s design an easy HelloWorld System incorporating with JAVA RPC. we’ve to make 4 files.

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

HelloWorld.java, HelloWorldimpl.java & HelloWorldPublisher.java was created for server side and client side file HelloWorldClient.java.Application files are as follows…

HelloWorld.java

HelloWorld.Java

HelloWorldImpl.java

HelloWorldImpl.java

HelloWorldPublisher.java

HelloWorldPublisher.java

HelloWorldClient.java

HelloWorldClient.java

Now when we are calling from publisher to client output is as follows…

Output

From the above simple HelloWorld example we’ll identify following JAVA RPC concepts.
1. Client calls a neighborhood procedure on the client stub.
2 The client stub acts as a proxy and marshalls the choice and thus the args.
3. The client stub send it to the remote system via TCP/UDP.
4. The server stub unmarshalls the choice and args from the client.
5. The server stub calls to the server for the actual process.
6. The server stub marshalls the answer and sends the response back to the client.

In this post, I have also demonstrated the design of a HelloWorld framework that integrates JAVA RPC with JAVA RPC concepts information.My next post are getting to get on the Invoking methods in between two jvms. Stay Safe.

--

--

Dulith Senanayake
Dulith Senanayake

Written by Dulith Senanayake

Full Stack Developer | BSc. (Hons.) in Software Engineering | University of Kelaniya, Sri Lanka

No responses yet