Web services concepts, protocols and development

8

Click here to load reader

description

Web services concepts, protocols and development

Transcript of Web services concepts, protocols and development

Page 1: Web services concepts, protocols and development

1 Mehta Ishani

2nd M.E.(CSE)

Web Services: Concepts, Protocols and

development

What is a web service?

They are pieces of business logic that can be accessed over the

Internet.

A Web Service is an application component accessible over open

protocols

Web services communicate using standards-based Web technologies

including HTTP and XML-based messaging.

Web services are self-contained and self-describing

Once deployed Web services can be used by other applications

Examples:-e-commerce, Google, Amazon and eBay are providing web

services

Standard definition

• IBM

– “A Web service is an interface that describes a collection of

operations that are network accessible through standardized XML

messaging”

• Microsoft: XML Web Services

– “.. expose useful functionality to Web users through a standard

Web protocol”

– “.. provide a way to describe their interfaces in enough detail

to allow a user to build a client application to talk to them”

– “.. are registered so that potential users can find them easily”

History

Structured programming

Object-oriented programming

Service oriented programming

Hewlett-Packard's e-Speak in 1999 was an enabler for e-services.

Microsoft introduced the name "web services" in June 2000

Page 2: Web services concepts, protocols and development

2 Mehta Ishani

2nd M.E.(CSE)

Why web services

Web services provide several technological and business

benefits, a few of which include:

Application and data integration

WS provides inherent interoperability with using vendor,

platform, and language independent XML technologies and the

ubiquitous HTTP as a transport mean so that any application

can communicate with any other application using Web

services.

The client only requires the WSDL definition to effectively

exchange data with the service – and neither part needs to

know how the other is implemented or in what format its

underlying data is stored. These benefits allow

organizations to integrate disparate applications and data

formats with relative ease.

Versatility

Web services are also versatile by design. They can be

accessed by humans via a Web-based client interface, or

they can be accessed by other applications and other Web

services.

A client can even combine data from multiple Web services

to, for instance, present a user with an application to

update sales, shipping, and ERP systems from one unified

interface – even if the systems themselves are

incompatible. Because the systems exchange information via

Web services, a change to the sales database, for example,

will not affect the service itself.

Code re-use

Code re-use is another positive side-effect of Web

services' interoperability and flexibility. One service

might be utilized by several clients, all of which employ

the operations provided to fulfill different business

objectives. Instead of having to create a custom service

for each unique requirement, portions of a service are

simply re-used as necessary.

Page 3: Web services concepts, protocols and development

3 Mehta Ishani

2nd M.E.(CSE)

Cost savings

Easy interoperability means the need to create highly

customized applications for integrating data, which can be

expensive, is removed.

Existing investments in systems development and

infrastructure can be utilized easily and combined to add

additional value.

Since Web services are based on open standards their cost

is low and the associated learning curve is smaller than

that of many proprietary solutions.

Finally, Web services take advantage of ubiquitous

protocols and the Web infrastructure that already exists in

every organization, so they require little if any

additional technology investment.

How does it Work?

The basic Web services platform is XML + HTTP.

The HTTP protocol is the most used Internet protocol.

XML provides a language which can be used between different

platforms and programming languages and still express complex

messages and functions.

Web services platform elements

SOAP (Simple Object Access Protocol)

UDDI (Universal Description, Discovery and Integration)

WSDL (Web Services Description Language)

Web Services Model

Page 4: Web services concepts, protocols and development

4 Mehta Ishani

2nd M.E.(CSE)

Web Services Stack

What is UDDI?

UDDI is a directory service where businesses can register and

search for Web services.

UDDI stands for Universal Description, Discovery and Integration

UDDI is a directory for storing information about web services

UDDI is a directory of web service interfaces described by WSDL

UDDI communicates via SOAP

UDDI is built into the Microsoft .NET platform

UDDI is a standard sponsored by OASIS (Organization for the

Advancement of Structured Information Standards)

UDDI uses World Wide Web Consortium (W3C) and Internet

Engineering Task Force (IETF) Internet standards such as XML,

HTTP, and DNS protocols.

UDDI provides businesses a uniform way of listing their services

and discovering services offered by other organizations.

Page 5: Web services concepts, protocols and development

5 Mehta Ishani

2nd M.E.(CSE)

Registering a Web service in a UDDI registry is an optional

step, and UDDI registries can be public or private (i.e.

isolated behind a corporate firewall).

To search for a Web service, a developer can query a UDDI

registry to obtain the WSDL for the service he/she wishes to

utilize.

How can UDDI be Used

If the industry published an UDDI standard for flight rate

checking and reservation, airlines could register their services

into an UDDI directory. Travel agencies could then search the

UDDI directory to find the airline's reservation interface. When

the interface is found, the travel agency can communicate with

the service immediately because it uses a well-defined

reservation interface.

Who is Supporting UDDI?

UDDI is a cross-industry effort driven by all major platform and

software providers like Dell, Fujitsu, HP, Hitachi, IBM, Intel,

Microsoft, Oracle, SAP, and Sun, as well as a large community of

marketplace operators, and e-business leaders.

Over 220 companies are members of the UDDI community.

What is WSDL?

WSDL is an XML-based language for describing Web services and

how to access them.

WSDL stands for Web Services Description Language

WSDL is written in XML

WSDL is also used to locate Web services

WSDL describes a web service, along with the message format and

protocol details for the web service.

WSDL is maintained by the W3C.

Through the WSDL, a Web services client learns where a service

can be accessed, what operations the service performs, the

communication protocols the service supports, and the correct

format for sending messages to the service.

Page 6: Web services concepts, protocols and development

6 Mehta Ishani

2nd M.E.(CSE)

Six main elements:

Port type – groups and describes the operations performed by the

service through the defined interface.

Port – specifies an address for a binding, i.e., defines a

communication port.

Message – describes the names and format of the messages

supported by the service.

Types – defines the data types (as defined in an XML Schema)

used by the service for sending messages between the client and

server.

Binding – defines the communication protocols supported by the

operations provided by the service.

Service – specifies the address (URL) for accessing the service.

The WSDL document that describes a Web service acts as a

contract between Web service client and server.

By adhering to this contact the service provider and consumer

are able to exchange data in a standard way, regardless of the

underlying platforms and applications on which they are

operating.

What is SOAP?

The basic Web services platform is XML plus HTTP.

SOAP stands for Simple Object Access Protocol

SOAP is platform independent and language independent

SOAP is simple and extensible

SOAP allows you to get around firewalls

SOAP will be developed as a W3C standard

SOAP is a simple XML-based protocol that allows applications

to exchange information over HTTP.

SOAP is a protocol for accessing a web service.

Page 7: Web services concepts, protocols and development

7 Mehta Ishani

2nd M.E.(CSE)

Why SOAP?

It is important for application development to allow Internet

communication between programs.

Today's applications communicate using Remote Procedure Calls

(RPC) between objects like DCOM and CORBA, but HTTP was not

designed for this. RPC represents a compatibility and security

problem; firewalls and proxy servers will normally block this

kind of traffic.

A better way to communicate between applications is over HTTP,

because HTTP is supported by all Internet browsers and servers.

SOAP was created to accomplish this.

SOAP provides a way to communicate between applications running

on different operating systems, with different technologies and

programming languages.

Major elements:

Envelope – specifies that the XML document is a SOAP message;

encloses the message itself.

Header (optional) – contains information relevant to the

message, e.g., the date the message was sent, authentication

data, etc.

Body – includes the message payload.

Fault (optional) – carries information about a client or server

error within a SOAP message.

Data is sent between the client(s) and the Web service using

request and response SOAP messages, the format for which is

specified in the WSDL definition. Because the client and server

adhere to the WSDL contract when creating SOAP messages, the

messages are guaranteed to be compatible.

All the elements above are declared in the default namespace for

the SOAP envelope:

http://www.w3.org/2001/12/soap-envelope

and the default namespace for SOAP encoding and data types is:

http://www.w3.org/2001/12/soap-encoding

Syntax Rules

Page 8: Web services concepts, protocols and development

8 Mehta Ishani

2nd M.E.(CSE)

Here are some important syntax rules:

A SOAP message MUST be encoded using XML

A SOAP message MUST use the SOAP Envelope namespace

A SOAP message MUST use the SOAP Encoding namespace

A SOAP message must NOT contain a DTD reference

A SOAP message must NOT contain XML Processing Instructions

SOAP HTTP Binding

A SOAP method is an HTTP request/response that complies with the

SOAP encoding rules.

HTTP + XML = SOAP

A SOAP request could be an HTTP POST or an HTTP GET request.

The HTTP POST request specifies at least two HTTP headers:

Content-Type and Content-Length.

Content-Type

The Content-Type header for a SOAP request and response defines

the MIME type for the message and the character encoding

(optional) used for the XML body of the request or response.

Content-Length

The Content-Length header for a SOAP request and response

specifies the number of bytes in the body of the request or

response.