WEB SERVICES. word wide web (www ). In the past years the www had a very large success basically for two reasons: - Simplicity Ubiquity For a service provider is simple to contact a great number of users. . For a user is simple to access a service everywhere it is located.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
- the user, using a browser, sends a URL to a server.
- the web server returns a HTML page that is graphically displayed by the browser.
Every resource accessible over the web has a URL that identifies the location of the resource
( a file if the resource is a document or a program if the resource is a program that will produce the document) and describes how to access it.
The URL provides the name of a protocol to be used to access the resource, an address (which can be a domain name or an IP address) of a machine where the resource is located and a hierarchical description of the location of the resource on the machine (directory path)
- HTTP as application protocol in order to reuse the previous infrastructure and to maintain the interaction model simplicity.
-XML as a tool able to better describe the foundamental elements of the interaction, the requestand the response.
web service definition
“A WS is a software application described by a URI whose public interfaces and relative bindings are defined and described in XML. Its definition may be used by different software applications.
These applications can interact with the WS following the directives present in the service definition, using XML messages and internet transport protocols. “
(“Web Services Architecture”
A web service is defined as:
a standardized way of integrating Web-based applications using XML, SOAP, WSDL and UDDI open standards over an Internet backbone:
XML is used to tag the data, SOAP is used to transfer the data,
WSDL is used for describing the service available,
UDDI is used for listing what services are available.
Not every service available through the web is a web service.
Examples: bookstores, restaurants or travel agencies. They all provide services. In some cases a customer might even to obtain such services through the web servers of the company.
This is not what web services are about. A web service is a software application with a published stable programming interface , not a set of web pages.
Each part (customer,supplier,warehouse) exposes its internal operations as web services, which therefore acts as entry points to the local information systems.
The interactions between companies occur in peer-to-peerfashion and take place through standardized protocols.
Web services and their technology are being developed with one specific use in mind: that of being entry points to the local information systems.
The primary use of web services is that of exposing the functionalty performed by internal systems and making it discoverable and accessible through the web in a controlled manner
It is the service owner. From the architectural point of view it represents the node containinig the service.
It is the application which is calling the service . A service consumer may be a browser or an application (ex., another web service)
It is a register which contains the descriptions of the services published because the request of a producer and requested by the service consumers.
The web services are web applicationsthat provide services to others web applications
Web Services have Two Types of Use
There are applications needed very often. So why make these over and over again?
Web services can offer application-components like: currency conversion, weather reports, or even language translation as services.
Web services can help to solve the interoperability problem by giving different applications a way to link their data.
With Web services you can exchange data between different applications and different platforms.
Trough WSDL the public interface of a web service (based on XML) can be described
A WSDL document contains, relatively to the described web service, informations on:
The WSDL Document Structure
A WSDL document describes a web service using these major elements:
<types>A container for data type definitions used by the web service
<message>A typed definition of the data being communicated
<portType> A set of operations supported by one or more endpoints
<binding>A protocol and data format specification for a particular port type
The<portType> element is the most important WSDL element.
The <portType> element can be compared to a function library (or a module, or a class) in a traditional programming language.
The<message> element defines the data elements of an operation.
Each message can consist of one or more parts. The parts can be compared to the parameters of a function call in a traditional programming language.
The<types> element defines the data types that are used by the web service. For maximum platform neutrality, WSDL uses XML syntax to define data types.
The<binding> element defines the data format and protocol for each port type.
The main structure of a WSDL document looks like this:
<definitions><types> data type definitions........</types><message> definition of the data being communicated....</message><portType> set of operations......</portType><binding>
protocol and data format specification....</binding></definitions>
A WSDL document can also contain other elements, like extension elements, and a service element that makes it possible to group together the definitions of several web services in one single WSDL document.
<messagename="getTermRequest"> <part name="term" type="xs:string"/></message><messagename="getTermResponse"> <part name="value" type="xs:string"/></message><portTypename="glossaryTerms"> <operationname="getTerm"> <input message="getTermRequest"/> <output message="getTermResponse"/> </operation></portType>
Compared to traditional programming, glossaryTerms is a function library, "getTerm" is a function with "getTermRequest" as the input parameter, and getTermResponse as the return parameter.
WSDL binding and service
<binding type="glossaryTerms" name="b1"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <operation> <soap:operation soapAction="http://example.com/getTerm"/> <input><soap:body use="literal"/></input> <output><soap:body use="literal"/></output> </operation></binding>
The last part of the document describes the service and its web address.
<port name=“glossary service“
<soap:address location="http://www.glossary service.com"/>
SOAP Building Blocks
A SOAP message is an ordinary XML document containing
the following elements:
All the elements above are declared in the default namespace for the SOAP envelope:
and the default namespace for SOAP encoding and data types is:
Skeleton SOAP Message
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Header>...</soap:Header><soap:Body>... <soap:Fault> ... </soap:Fault></soap:Body></soap:Envelope>
<? xml version="1.0"?>
The SOAP Envelope Element
The SOAP Header Element
The SOAP Body Element
The required SOAP Body element contains the actual SOAP messages intended for the ultimate endpoint of the message.
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Body> <m:GetPrice xmlns:m="http://www.w3schools.com/prices"> <m:Item>Apples</m:Item> </m:GetPrice></soap:Body></soap:Envelope>
A SOAP response could look something like this:
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Body> <m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices"> <m:Price>1.90</m:Price> </m:GetPriceResponse></soap:Body></soap:Envelope>
WSDL stands for Web services description language
WSDL is a XML-based language for describing Web services
Wsdl is a W3C recomandation
Soap stands for Simple Object Access Protocol
Soap is an XML based protocol for accessing web services
Soap is a W3C recomandation
UDDI stands for Universal Description, Discovery and Integration
UDDI is a directory service where companies can search for Web services
UDDI described in XML
UDDI communicates via SOAP