You are on page 1of 29

WEBSERVICES BUILDING

BLOCKS

N.RAJGANESH
ASSOCIATE PROFESSOR
DEPT OF INFORMATION TECHNOLOGY
A.V.C COLLEGE OF ENGINEERING
WEB SERVICE
• A Web Service is a class that allows its methods
to be called by methods on other machines via
common data formats and protocols, such as XML
and HTTP.

• The Web Service architecture is a Service Oriented


Architecture (SOA) that enables applications to be
distributed across a network or the internet to
clients using any language or operating system.
DATA

SOAP / XML

HTTP

TCP / IP

Figure 1 . Web Service Transport


TCP / IP (Transmission Control Protocol / Internet Protocol)
It is a communication protocol suite that forms the basis of the internet. It is an open
system that governs the flow of data between computers.

HTTP (Hypertext Transfer Protocol)


It is a Remote Procedure Call (RPC) protocol that supports request / response
communication. It has two methods called
HTTP POST and HTTP GET for Web Service accessing. The difference of POST with GET
method is the post package the request inside the request body (a SOAP envelope)
rather as part of a less secure query string.

XML (Extended Markup Language)


The XML features such as flexibility, extensibility, and validity checking make it attractive
to web services. The XML has two protocols for delivering Web Services. They are, XML
RPC and SOAP.

SOAP (Simple Object Access Protocol)


It is a light weight protocol for exchange of information in a decentralized, distributed
environment. Its specification define a model for invoking methods on a specified target
machine, passing parameters, handling, faults and receiving a method response.
SERVICE ORIENTED ARCHITECTURE(SOA)
• SOA is intended to define loosely coupled and
interoperable services/ applications, and to define a
process for integrating these interoperable
components.
Service
Description Registry

Services

Service Consumer Service Producer


Service
Description
XML
Message Figure 2. SOA Interaction
SIMPLE OBJECT ACCESS PROTOCOL(SOAP)
• The Simple Object Access Protocol (SOAP) is a
platform independent protocol that uses XML
to make remote procedure calls.
• Each Request and Response is packaged in a
SOAP message – an XML message containing
the information that a web service requires to
process the message.
• SOAP is most popular and flexible protocol for
the exchange of information between Web
Service consumers and provides.
 SOAP stands for Simple Object Access Protocol.
SOAP is a Communication Protocol.
SOAP is for communication between Application.
SOAP is a format for Sending Messages.
SOAP is designed to Communicate via Internet.
SOAP is Platform Independent.
SOAP is a Language Independent.
SOAP is based on XML.
SOAP is Simple and Extensible.
SIMPLE OBJECT ACCESS PROTOCOL(SOAP)
COMPONENTS
• An Envelope Framework for
describing message structure.
• A Set of Encoding rules for
expressing instances of application
defined data type.
• A convention for representing
Remote Procedure Calls(RPC) and
responses.
• A set of rules for using SOAP with
Figure 3. SOAP Message Format
HTTP.
• Message Exchange Patterns(MEP)
such as Request-Response, One way
and Peer to Peer conversations.
SOAP REQUEST MESSAGE

POST /WebSite7/Addition.asmx HTTP/1.1


Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: http://tempuri.org/Addition
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Addition xmlns="http://tempuri.org/">
<no1>int</no1>
<no2>int</no2>
</Addition>
</soap:Body></soap:Envelope>
The SOAP request is packaged as an HTTP POST request to the
server designated by the Host Field.
The Length field specifies the number of characters in the body of
the POST.
SOAPAction indicates the namespace and method to be contacted.

 The SOAP message contains a root element, < envelope >, an


optional < Header > element and a < Body >.

 SOAP envelope is conceptually a container for the message.


 SOAP header represents a way to extend the basic message.
 SOAP body contains the actual data.

Here the body contains the name of the method and two
parameters that correspond to the call made with in the client
code.
SOAP RESPONSE MESSAGE
• The SOAP body of the response includes a
< Addition Result > element that contains the
response from the Web Service and identifies it as a
string type.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AdditionResponse xmlns="http://tempuri.org/">
<AdditionResult>int</AdditionResult>
</AdditionResponse>
</soap:Body>
</soap:Envelope>
SOAP EXCEPTIONS
SOAP Exceptions
There is one class called SOAPException is used for exceptions handling here. It includes
four properties that provide information about the exception.
Message - The error message for the exception.
Actor - The URL of the WebService that throw the exception.
Code - An XMLQualifiedName object that specifies one of
four SOAP fault codes that categorize the exception.
Detail - It contains information about the error.

The SOAP Exception class contains static fields that can be compared with the code value
to broadly classify the exception. These field has the following.

VersionMismatchFaultCode -For invalid namespace.

ServerFaultCode - The errors occurs on the server and is not related to the SOAP
message.

MustUnderstandFaultCode-If it is set to true then the SOAP element is not


processed.
SOAP SECURITY
SOAP Security
• The security is achieved with the Web Service Security (WS – Security)
specification. It is used to ensure the following.

Authentication -Provide integration points for multiple


authentication mechanisms and the means
for conveying the specific mechanism for
authentication operation.

Integrity -Provide mechanism to detect the


Unauthorized changes to messages.

Confidentiality -Protect the confidentiality of the underlying


communication mechanism.
SOAP TRANSACTIONS
Atomicity :The set of messages in a transaction
either all take place or none take place.
Consistency: Transactions always operate on a
consistent view of the data and always leave
the data in a consistent state when a
transaction is complete.
Isolation : Transactions are not able to interfere
with each other.
Durability : Retain the states even any one
system go down(After the Commit)
WSDL
• WSDL stands for Web Services Description
Language.
• WSDL is written in XML.
• WSDL is an XML Document.
• WSDL is used to describe WebServices.
• WSDL is also used to locate WebServices.
• WSDL is not yet a W3C standard
• XML format for describing network services.
SERVICE DESCRIPTION FOR WEBSERVICE
Google Service
My Search Service Description
Description
provides

Google
Search

My Search News Service


Requester uses
Service Description
interact

News
Service
Figure 4. Service Description
WSDL STRUCTURE
WSDL document can be divided into:
Abstract Definitions –
 Defines the SOAP messages in a platform
independent language and a neutral manner.
It help to extend service definitions and
enhance the reusability.
Agreed upon Definitions - It enables multiple
protocol bindings such as HTTP and SMTP.
WSDL 1.1

Figure 5. WSDL Structure


ELEMENTS OF WSDL
< Definitions >
• It is the root element of the WSDL document.
• Used to declare multiple namespaces used in the
Document, and contains all of the other elements.
< Types >
• It contains an XSD (XML Schema Definitions Language)
schema that describes the data types publicly exposed
by the service. ie the parameters passed in the web
service request and the response.
< Message >
• It defines the data that is exchanged between the
Web Service provider and consumer.
• The message has its unique name and defines its
parameters.
< PortType >
• It defines the <Message> elements that belong to a
communications transport.
• The name attribute specifies the name for the transport.
• The <PortType> elements contains < Operation > elements that
corresponds to the methods in the web service.
• The <Input > and < Output > elements define the message
associated with the operation.
• It supports four types of operations
 One – Way -Service receives a message.
 Request – response -Client sends a request.
 Solicit – response -Service sends a message to the Client.
 Notification -Service sends a message to the Cient.
< Binding >
• A set of rules that describe how the < PortType >
operation is transmitted over the wire.
• The wire protocols HTTP GET, HTTP POST, SOAP
are used.
• The < Operation > element specifies the entry
point for the web method that is called on the
server.
• Style attribute may be a document or rpc.
< Service >
• Used to identify the location of the WebService.
• It lists the name of the WebService class, the
URL and references the binding for this end
point.
DISCOVERY OF WEBSERVICE AND USAGE
1. The Web Services Discovery Tool (Disco.exe)
 A technology used for Publishing and Discovery of Web Services.
 It discovers URL of all web services located on a web server and
creates a list of the web services in a file, called the Disco file.
2. UDDI
 A centralized directory where the web services offered by
different organizations are published.
 An UDDI discovery has an advantage over a Disco file in that the
directory provides a single location where clients can search the
Web Services offered by different organizations.
UDDI
• UDDI – Universal Description Discovery and
Integration.
• This standard defines a SOAP based interface
that can be used to publish a service or
inquire about services in a UDDI compliant
registry.
• It contains information about a company, its
services and interface specifications for any
web services it offers.
UDDI - INQUIRY PROCESS
• Send Discovery Query.
• Receive list of matching services.
• Retrieve WSDL for web service.
• Send SOAP query to web service.

Figure 6. Discovering and Accessing a WebService


The communication between the client and UDDI
registry server is based on SOAP messages.

UDDI uses World Wide Web Construction


(W3C) and Internet Engineering Task Force
(IETF) internet standards such as XML, HTTP,
DNS.
 UDDI uses WSDL to describe interfaces to web
services.
UDDI - INFORMATION
• White Pages :
• Provide Listings of Companies.(Name,Text,Contact
Details)
• Yellow Pages :
• Kind of Services.(Industry code, location and products)
• Green Pages:
• How to interact with companies websevices.(Service
Description)

You might also like