Description
Problem Statement:To create a simple web service and write any distributed application to consume the web service.
Tools: NetBeans IDE with GlassFish Server, Java 8
Theory:
Web Services :A Web service, is a method of communication between two applications or electronic devices over the World Wide Web (WWW).
A web service can be defined as a collection of open protocols and standards for exchanging information among systems or applications.
A Web service is an abstract notion that must be implemented by a concrete agent. The agent is the concrete piece of software or hardware that sends and receives messages, while the service is the resource characterized by the abstract set of functionality that is provided.
Types of Web Services
There are two types of web services:
SOAP-Based Web Services:SOAP stands for Simple Object Access Protocol. SOAP is an XML based industry standard protocol for designing and developing web services. Since it’s XML based, it’s platform and language independent. So, our server can be based on JAVA and client can be on .NET, PHP etc. and vice versa
RESTful Web Services:REST (Representational State Transfer ) is an architectural style for developing web services. It’s getting popular recently because it has a small learning curve when compared to SOAP. Resources are core concepts of Restful web services and they are uniquely identified by their URIs.
Steps involved in basic web service operational behaviour
The following are the steps involved in a basic SOAP web service operational behavior:
1. The client program that wants to interact with another application prepares its request content
as a SOAP message.
2. Then, the client program sends this SOAP message to the server web service as an
HTTP POST
request with the content passed as the body of the request.
3. The web service plays a crucial role in this step by understanding the SOAP request and converting it into a set of instructions that the server program can understand.
4. The server program processes the request content as programmed and prepares the output as the response to the SOAP request.
5. Then, the web service takes this response content as a SOAP message and reverts to the SOAP
HTTP request invoked by the client program with this response.
6. The client program web service reads the SOAP response message to receive the outcome of the server program for the request content it sent as a request.
Designing the solution:
Java provides its own API to create both SOAP as well as RESTful web services.
1. JAX-WS: JAX-WS stands for Java API for XML Web Services. JAX-WS is XML based Java API to build web services server and client applications.
2. JAX-RS: Java API for RESTful Web Services (JAX-RS) is the Java API for creating REST web services. JAX-RS uses annotations to simplify the development and deployment of web services.
Both of these APIs are part of standard JDK installation, so we don’t need to add any jars to work with them.
Conclusion:In this assignment we used web services like Soap and Rest to design a calculator application.
Reviews
There are no reviews yet.