Web Services

Post on 27-Jun-2015

129 views 0 download

Tags:

transcript

WEB SERVICESAn Overview

Presented by: Muhammad Bin Saleh AL-Qurishi

King Saud University

204/13/2023

Agenda Introduction

Basic ConceptPreliminaries (Integration and Middleware)

Web ServiceWhy Web ServiceWhat is Web Service

Web Service Technologies The Web, XML, SOA

StandardsSOAPWSDLUDDI

References Presentation of Web Services By-Muhammad AL-Qurishi

304/13/2023

Introduction

Presentation of Web Services By-Muhammad AL-Qurishi

404/13/2023

Basic Concept

Presentation of Web Services By-Muhammad AL-Qurishi

“ Today, the principal use of the World Wide Web is for interactive access to documents and applications. In almost all cases, such access is by human users, typically working through web browsers… The Web can grow significantly in power and scope if it is extended to support communication between applications, from one program to another. “

- From the W3C XML Protocol Working Group Charter

504/13/2023

Human-Centric

Presentation of Web Services By-Muhammad AL-Qurishi

Humans are the primary actors initiating web requests

This is the primary model on which most of the web operates today.

604/13/2023

Application-Centric

Presentation of Web Services By-Muhammad AL-Qurishi

We need to move from a human-centric to an application-centric.

We need to make conversations between applications occur as

easily as conversations between web browsers and servers.

704/13/2023

Preliminaries Application Integration

The mechanism that enables different software systems to share, and use information

Two basic categories: data-level integration and

share information simply by sharing their databases less costly and less invasive

application-level integration Takes more time and effort Having heterogeneous systems makes integration

hard Presentation of Web Services By-Muhammad AL-Qurishi

804/13/2023

Preliminaries cont.

Application Programming Interface (API) Mechanism that enables an application to exposes its

capabilities to other applications. Supports application-to-application communication Application Adapter

A program that provides an interface to a legacy application.

Presentation of Web Services By-Muhammad AL-Qurishi

904/13/2023

Preliminaries cont. Middleware

A software package that sits between your application code and its underlying platform,

Providing easy access to core system facilities such as the network, storage, and processors.

Presentation of Web Services By-Muhammad AL-Qurishi

1004/13/2023

Preliminaries cont. Middleware

There are many kinds of communication middleware. Such as RPC, DCOM, CORBA, RMI, and MOM. Each type of communication middleware communicates in its

own way! There are two fundamental styles of communication

Passing Messages an asynchronous, peer-based style of communication

(MOM) Invoking Functions

a synchronous, client/server-based style of communication(RPC)

Presentation of Web Services By-Muhammad AL-Qurishi

1104/13/2023 Presentation of Web Services By-Muhammad AL-Qurishi

Many Shortcomings in Traditional Middleware leads us to the need of Web Services

1204/13/2023

Why Web Services?

Presentation of Web Services By-Muhammad AL-Qurishi

Issues Traditional Middleware Web Services

Heterogeneity It's hard to find a single middleware package that supports all your languages and platforms

Provide a common, platform-independent language that simplifies heterogeneous application integration.

The Internet Messages frequently blocked by firewall. Applications can communicate over the Internet. (using XML)

Pervasiveness Many middleware packages require a deployment license for every system that uses them

Web services communicate using the World Wide Web

Usability fairly hard to use, require experienced developers with both domain knowledge and middleware experience

easier to use. You can expect to find a large supply of talent at a reasonable price

Cost Heavy costs come from development and maintenance. Generally requires high-priced expertise

software is that it is much less expensive than most other middleware

Maintenance Hundreds of APIs to maintain without adequate documentation

Application adapters are cheaper and easier to maintain.

1304/13/2023

What is “Web” “Service” ?

Presentation of Web Services By-Muhammad AL-Qurishi

Web Service

Service

The Web

An Immensely scalable information space filled with interconnected resources.

Pervasive and provides universal connectivity

A resource that is designed to be consumed by software rather than by

humans

Possesses the characteristics of both a Web resource and a

service

1404/13/2023

Web Service

Presentation of Web Services By-Muhammad AL-Qurishi

Is available over the

Internet or private

(intranet) networks

Is a Web resource. Can be accessed

by Web protocols,

such as HTTP

Is not tied to any one

operating system or

programming language

Uses a standardized

XML messaging

system

Web service applications are encapsulated, loosely coupled Web “components” that can bind dynamically to each otherWeb services use the Web to perform application-to-application integration

Registered Easy Integration Loosely Coupled Standardized

1504/13/2023

Web Services Scope

Presentation of Web Services By-Muhammad AL-Qurishi

Layer4 •Web services application templates•ERP, EAI, B2B, Portal, etc.

Layer3 •Web Services•Sales quote, Order tracking, Weather Report, etc .

Layer2 •Web services infrastructure•Tools and Frameworks, Servers, etc.

Layer1 •Web services technologies•XML, SOAP, WSDL, UDDI, etc.

1604/13/2023 Presentation of Web Services By-Muhammad AL-Qurishi

Web Services Technologies

1704/13/2023

Basic Web Service

Presentation of Web Services By-Muhammad AL-Qurishi

How does it work?

1804/13/2023

3Core Technologies

Presentation of Web Services By-Muhammad AL-Qurishi

XML

SOA

The Web

1904/13/2023

The Web Technology The Web

Offers universal connectivity Relies on the internet Consists of resources and links Uniform Resource Identifier(URI)

URI is a compact, formatted name that identifies a resource Uses to identify, reference, access, and share a Web

resource Takes many forms

Uniform Resource Name (URN) Uniform Resource Locator (URL)

Presentation of Web Services By-Muhammad AL-Qurishi

2004/13/2023

Web Technology examples.

Internet Application Internet ProtocolWeb browsing Hypertext Transfer Protocol (HTTP)

E-mail Simple Mail Transfer Protocol (SMTP)

File transfer File Transfer Protocol (FTP)

Presentation of Web Services By-Muhammad AL-Qurishi

URI Scheme (Boldface) Resourcehttp://www.bowlight.net/index.html A Web page

mailto:atm@bowlight.net An e-mail mailbox

ftp://ftp.bowlight.net/atmbio.pdf A file

Three URI Schemes

Web Application Protocols

2104/13/2023

XML Technology Different programming languages use the same

data format: XML. XML is the secret sauce that gives Web services

their power and flexibility. Basic Web services platform is XML + HTTP But, What Is XML?!

Presentation of Web Services By-Muhammad AL-Qurishi

2204/13/2023

What Is XML?

A language for electronic documents.

A structured way to represent information

An XML document is a hierarchy of XML elements. • An element

represents a distinct piece of information in the document

Two Main XML Keywords:

Extensible: can be extended to lots of

different applications.Markup language: Language used to

mark up or annotate data

Presentation of Web Services By-Muhammad AL-Qurishi

2304/13/2023

XML vs. HTML

Presentation of Web Services By-Muhammad AL-Qurishi

The best way to understand

XML is to contrast it

with HTML.

XML is Extensi

ble:

HTML: used to create web

pages; restricted set of

tags, e.g. <I> Italics, <B> Bold, etc.

XML: you can create your own

tags

Example: Put a library catalog on

the web.

HTML: You are stuck with regular HTML tags that

describe formatting.

TITLE, AUTHOR, DATE, PUBLISHER, etc.

2404/13/2023

XML vs. HTML cont.

HTML Code (Book Catalog)

Presentation of Web Services By-Muhammad AL-Qurishi

<HTML><BODY><H1>XML in a Nutshell</H1><H2>Elliot Harold Rusty</H2><I>O’Reilly & Associates,</I><B>2002</B></BODY></HTML>

2504/13/2023

XML vs. HTML cont.

XML Code (Book Catalog)

Presentation of Web Services By-Muhammad AL-Qurishi

<BOOK><TITLE> XML in a Nutshell</TITLE><AUTHOR> Elliot Harold Rusty </AUTHOR><DATE>2002</DATE><PUBLISHER>O’Reilly & Associates</PUBLISHER></BOOK>

2604/13/2023

XML vs. HTML cont.

Tag Sets: HTML has a predefined set of tags

XML lets you create your own tags.

General Purposes: HTML focuses on "look and feel”

XML focuses on the structure of the data.

XML is not meant to be a replacement for HTML. In fact, they are usually used together.

Presentation of Web Services By-Muhammad AL-Qurishi

2704/13/2023

SOA Technology SOA stands for “Service-Oriented Architecture” Describes a set of well-established patterns

Help a client application connect to a service Describe a service (Service Contract) Advertise and discover a service (Service Broker) Communicate with a service (Service Protocol) Web services rely on these SOA patterns

SOA has 3 artifacts: Service contract, Service, Client

3 Operations : Find, Bind, Register

Presentation of Web Services By-Muhammad AL-Qurishi

2804/13/2023

SOA Technology (3 Basic Roles)

Service Broker

Service Provider

Service Client Service

Consumer

Presentation of Web Services By-Muhammad AL-Qurishi

Find

Bind

Register

Service Contract

So, how to implement these Patterns?

2904/13/2023

Standard Technologies

The standard technologies for implementing the SOA patterns with Web services areSOAP (Simple Object Access Protocol)WSDL (Web Services Description Language)UDDI (Universal Description, Discovery &

Integration)

Presentation of Web Services By-Muhammad AL-Qurishi

3004/13/2023

Standard Technologies cont.

UDDI

Service Provider

Service Client Service

Consumer

Presentation of Web Services By-Muhammad AL-Qurishi

Find

Bind

Register

WSDL

SOAP

3104/13/2023

SOAP XML-based protocol

Uses to exchange information between computers Enables client applications to easily connect to remote services

To invoke remote methods A format for sending messages Designed to communicate via Internet (over HTTP, SMTP,

FTP) Platform and language independent Simple and extensible Allows you to get around firewalls Being standardized by W3C

Presentation of Web Services By-Muhammad AL-Qurishi

3204/13/2023

The SOAP Specification

•The root element in a SOAP message•The SOAP message container

SOAP envelope specification

•SOAP encoding system•Based on the W3C XML Schema

specification

Data encoding rules

•Structure SOAP messages to simulate an RPC invocation

RPC conventions

Presentation of Web Services By-Muhammad AL-Qurishi

3304/13/2023

SOAP Message Format

Presentation of Web Services By-Muhammad AL-Qurishi

SOAP message carried by Transport Packet for example HTTP:

POST /Accounts/Henrik HTTP/1.1Host: www.webservicebank.comContent-Length: nnnnContent-Type: text/xml; charset="utf-8"SOAPAction: "Some-URI"

SOAP Envelop (Required)

SOAP Header (Optional)

SOAP Body (Required)

SOAP Fault (Optional)

3404/13/2023

SOAP Message (Required Tags)

Presentation of Web Services By-Muhammad AL-Qurishi

Envelop Tag A SOAP message is defined as beginning with the tag

<SOAP-ENV:Envelope> And ending with the tag

</SOAP-ENV:Envelope> In SOAP 1.1, the SOAP_ENV:Envelope tag is normally constructed using the

following syntax: <SOAP-ENV:Envelope xmlns:SOAP ENV=”http://schemas.xmlsoap.org/soap/envelope/” >

Body Tag The body of the SOAP message begins with the tag

<SOAP-ENV:Body> And ending with the tag

</SOAP-ENV:Body>

3504/13/2023

Weather Service Example

Presentation of Web Services By-Muhammad AL-Qurishi

Listing current temperature by zip code

3604/13/2023

SOAP Request (weather service)

Presentation of Web Services By-Muhammad AL-Qurishi

<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope

xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope/"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<SOAP-ENV:Body> <ns1:getWeather xmlns:ns1="urn:examples:weatherservice"

SOAP-ENV:encodingStyle="http://www.w3.org/2001/09/soap-encoding/">

<zipcode xsi:type="xsd:string">10016</zipcode> </ns1:getWeather> </SOAP-ENV:Body></SOAP-ENV:Envelope>

3704/13/2023

SOAP Response (weather service)

Presentation of Web Services By-Muhammad AL-Qurishi

<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope

xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope/"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<SOAP-ENV:Body> <ns1:getWeatherResponse xmlns:ns1="urn:examples:weatherservice" SOAP-ENV:encodingStyle="http://www.w3.org/2001/09/soap-encoding/"> <return xsi:type="xsd:int">65</return> </ns1:getWeatherResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>

3804/13/2023

SOAP Message (Optional Tags) Header Tag

<SOAP-ENV:Header> </SOAP-ENV:Header> Has two attributes

SOAP-ENV:mustUnderstand SOAP-ENV:actor

Fault Tags SOAP-ENV:faultcode (Required) the code of the problem SOAP-ENV:faultstring (Required) human-readable version of faultcode SOAP-ENV:faulactor (Optional) tells which service generated the fault SOAP-ENV:detail often contains the values of variables at the time of the

failure

Presentation of Web Services By-Muhammad AL-Qurishi

3904/13/2023

Fault Tags Example

Presentation of Web Services By-Muhammad AL-Qurishi

<SOAP-ENV:Fault><SOAP-ENV:faultcode>

Client.Authentication</SOAP-ENV:faultcode><SOAP-ENV:faultstring>

This customer is unknown to our system.</SOAP-ENV:faultstring><SOAP-ENV:faultactor>

http://www.samspublishing.com/authors</SOAP-ENV:faultactor><SOAP-ENV:detail>

<customer custID=”12345”><name>

Yogi Bear</name>

</SOAP-ENV:detail></SOAP-ENV:Fault>

4004/13/2023

WSDL WSDL is an XML grammar for specifying an interface for a web

service. Describes

What functionality a Web service offers Methods that are available by the web service

How it communicates Data type information for all XML messages

Where to find it Location of the web service

WSDL is an XML-based language for describing Web services and how to access them.

Presentation of Web Services By-Muhammad AL-Qurishi

4104/13/2023

WSDL OPERATION: Submit Order

Input Message: Order

Output Message: Confirmation

Use: SOAP over HTTP

Location: http:// my.org/order

Client submit

order

Presentation of Web Services By-Muhammad AL-Qurishi

Generate WSDL

WSDL

Generate code

SOAP message <order>

SOAP Client Proxy

4204/13/2023

WSDL Concrete and Abstract Description

Presentation of Web Services By-Muhammad AL-Qurishi

The five abstract XML elements that can be defined in a WSDL are as follows: <wsdl:definitions> Root WSDL Element <wsdl:types> What data types will be transmitted? <wsdl:message> What messages will be transmitted? <wsdl:operation> What operations (functions) will be supported? <wsdl:portType> a container for all operations

In addition, there are three concrete XML elements in a WSDL: <wsdl:service> a container for all ports <wsdl:port> Where is the service located? <wsdl:binding> What SOAP specific details are there?

4304/13/2023

WSDL (weather service)

Presentation of Web Services By-Muhammad AL-Qurishi

<wsdl: message name="getWeatherRequest"><wsdl: part name="zipcode" type="xsd:string"/>

<wsdl: /message><wsdl: message name="getWeatherResponse">

<wsdl: part name="temperature" type="xsd:int"/><wsdl: /message><wsdl: portType name="Weather_PortType">

<wsdl: operation name="getWeather"><wsdl: input message="tns:getWeatherRequest"/><wsdl: output message="tns:getWeatherResponse"/>

<wsdl: /operation><wsdl: /portType>

Given a WSDL file, a developer can immediately figure out how to connect to the web service.

4404/13/2023

WSDL Invocation Tools GLUE

http://www.themindelectric.com SOAP::Lite for Perl

http://www.soaplite.com IBM Web Services Invocation Framework

(WSIF)http://www.alphaworks.ibm.com/tech/wsif.

Presentation of Web Services By-Muhammad AL-Qurishi

4504/13/2023

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

Presentation of Web Services By-Muhammad AL-Qurishi

4604/13/2023

How UDDI Works

Presentation of Web Services By-Muhammad AL-Qurishi

UDDI Business Registry

3. UBR assigns a programmatically unique identifier to each service and business registration

Marketplaces, search engines, and business apps query the registry to discover services at other companies

4.

Service TypeRegistrations

SW companies, standards bodies, and programmers populate the registry with descriptions of different types of services

1.

BusinessRegistrationsBusinesses populate

the registry withdescriptions of the services they support

2.

Business uses this data to facilitate easier integration with each other over the Web

5.

4704/13/2023

UDDI Data Captured It is divided into three main categories:

White Pages Information about a specific company; name description,

address, etc. Yellow Pages

Classification data for company or service For example: industry, product or geographic codes

Green Pages Technical information about specific services. Pointers to WSDL Files

Presentation of Web Services By-Muhammad AL-Qurishi

4804/13/2023

UDDI at Work

Presentation of Web Services By-Muhammad AL-Qurishi

search enginesquery UBR, cache KSUdata, and bind to its services

3. Faculties , students and businesses discover KSU and do business with it

4.

1.

KSU createsonline website with local ASP

Ksu.edu.sa

2.

ASP registersKSU with UBR

UDDI Registry

4904/13/2023

References [1] Web Services Essential, by Ethan Cerami, First Edition

February 2002 (O'Reilly & Associates, Inc.) [2] Web Services: A Manager's Guide, by Anne Thomas Manes,

June 11, 2003(Addison Wesley) [3] Understanding Web Services, by Eric Newcomer,

2003(Addison Wesley) [4] http://www.w3.org

http://www.w3.org/standards/webofservices/ http://www.w3.org/XML/ http://www.w3.org/TR/wsdl http://www.w3.org/TR/soap http://www.uddi.org

Presentation of Web Services By-Muhammad AL-Qurishi

5004/13/2023

Thanks

? Presentation of Web Services By-Muhammad AL-Qurishi