Web Services In Java- An Introduction
As the name implies, a web service is a "service available
on web".
The main difference between a web application (which may
also be called as a service available on web) and a Web service is that the
website/web application is meant for humans as end users whereas a web service
is meant for another application. A web service basically services the needs of
an application running on another server which is network accessible.
The main advantage of Web Service is Interoperability, which
means it is not any technology or platform specific.
This
means that a C# application running on an
Application Server A on a Windows machine can request for a web service written
in Java and running on an Application Server B on a Linux machine.
It may also happen that the web service host is an
Application Server whereas the web service client is a mobile device having a
network access to the host.
Web Services are mainly of two types:
SOAP based (JAX-WS specification) – uses standardized XML
messaging system where client sends SOAP messages to request for a service and
the host responds back again with SOAP messages. The transport mainly happens
over HTTP though FTP and SMTP are other protocols supported.
REST Style (JAX-RS specification) – uses HTTP for both
transporting the messages as well as an API for forming the service requests
and response.
We will first start with learning the SOAP based web services and then move on to REST style Web services.
Architecture:
The SOAP based web
architecture looks something like shown in the below diagram:
The main components of a SOAP-based web service can be defined as below:
a) WSDL (Web Service Description Language) - As the
name implies, this is a description of the Web Service. It describes the
exposed methods, their parameters, return types etc. It is an XML document.
b)UDDI (Universal Description, Discovery and
Integration) - This acts as a directory of the published web services. The web
service hosts can publish their services and the clients can find the services
with this layer.
c)SOAP (Simple Object Access Protocol) – It is an
XML based protocol for sending and receiving the data to and from the web
services.
d) HTTP/FTP/SMTP/BEEP – These are the protocols
responsible for transporting the messages between the applications.
That's all for the introduction part. In the next post in this series, we will look at writing a Web Service Client for an available web service.
Comments