Web Services Tutorial With Examples

Many organizations use multiple software systems for management. Different software systems often need to exchange data with each other, and a web service is a method of communication that allows two software systems to exchange this data over the internet. The software system that requests data is called a service requester, whereas the software system that would process the request and provide the data is called a service provider.

Web Services

Web services are client and server applications that communicate over the World Wide Web’s (WWW) HyperText Transfer Protocol (HTTP). As described by the World Wide Web Consortium (W3C), web services provide a standard means of interoperating between software applications running on a variety of platforms and frameworks. Web services are characterized by their great interoperability and extensibility, as well as their machine-processable descriptions, thanks to the use of XML. Web services can be combined in a loosely coupled way to achieve complex operations. Programs providing simple services can interact with each other to deliver sophisticated added-value services.
Web services allow different applications from different sources to communicate with each other without time-consuming custom coding, and because all communication is in XML, Web services are not tied to any one operating system or programming language. For example, Java can talk with Perl, Windows applications can talk with UNIX applications.

Advantages Of Web Services

  • Reuse already developed(old) functionality into new software.
  • Web Services allow the business logic of many different systems to be exposed over the Web.
  • Web Services are virtually platform-independent.
  • Each service exists independently of the other services that make up the application. Individual pieces of the application to be modified without impacting unrelated areas.
  • Ease of Integration
  • Web Services uses standardized industry standard protocol for the communication. All the four layers (Service Transport, XML Messaging, Service Description and Service Discovery layers) uses the well defined protocol in the Web Services protocol stack.
  • Web Services uses HTTP protocol for the communication, so you can use your existing low cost internet for implementing Web Services.

Web Services Components

Web service has three main components:
  1. SOAP
  2. Simple Object Access Protocol (SOAP) is a communication protocol that communicates between applications without understanding the configuration and programming of any operating system and programming language. A program from one computer system can communicate with other program on another computer system within and beyond network using SOAP protocol on the Internet.
  3. WSDL
  4. Web Services Description Language (WSDL) is used to describe a web service in an XML file. It covers all the aspects of a web service like what is the message format, communication protocol, endpoint, security etc. This is a standard provided by W3C consortium and widely accepted for web services description. A wsdl xml file for a web service is generally expected to be published publicly so that parties seeking to utilize its services can understand the nature of service and consume it accordingly.
  5. UDDI
  6. UDDI stands for Universal Description, Discovery and Integration.It is a directory service. Web services can register with a UDDI and make themselves available through it for discovery

Web service design approaches

There are two approaches in implementing a web service and they are bottom-up and top-down.

Bottom Up Approach

A developer using a bottom-up model writes implementing classes first (in some programming language), and then uses a WSDL generating tool to expose methods from these classes as a web service. This is simpler to develop but may be harder to maintain if the original classes are subject to frequent change.

Top Down Approach

A developer using a top-down model writes the WSDL document first and then uses a code generating tool to produce the class skeleton, to be completed as necessary. This model is generally considered more difficult but can produce cleaner designs and is generally more resistant to change. As long as the message formats between sender and receiver do not change, changes in the sender and receiver themselves do not affect the web service. The technique is also referred to as contract first since the WSDL (or contract between sender and receiver) is the starting point.

Web Services Tutorial With Examples
This is a basic theoretical explanation of Web Services, We will explain how to implement Web Services in java in next posts, Keep visiting TutorialsDesk for latest tutorials and practical programming examples on Web Services in java.

Hope we are able to explain you Web Services, if you have any questions or suggestions please write to us using contact us form.(Second Menu from top left).

Please share us on social media if you like the tutorial.