Top Banner
Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)
44

Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Mar 26, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Web services

B. Pernici(alcuni lucidi sono tratti dalla presentazione di Leymann al

VLDB 2001)

Page 2: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Sommario

• Web service

• Service oriented architecture

• SOAP

• UDDI

• WSDL

• Bibliografia: Conallen, cap. 4

Page 3: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Virtual Enterprise: Scenario

WFMS 1

WFMS 2

Browser

MessageQueuing

AnyCommunication

SOAP, WSDL,UDDI,...

HTTP,IIOP,...

Customer

Your Company

Supplier

Page 4: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Consequences• You can...

– ...outsource „services“ (e.g. where you are not competitive)

– ...offer „services“ (e.g. make money with functions & processes you perform for others)

• These services reach from – ...simple, fine grained functions...– ...to complete business processes, i.e. coarse

grained functions

Page 5: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

O.K., But: How To Access Services?

• Firewalls are obstructions to ubiquitious access to services• Wide range of different programming languages,

programming paradigms and hosting environments,... makes orchestration a nightmare

• ...

We need a globally available invokation mechanism!

Page 6: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Web services

• Services that can be invoked by other programs on the network

• Decentralization of processing mechanism (Sun, 1990)

• Def: Web Service: collection of functions packaged and published on a network for use by other client programs

Page 7: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Service Oriented Architecture (SOA)

Page 8: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Ingredienti

• Descrizione servizi (WSDL)

• Archivio servizi (registry)

• Meccanismi di invocazione

Page 9: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

WSDLWSDL

Page 10: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

How To Define New Web Services?

• Well, it‘s nice to refer to web services that others have defined and agreed on (= tModels)

• ...but what if I want to publish my own web services– e.g. simple functions usefull for others– or complete business processes that I offer

• ...without creating a standard!

WSDL(Web Services Description Language)

We need a language to specify servicesand describe how others can bind to them!

Page 11: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

WSDL Ingredients

Message

OperationPort Type

Port

Binding

Service

Input & Output

Supports

Formats &Protocols

How to in

voke

How to encode

Implements

Provides

Page 12: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

o3o3

o4o4

pt

Port Types: Graphical Representation

Request

-Response

One-Way

Notification

o1o1o1

o2o2o2o2

-Response

Solicit

Page 13: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Making Services Available

Message

OperationPort Type

Input & Output

Supports

Binding

Formats &Protocols

How to in

voke

How to encode

Port Service

Implements

Provides

HowTo Do

BusinessWith Me

(WidelyAccepted)AbstractService

WhatBusiness

You Can DoWith Me

1.

2.

3.

Page 14: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

WSDL

Page 15: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

WSDL

Page 16: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

WSDL binding

Page 17: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)
Page 18: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

UDDIUDDI

Page 19: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Repositories e registries

• systems storing and managing– e-Service specifications– e-service providers

• Some initiatives– UDDI

Page 20: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

UDDI

• - accesso alla descrizione di servizi, di tipologie di servizi e di fornitori di servizi secondo una struttura dati ben definita;

• - astrazione dalla tecnologia utilizzata nella realizzazione del servizio;

• - la ricerca di un servizio secondo differenti chiavi di ricerca.

Page 21: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

How To Find Services?

• ...to catalogue services based on publish requests of service providers

• ...to maintain taxonomy(ies) to support searching for appropriate services

• ...to search services by human beings or by programs

UDDI(Universal Description, Discovery & Integration)

We need a globally available directory!

Page 22: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

How UDDI Works

UDDI

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

3.

Service TypeRegistrations

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

1.

BusinessRegistrations

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

4.Businesses populate the registry withdescriptions of the services they support

2.

Page 23: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Registry Data

• Businesses register public informationabout themselves

WhitePages

YellowPages

GreenPages

Service TypeRegistrations

Who am I?

What do Ioffer?

How to dobusiness with me

• Standards bodies, Programmers, Businesses register information about their Service Types(„tModels“)

Page 24: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Example of a RegistrationbusinessEntity

TB993… Frank‘s Flowershopwww.Frank-Flower.com“Flowers for the world!“contactsbusinessServicesidentifierBagcategoryBag

+49-7031-163998Boeblingen, [email protected]

Frank Leymann

businessServiceKeyNameDescriptionBindingTemplates

businessService

23T701e54683nf…Online catalog“Website where you can …BindingTemplates

BindingTemplate5E2D412E5-44EE-…http://www.flowers.de/flowerCattModelInstanceDetails

tModelInstanceInfo

4453D6FC-223C-3ED0…

http://www.rosetta.net/catalogPIP

keyedReference

DFE-2B…DUNS45231

keyedReference

EE123…NAICS02417

tModelKeys

Page 25: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

IBM

Ariba

Microsoftother

other

Registry Operation

• Peer nodes (websites)

• Companies registerwith any node

• Registrations replicatedon a daily basis

• Complete set of“registered” recordsavailable at all nodes

• Common set ofSOAP APIs supportedby all nodes

• Compliance enforced bybusiness contract

UDDI.org

queries

Page 26: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)
Page 27: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

SOAPSOAP

Page 28: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

SOAP: Simple Object Access Protocol

Provide an (Object) RPC over the Internet

• Interoperability amongst a wide range of programs on a wide range of plattforms– Different programming languages, programming paradigms and

hosting environments

• Make existing programs more accessible to a broader range of users

• Use of existing technology wherever possible– Usage of HTTP and XML („XML as HTTP payload“)

• HTTP as RPC transport• XML as RPC encoding scheme

– No special SOAP API, no special SOAP ORB

Page 29: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

HTTP POST: Invoking Code

Client Server

POST /myFunctions/reverse HTTP/1.1Host: www.Frank-Leymann.comContent-Type: text/plainContent-Length: 12 

Hello, World

200 OKContent-Type: text/plainContent-Length: 12 dlroW ,olleH

RunProgram

A simpleRPC

Page 30: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Tunneling The Firewall

Client

RMI

IIOP

HTTP

Page 31: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

SOASOA

Page 32: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

SOA Reminder

TransportMedium

FindBind

Publish

ServiceRequestor

ServiceDirectory

ServiceProvider

Page 33: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

...And Relation To Web ServicesService

Requestor

ServiceRequestor

WSDLUDDI

SOAP

Page 34: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

WebServices

SOA In Action

UDDI,WSDL,SOAP,...

PerformDelivery

Check CreditRating

ProduceInvoice

Page 35: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Approfondimenti

Page 36: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Example<?xml version="1.0"?><definitions name="StockQuote" xmlns:tns="http://leymann.com/stockquote.wsdl" xmlns:xsd="http://leymann.com/stockquote.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="GetLastTradePriceRequest"> <part name="tickerSymbol" element="xsd:string"/> <part name="time" element="xsd:timeInstant"/> </message> <message name="GetLastTradePriceResponse"> <part name="result" type="xsd:float"/> </message> <portType name="StockQuotePortType"> <operation name="GetLastTradePrice"> <input message="tns:GetLastTradePriceRequest"/> <output message="tns:GetLastTradePriceResponse"/> </operation> </portType> ...

Page 37: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Example<binding name="StockQuoteSoapBinding"

type="tns:StockQuotePortType"> <soap:binding

style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="GetLastTradePrice"><soap:operation soapAction="http://leymann.com/GetLastTradePrice"/><input><soap:body use="encoded" namespace="http://leymann.com/stockquote" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" namespace="http://leymann.com/stockquote" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output> ...

Page 38: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

Example

<service name="StockQuoteService"><documentation>My first service</documentation><port name="StockQuotePort"

binding="tns:StockQuoteSoapBinding"><soap:address

location="http://leymann.com/stockquote"/></port></service>

Page 39: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)
Page 40: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

SOAP Request/Response Structure

Object ID(Which object?)

Interface ID(Which interface?)

Method ID(Which method?)

Extension Headers(What has been forgotten

to be build into the protocol?)

Parameter(In and inout parms)

Request

Status Code(Did it work?)

Response

Extension Headers(What has been forgotten

to be build into the protocol?)

Parameter(Out and inout parms)E

nd

poi

nt

Ref

eren

ce

Page 41: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

SOAP Endpoint Reference

POST /StockServer HTTP/1.1Host: 209.111.234.34Content-Type: text/xml; charset=„utf-8“Content-Length: nnnn<SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="Some-URI">

... 

/StockServer/getLastTradePrice

Object Endpoint ID

80

TCP Port No

209.111.234.34

IP Host Address

Page 42: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

A Simple SOAP RPCPOST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8„Content-Length: nnnn

<SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="Some-URI"> <symbol>DIS</symbol> </m:GetLastTradePrice> </SOAP-ENV:Body></SOAP-ENV:Envelope>

MethodName

Input Parameter

Page 43: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

A Simple SOAP ResponseHTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8„Content-Length: nnnn 

<SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <m:GetLastTradePriceResponse xmlns:m="Some-URI"> <Price>34.5</Price> </m:GetLastTradePriceResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>

StandardSuffix

Page 44: Web services B. Pernici (alcuni lucidi sono tratti dalla presentazione di Leymann al VLDB 2001)

SOAP HeaderPOST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8„Content-Length: nnnnSOAPAction: „Some-URI“

 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Header> <t:Transaction xmlns:t="some-URI, SOAP-ENV:mustUnderstand="1"> 5 </t:Transaction> </SOAP-ENV:Header> <SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="Some-URI"> <symbol>DEF</symbol> </m:GetLastTradePrice> </SOAP-ENV:Body></SOAP-ENV:Envelope>

ProtocolExtensions