06 Web Services
06 Web Services
Definition
• W3C (World Wide Web Consortium) describes
web service as:
– a system of software allowing different machines to
interact with each other through network.
• A Web service is a web application that can
communicate with other web-based applications
over a network.
• Web services achieve this task with the help of
XML, SOAP, WSDL and UDDI open standards
Basics
• XML
– The full form of XML is ‘Extensible Markup Language’ which is used to share data
on the web and in universal format.
• SOAP
– Standing for ‘Simple Object Access Protocol’ which is an application communication
protocol that sends and receives messages through XML format. It is one of the
best ways to communicate between applications over HTTP which is supported by
all browsers and servers.
• WSDL
– Written in XML, WSDL stands for Web Services Description Language and is used to
describe web service. WSDL comprises three parts such as Definitions (usually
expressed in XML including both data type definitions), Operations and Service
bindings. Operations denote actions for the messages supported by a Web service.
• UDDI
– Universal Description, Discovery, and Integration is an XML-based registry for
businesses worldwide to list themselves on the Internet, and a mechanism to
register and locate web service applications.
Features of web services
• As web services are based on open standards like XML,
HTTP so these are operating system independent.
• Likewise, web services are programming language
independent, a ASP.Net application can consume a
PHP web service.
• Web services can be published over the internet to be
consumed by other web applications.
• The consumer of web service is loosely coupled with
the web service, so the web service can update or
change their underlying logic without affecting the
consumer
Types of Web Services
1. SOAP Web Service
2. RESTful Web services or REST API
SOAP Web Service
• SOAP stands for Simple Object Access Protocol.
• SOAP is an XML-based protocol for accessing web
services over HTTP.
• It has some specification which must be used
across all applications for message exchange.
• The message format supported by SOAP is XML.
• A web service that is based on SOAP protocol is
called SOAP web service.
• It follows service oriented architecture.
SOAP Web Service
• For example, to access a employee information,
we need to make http call to say
http://yoursite.com/customers.asmx
• SOAP requires more bandwidth for its usage
compared to REST. Since SOAP Messages contain
a lot of information inside of it, the amount of
data transfer using SOAP is generally a lot.
• SOAP can only work with XML format.
RESTful Web services or REST API
• REST stands for Representational State Transfer.
• It is an architectural concept for building
interoperable light weight web services which
helps to access and manipulate the web resources
identified though URI (Uniform Resource
Identifier).
• It follows resource oriented architecture.
• For example: http://yoursite.com/employee/1 to
access the employee information with id 1.
RESTful Web services or REST API
• REST does not need much bandwidth when
requests are sent to the server. REST messages
mostly just consist of JSON messages.
• REST permits different data format such as Plain
text, HTML, XML, JSON, etc. But the most
preferred format for transferring data is JSON.
• ASP.NET Web API is a Microsoft framework which
helps you to build REST based interfaces.
Web Service vs. Website
Web Service Website
A web service doesn’t have a user interface. A website has a user interface or GUI.
E.g. Google maps API is a web service that E.g. ArtOfTesting.com is a website that has a
can be used by websites to display Maps by collection of related web pages containing
passing coordinates to it. tutorials.