Designing a System Incorporating with JAVA RPC

What is Web Service?

Web service is a standardized medium to propagate communication between the client and server applications on the World Wide Web. A web service is a software module that is designed to perform a certain set of tasks.

There are mainly two types of web services.

1. SOAP web services — Simple Object Access Protocol. It is an XML-based protocol for accessing web services

2. RESTful web services — REpresentational State Transfer. An architectural style not a protocol

Java Web Services API

There are two main API’s defined by Java for developing web service

1. JAX-WS — for SOAP web services

2. JAX-RS — for RESTful web services

There are two ways to develop JAX-WS example.

1. RPC style

2. Document style

JAX-RPC is a specification that defines the Java APIs for making XML-based remote procedure calls (RPC). These APIs are used to invoke and get a response from a Web service using SOAP 1.1, and XML-based protocol for exchange of information in a decentralized and distributed environment.

There are created 4 files for hello world JAX-WS example:

1. HelloWorld.java

2. HelloWorldImpl.java

3. Publisher.java

4. HelloWorldClient.java

The first 3 files are created for server side and 1 application for client side.

JAX-WS Server Code

File: HelloWorld.java

HelloWorld.java

File: HelloWorldImpl.java

HelloWorldImpl.java

File: Publisher.java

Publisher.java

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

JAX-WS Client Code
File: HelloWorldClient.java

HelloWorldClient.java

Output:

JAVA RPC concepts that we identify from Helloworld example

  1. The client stub is called by the client.
  2. The client stub makes a system call to send the message to the server and puts the parameters in the message.
  3. 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 operating system.
  5. The parameters are removed from the message by the server stub.
  6. Then, the server procedure is called by the server stub.

Thank you.

Final Year Undergraduate | Software Engineering University of Kelaniya.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store