UNIT 5
Introduction to Web Services
Web Services-:
A web service is a set of open protocols and standards that allow data to be exchanged between
different applications or systems. Web services can be used by software programs written in a
variety of programming languages and running on a variety of platforms to exchange data via
computer networks such as the Internet in a similar way to inter-process communication on a
single computer.
Any software, application, or cloud technology that uses standardized web protocols (HTTP or
HTTPS) to connect, interoperate, and exchange data messages – commonly XML (Extensible
Markup Language) – across the internet is considered a web service.
Web services have the advantage of allowing programs developed in different languages to
connect with one another by exchanging data over a web service between clients and servers.
A client invokes a web service by submitting an XML request, which the service responds with
an XML response.
Functions of Web Services
• It’s possible to access it via the internet or intranet networks.
• XML messaging protocol that is standardized.
• Operating system or programming language independent.
• Using the XML standard, it is self-describing.
• A simple location approach can be used to locate it.
• Components of Web Service
• XML and HTTP is the most fundamental web services platform. The following
components are used by all typical web services:
• SOAP (Simple Object Access Protocol)
• SOAP stands for “Simple Object Access Protocol.” It is a transport-independent
messaging protocol. SOAP is built on sending XML data in the form of SOAP
Messages. A document known as an XML document is attached to each message.
Only the structure of the XML document, not the content, follows a pattern. The best
thing about Web services and SOAP is that everything is sent through HTTP, the
standard web protocol.
• A root element known as the element is required in every SOAP document. In an
XML document, the root element is the first element. The “envelope” is separated
into two halves. The header comes first, followed by the body. The routing data, or
information that directs the XML document to which client it should be sent to, is
contained in the header. The real message will be in the body.
• Simple Object Access Protocol. SOAP is easy to read because SOAP based on XML.
SOAP is the XML based format for sending and receiving data.
• WSDL (Web Services Description Language)
• If a web service can’t be found, it can’t be used. The client invoking the web service
should be aware of the location of the web service. Second, the client application must
understand what the web service does in order to invoke the correct web service. The
WSDL, or Web services description language, is used to accomplish this. The WSDL
file is another XML-based file that explains what the web service does to the client
application. The client application will be able to understand where the web service
is located and how to use it by using the WSDL document.
2. REST (Representational State Transfer)-:
RESTful web services are web services that use Representational State Transfer (REST)
principles to communicate with clients and servers. They are built on the HTTP
protocol and use HTTP methods like GET, PUT, POST, and DELETE
RESTful web services work?
• The client initiates an interaction, such as accessing a webpage using a URL
• The REST API acts as a middleman between the client and the server
• The REST API receives resource requests and sends responses using HTTP
GET : Retrieve particular resources by an id
POST : Create a new resource.
PUT : Update a particular resource by an id.
DELETE : Remove a particular resource.
Operational Model of web service-:
Basic Operational Model of Web services: Web services operations can be
conceptualized as a simple operational model that has a lot in common with a
standard communication model . Operations are conceived as involving three
distinct roles and relationships that define the Web services providers and users.
These roles and relationships are defined as follows:
Service provider. The service provider is responsible for developin and
deploying the Web services. The provider also defines the service and publishes
them with the service broker.
Service broker. The service broker (also commonly referred to as service
registry) is responsible for service registration and discover of the Web services.
The broker lists the various service types descriptions, and locations of the
services that help the service requesters find and subscribe to the required
services.
Service requestor. The service requestor is responsible for the service
invocation. The requestor locates the Web service using the service broker,
invokes the required services, and executes it from the service provider.
Tools and Technologies enabling Web services:
Core Web services standards
The five core Web services standards and technologies for building and enabling
Web services are XML, SOAP, WSDL, UDDI, and ebXML.
Extensible Markup Language (XML):
In February 1998, the Worldwide Web Consortium (W3C) officially endorsed
the Extensible Markup Language (XML) as a standard data format. XML uses
Unicode, and it is structured self-describing neutral data that can be stored as a
simple text document for representing complex data and to make it readable.
Today, XML is the de facto standard for structuring data, content, and data
format for electronic documents. It has already been widely accepted as the
universal language lingua franca for exchanging information between
applications, systems, and devices across the Internet. In the core of the Web
services model, XML plays a vital role as the common wire format in all forms
of communication. XML also is the basis for other Web services standards.
Simple Object Access Protocol (SOAP)
Simple Object Access Protocol, or SOAP, is a standard for a lightweight XML-
based messaging protocol. It enables an exchange of information between two
or more peers and enables them to communicate with each other in a
decentralized, distributed application environment. Like XML, SOAP also is
independent of the application object model, language, and running platforms
or devices. SOAP is endorsed by W3C and key industry vendors like Sun
Microsystems, IBM, HP, SAP, Oracle, and Microsoft.
In the core of the Web services model, SOAP is used as the messaging protocol
for transport with binding on top of various Internet protocols such as HTTP,
SMTP, FTP, and so on. SOAP uses XML as the message format, and it uses a
set of encoding rules for representing data as messages. Although SOAP is used
as a messaging protocol in Web services, it also can operate on a
request/response model by exposing the functionality using SOAP/RPC based
on remote procedural calls. SOAP also can be used with J2EE-based application
frameworks.
Web Services Defination Language (WSDL)
The Web Services Definition Language (WSDL) standard is an XML format
1for describing the network services and its access information. It defines a
binding mechanism used to attach a protocol, data format, an abstract message,
or set of endpoints defining the location of services.
In the core of the Web services model, WSDL is used as the metadata language
for defining Web services and describes how service providers and requesters
communicate with one another. WSDL describes the Web services
functionalities offered by the service provider, where the service is located, and
how to access the service. Usually the service provider creates Web services by
generating WSDL from its exposed business applications. A public/private
registry is utilized for storing and publishing the WSDLbased information.
Universal Description, Discovery and Integration (UDDI):
Universal Description, Discovery, and Integration, or UDDI, defines the
standard interfaces and mechanisms for registries intended for publishing and
storing descriptions of network services in terms of XML messages. It is similar
to the yellow pages or a telephone directory where businesses list their products
and services. Web services brokers use UDDI as a standard for registering the
Web service providers. By communicating with the UDDI registries, the service
requestors locate services and then invoke them.
In the core Web services model, UDDI provides the registry for Web services to
function as a service broker enabling the service providers to populate the
registry with service descriptions and service types and the service requestors
to query the registry to find and locate the services. It enables Web applications
to interact with a UDDI-based registry using
!
SOAP messages. These registries can be either private services within an
enterprise or a specific community, or they can be public registries to service
the whole global business community of the Internet. The UDDI working group
includes leading technology vendors like Sun Microsystems, IBM, HP, SAP,
Oracle, and Microsoft.
ebXML:
ebXML defines a global electronic marketplace where enterprises find one
another and conduct business process collaborations and transactions. It also
defines a set of specifications for enterprises to conduct electronic business over
the Internet by establishing a common standard for business process
specifications, business information modeling, business process collaborations,
collaborative partnership profiles, and agreements and messaging.
In the Web services model, ebXML provides a comprehensive framework for
the electronic marketplace and B2B process communication by defining
standards for business processes, partner profile and agreements, registry and
repository services, messaging services, and core components. It complements
and extends with other Web services standards like SOAP, WSDL, and UDDI.
In particular ebXML Business Process Service Specifications (BPSS) enable
business processes to be defined.
■ ebXML CPP/CPA enables business partner profiles and agreements to be
defined, and it provides business transaction choreography.
■ ebXML Messaging Service Handler (MSH) deals with the transport, routing,
and packaging of messages, and it also provides reliability and security, a value
addition over SOAP.
■ ebXML registry defines the registry services, interaction protocols, and
message definitions, and ebXML repository acts as storage for shared
information. The ebXML registries register with other registries as a federation,
which can be discovered through UDDI. This enables UDDI to search for a
business listing point to an ebXML Registry/Repository.
■ ebXML Core components provide a catalogue of business process
components that provide common functionality to the business community.
Examples of such components are Procurement, Payment, Inventory, and so on.
benefits and challenges of using web services-:
Web services offer significant benefits like interoperability, flexibility, and cost-
effectiveness by allowing different applications to communicate and exchange data seamlessly
across platforms, but also present challenges related to security, dependency on internet
connectivity, and potential complexity in managing diverse APIs and standards.
Benefits of using web services:
• Interoperability:
Web services enable applications built on different platforms and technologies to communicate
and exchange data easily, facilitating integration between legacy systems and new applications.
• Flexibility and Reusability:
By providing modular services, developers can easily incorporate functionality from different
web services into their applications, promoting code reuse and rapid development.
• Scalability:
Web services can be scaled up or down based on demand, allowing for efficient resource
allocation and cost optimization.
• Cost-effectiveness:
By utilizing existing infrastructure and standardized technologies, businesses can reduce
development costs and avoid the need to build custom integrations.
• Improved Collaboration:
Web services can connect different systems within an organization, enabling better data sharing
and collaboration between teams.
• Platform Independence:
Web services operate using standard protocols like HTTP and XML, allowing applications to
interact regardless of the underlying operating system or programming language.
• Accessibility:
Web services can be accessed from anywhere with an internet connection, enabling remote
access to data and functionality.
Challenges of using web services:
• Security Concerns:
Protecting sensitive data transmitted over the internet through web services requires robust
authentication and encryption mechanisms to prevent unauthorized access.
• Dependency on Network Connectivity:
Any disruptions in internet connectivity can significantly impact the availability and
functionality of web services.
• Complexity in Management:
Integrating various web services from different providers can be complex due to potential
differences in APIs, data formats, and security protocols.
• Potential Performance Issues:
High volumes of web service requests can lead to performance bottlenecks if not properly
optimized and managed.
• Vendor Lock-in:
Relying heavily on specific web service providers can create vendor lock-in, making it difficult
to switch to alternative solutions.
• Compliance Requirements:
Depending on the industry, adhering to data privacy and regulatory compliance standards when
utilizing web services can be challenging.
Characteristics of web services:
The Web services architecture represents the logical evolution of traditional computer-based
applications to services-oriented applications over the Internet. It defines a distributed
computing mechanism by adopting a service-oriented architecture (SOA), where all of the
applications are encapsulated as services and made available for invocation over a network.
These services can be leveraged from different applications and platforms with varying
technologies adopting common industry standards and platform-independent and
languageneutral Internet protocols for enabling application interoperability, thus making them
easily
accessible over the Internet.
In addition, it provides a mechanism for categorizing and registering the services in a
common location by making them available for discovery and collaboration over the Internet
or corporate networks.
Using Web services architecture and adhering to its standards also exposes existing and
legacy applications as Web services, and the clients invoking these services do not require
that they are aware of their target system environment and its underlying implementation
model.
Building Blocks of web service-:
The core building blocks of a web service are: a service provider (the server hosting the
service), a service consumer (the client application requesting data), a service description
(WSDL - Web Services Description Language) defining the service interface, a messaging
protocol (typically SOAP - Simple Object Access Protocol) for data exchange, and a registry
(like UDDI - Universal Description, Discovery, and Integration) to discover available
services; all communicating over standard internet protocols like HTTP.
Explanation of each building block:
• Service Provider:
The application or system that actually implements the web service functionality, exposing its
operations and data to be accessed by other applications.
• Service Consumer:
The application or system that wants to utilize the web service by sending requests and
receiving responses from the service provider.
• WSDL (Web Services Description Language):
An XML-based document that describes the details of a web service, including its available
operations, parameters, data types, and communication protocols, allowing clients to
understand how to interact with the service.
• SOAP (Simple Object Access Protocol):
A messaging protocol used to exchange data between web services, typically formatted as XML
messages with a standardized structure for sending requests and receiving responses.
• UDDI (Universal Description, Discovery and Integration):
A registry where web services can be registered and discovered by potential clients, allowing
them to find available services on the network.