Sunday, 28 July 2013

Web Service

Hello All,
This blog gives a basic understanding of what a Web Service is and how can a Web Service be created and tested in Java.


The figure shows the basic flow and working of a webservices. The figure shows 3 entities. Service provider, Service Requester and Service Broker. Lets first define all the entities and then we will see how they interact with each other.

Service Provider: It is a web application in a nutshell created in any technology(Java, .Net, PHP) which hosts the service on internet ( HTTP ).

Service Requester: It is a application which calls the Web Service hosted on internet. Their is no binding on which technology the client is made in.

WSDL - Web Service Description Language: As the name suggests this is a file which describes the Web Service. This is a XML file which is used by the client to create the Web Service call. We will look into this in more detail in below sections.

UDDI - Universal Description, Discovery and Integration : UDDI is a platform-independent, Extensible Markup Language (XML)-based registry by which businesses worldwide can list themselves on the Internet, and a mechanism to register and locate web service applications.

Brief Description:
A organization which wants to sell service is the one called as Service Provider. Consider a organization that provides a Web Service to send SMS to mobiles. Lets call it SMS Provider. The SMS Provider will create a web application and host it on the internet. This web application is not the usual web application that is accessed by browser. This is a web application which is configured to be called by application based on a Protocol. This protocol is called SOAP.
SOAP is a XML message format having predefined tags like Envelope, Body, Fault etc. The client application sends a SOAP request on HTTP to the service and the SMS Provider will in turn send SMS and then send a response in SOAP forma back to the client application as a response. The client application does not need to have the jars of the Web Service to call it like we need in any java application or also in EJB. The client will just have the WSDL file which represents and describes the Web Service entities like method name, method parameters, return type, endpoint, etc. From this wsdl XML file the client application can create the stub which will call the Web Service. The client application can be in any technology. It is just that it should create a XML SOAP request and submit it to the endpoint URL.

On the next page we will create a Web Service Host. Click on the link below to go to the next chapter.
Web Service Host Example

Below are some posts that explain how to implement and test SOAP/REST Webservices

Spring-ws Spring-MVC-REST
JAX-WS(wsimport) Google REST APP


  1. Good article! The client is missing though..Please add.

    1. I have made the client page you can find it at

  2. Thanks for your reply buddy. Sorry for not providing the code to develope Webservice client. Will do that shortly and update you.

  3. Nice Article. Explained with very simple example and got it run in first try.

  4. such a complicated topic in simple words thanks mate


Share the post