Aplicatii Web bazate pe semantica, agenti si servicii

29
Aplicatii Web bazate pe semantica, agenti si servicii Universitatea Politehnica Bucuresti Anul universitar 2007-2008, Master Adina Magda Florea http://turing.cs.pub.ro/webs_07

description

http://turing.cs.pub.ro/webs_07. Aplicatii Web bazate pe semantica, agenti si servicii. Universitatea Politehnica Bucuresti Anul universitar 2007-2008, Master Adina Magda Florea. Servicii Web. Servicii SOA Standarde SOAP WSDL UDDI. Servicii Web. - PowerPoint PPT Presentation

Transcript of Aplicatii Web bazate pe semantica, agenti si servicii

Page 1: Aplicatii Web bazate pe semantica, agenti si servicii

Aplicatii Web bazate pe semantica, agenti si servicii

Universitatea Politehnica BucurestiAnul universitar 2007-2008, MasterAdina Magda Florea

http://turing.cs.pub.ro/webs_07

Page 2: Aplicatii Web bazate pe semantica, agenti si servicii

Servicii Web

Servicii SOA Standarde SOAP WSDL UDDI

Page 3: Aplicatii Web bazate pe semantica, agenti si servicii

Servicii Web

Serviciile Web au aparut ca o tehnologie comuna de integrare

Serviciile Web par a fi baza noii generatii de aplicatii distribuite

Arhitecturile Orientate pe Servicii utilizeaza servicii Web

Orchestrarea serviciilor permite orientarea pe servicii

Page 4: Aplicatii Web bazate pe semantica, agenti si servicii

Service Oriented Architecture

SOA este un pattern arhitectural mai multi consumatori de servicii mai multi ofertanti de servicii potential, mai multe directoare de

servicii

Page 5: Aplicatii Web bazate pe semantica, agenti si servicii

Service Oriented Architecture

Servicii autonome (de dorit) Comunicare bazata pe mesaje Alinierea cu procesul de business Serviciile sunt blocurile

constructive ale aplicatiilor: B2B (Business to Business) A2A (Application to Application)

Page 6: Aplicatii Web bazate pe semantica, agenti si servicii

Standarde pentru servicii Web

BPEL4WSOWL-S Service

Model

ebXMLCPA

Process and workfloworchestrations

QoS: Servicedescriptions and bindings

Contracts andagreements

XLANG

WSCL

WSDLebXML

CPP

ebXMLBPSS

XML, DTD, and XML Schema

HTTP, FTP, SMTP, SIP, etc.

SOAPebXML

messaging

OWL

UDDIebXML

Registries

WSCLWSCI

WS-Coordination

WS-AtomicTransaction and WS-BusinessActivity

OWL-S ServiceGrounding

OWL-S ServiceProfile

BTP

BPML

Discovery

Messaging

Transport

QoS: Conversations

QoS: Choreography

QoS: Transactions

Encoding

WS-Policy

WS-Security

WS-ReliableMessaging

PSL

RDF

Page 7: Aplicatii Web bazate pe semantica, agenti si servicii

Servicii Web: arhitectura de baza

ServiceBroker

ServiceProvider

ServiceRequesto

r

Bind or invoke(SOAP)

Find or discover(UDDI)

Publish or announce(WSDL)

Registry; well-known

Not well-known

Page 8: Aplicatii Web bazate pe semantica, agenti si servicii

Profil de baza (BP 1.0)

Web Services Interoperability Organization (WS-I) a specificat Basic Profile version 1.0: SOAP 1.1 HTTP 1.1 XML 1.0 XML Schema Parts 1 and 2 UDDI Version 2 WSDL 1.1

Page 9: Aplicatii Web bazate pe semantica, agenti si servicii

Descrierea unui serviciu

Numee.g., GetTemperature

Tipul parametrilor de intraree.g., (String, String)

Tipul parametrilor de iesiree.g., Integer

Page 10: Aplicatii Web bazate pe semantica, agenti si servicii

SOAP (Simple Object Access Protocol)

Folosit pentru schimbul de mesaje HTTP, SMTP si SIP (Session Initiation Protocol for Internet telephony)

Proiectat initial pentru "remote-procedure calls" (RPC)

Bazat pe caractere, deci usor de incriptat/decriptat

Ineficient deoarece este bazat pe caractere (si nu binar)

Nu descrie interactiuni bidirectionale si n-party

Page 11: Aplicatii Web bazate pe semantica, agenti si servicii

Ex. Cerere SOAP

POST /temp HTTP/1.1Host: www.socweather.comContent-Type: text/xml; charset="utf-8"Content-Length: xxxSOAPAction: "http://www.socweather.com/temp"

<!– Ce este deasupra sunt HTTP headers --><?xml version=“1.0”?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <env:Body> <m:GetTemp xmlns:m="http://www.socweather.com/temp.xsd"> <m:City>Honolulu</m:City> <m:When>now</m:When> </m:GetTemp> </env:Body></env:Envelope>

Page 12: Aplicatii Web bazate pe semantica, agenti si servicii

Ex. Raspuns SOAP

HTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8"Content-Length: xxxSOAPAction: "http://www.socweather.com/temp"

<?xml version=“1.0”?><env:Envelope

xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"

env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

<env:Body> <m:GetTempResponse

xmlns:m="http://www.socweather.com/temp.xsd"> <DegreesCelsius>30</DegreesCelsius> </m:GetTempResponse> </env:Body></env:Envelope>

Page 13: Aplicatii Web bazate pe semantica, agenti si servicii

WSDL: Web Services Description Language

Descrie o interfata a unui serviciu Web, incluzand: Definitii ale tipurilor de date Formatul mesajelor de intrare si iesire Operatiile oferite de un serviciu Adrese de retea Protocol bindings

Page 14: Aplicatii Web bazate pe semantica, agenti si servicii

Modelul de date WSDL definitions targetNamespace=thisNamespace xmins:tns=thisNamespace

types message name=in message name=out

portType name=foo operation input message=tns:in output message=tns:out

binding name=foobar type=tns:foo [binding information]

service name=foobar Service

Port name=foobarPort binding=tns:foobar [endpoint information]

Types contains data type definitionsMessages consist of one or more parts

A portType describes an abstract setof operations

A binding describes a concrete set offormats and protocols for the fooportTypes

A port describes an implementationof the foobar binding

Page 15: Aplicatii Web bazate pe semantica, agenti si servicii

Ex. WSDL

<?xml version="1.0"?><!– elementul radacina, wsdl:definitions, defineste o multime

--><!– de servicii corelate --><wsdl:definitions name="Temperature" targetNamespace="http://www.socweather.com/schema" xmlns:ts="http://www.socweather.com/TempSvc.wsdl" xmlns:tsxsd="http://schemas.socweather.com/TempSvc.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

Page 16: Aplicatii Web bazate pe semantica, agenti si servicii

Ex. WSDL

<!-- wsdl:types incapsuleaza definitii de schema a tipurilor --><!-- comunicarii; aici utilizand xsd --> <wsdl:types><!– toate declaratiile de tip sunt exprimate in xsd --> <xsd:schema targetNamespace="http://namespaces.socweather.com" xmlns:xsd="http://www.w3.org/1999/XMLSchema">

<!-- xsd def: GetTemp [City string, When string] --> <xsd:element name="GetTemp"> <xsd:complexType> <xsd:sequence> <xsd:element name="City" type="string"/> <xsd:element name="When" type="string"/> </xsd:sequence> </xsd:complexType> </xsd:element>

Page 17: Aplicatii Web bazate pe semantica, agenti si servicii

Ex. WSDL<!-- xsd def: GetTempResponse [DegreesCelsius integer] --> <xsd:element name="GetTempResponse"> <xsd:complexType> <xsd:all> <xsd:element name="DegreesCelsius" type="integer"/> </xsd:all> </xsd:complexType> </xsd:element>

<!-- xsd def: GetTempFault [errorMessage string] --> <xsd:element name="GetTempFault"> <xsd:complexType> <xsd:all> <xsd:element name="errorMessage" type="string"/> </xsd:all> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types>

Page 18: Aplicatii Web bazate pe semantica, agenti si servicii

Ex. WSDL<!– elementele wsdl:message descriu tranzactii potentiale --><!– Cele mai multe mesaje, asa ca aici, au o singura parte. Mesajele --><!– cu ma multe parti ofera posibilitatea de a asambla mesaje complexe -->

<!-- cererea GetTempRequest este de tipul GetTemp --> <wsdl:message name="GetTempRequest"> <wsdl:part name="body" element="tsxsd:GetTemp"/> </wsdl:message>

<!-- raspunsul GetTempResponse este de tipul GetTempResponse --> <wsdl:message name="GetTempResponse"> <wsdl:part name="body" element="tsxsd:GetTempResponse"/> </wsdl:message>

<!-- wsdl:portType descrie mesajele dintr-o operatie --> <wsdl:portType name="GetTempPortType">

<!-- wsdl:operation descrie intregul protocol de la intrare --><!– la iesire sau eroare --> <wsdl:operation name="GetTemp"><!– Ordinea intrarii si iesirii este importanta; input --><!– inainte de output indica cerere-raspuns (request-response) --> <wsdl:input message="ts:GetTempRequest"/> <wsdl:output message="ts:GetTempResponse"/> <wsdl:fault message="ts:GetTempFault"/> </wsdl:operation> </wsdl:portType>

Page 19: Aplicatii Web bazate pe semantica, agenti si servicii

Ex. WSDL<!-- wsdl:binding indica un protocol de serializare --><!– pentru serviciu --> <wsdl:binding name="TempSvcSoapBinding" type="ts:GetTempPortType">

<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="GetTemp"> <soap:operation soapAction="http://www.socweather.com/TempSvc"/><!– specifica faptul ca mesajul din --><!-- wsdl:operation "GetTemp" foloseste SOAP? @@@ --> <wsdl:input> <soap:body use="literal"

namespace="http://schemas.socweather.com/TempSvc.xsd"/> </wsdl:input> <wsdl:output> <soap:body use="literal"

namespace="http://schemas.socweather.com/TempSvc.xsd"/> </wsdl:output> <wsdl:fault> <soap:body use="literal"

namespace="http://schemas.socweather.com/TempSvc.xsd"/> </wsdl:fault> </wsdl:operation> </wsdl:binding>

Page 20: Aplicatii Web bazate pe semantica, agenti si servicii

Ex. WSDL

<!-- wsdl:service denumeste un serviciu nou "TemperatureService" -->

<wsdl:service name="TemperatureService"> <wsdl:documentation>socweather.com temperature service </wsdl:documentation>

<!– conectarea la "TempSvcSoapBinding" --> <wsdl:port name="GetTempPort"

binding="ts:TempSvcSoapBinding">

<!– ofera legatura la adresa de retea --> <soap:address

location="http://www.socweather.com/TempSvc"/> </wsdl:port> </wsdl:service></wsdl:definitions>

Page 21: Aplicatii Web bazate pe semantica, agenti si servicii

Directorul de servicii Permite descoperirea serviciilor de catre

aplicatii, agenti, ofertanti de servicii Web, clienti de servicii Web, persoane, obiecte, care se pot localiza White pages – cautare pe baza de nume Yellow pages – cautare pe baza de caracteristici

Basic directory – poate fi o simpla baza de date (pasiva) sau un broker/facilitator (activ, care alerteaza si recruteaza participanti)

UDDI – atat white pages cat si yellow pages, dar pasive

Page 22: Aplicatii Web bazate pe semantica, agenti si servicii

UDDI: Universal Description, Discovery, and Integration

UDDI este un serviciu Web bazat pe SOAP si XML

UDDI Registry1. tModels: descrierea tehnica a

comportarii unui serviciu2. businessEntities: descrie

specificatiile tModels multiple

Page 23: Aplicatii Web bazate pe semantica, agenti si servicii

Yellow, Green, si White Pages in UDDI

-businessKey : string(idl)-name : string(idl)-description : string(idl)-URL : string(idl)-contacts : contact-businessServices : businessService-identifierBag : keyedReference-categoryBag : keyedReference

businessEntity

1

*

-tModelKey : string(idl)-keyName : string(idl)-keyValue : string(idl)

keyedReference

-serviceKey : string(idl)-tModelKey : string(idl)-name : string(idl)-description : string(idl)-bindingTemplates

businessService

-phone : string(idl)-address : string(idl)

contact

Page 24: Aplicatii Web bazate pe semantica, agenti si servicii

Modelul UML pentru Business Entity intr-un UDDI Registry

-businessKey-name-description-businessServices-categoryBag-identifierBag

businessEntity

-serviceKey-businessKey-name-description-bindingTemplates-categoryBag

businessService

-bindingKey-serviceKey-description-accessPoint

bindingTemplate

-name-description-overviewDoc-categoryBag-identifierBag

tModel

identifierBag

categoryBag

-keyName-keyValue

keyedReference

-description-overviewDoc

tModelInstanceInfo

Page 25: Aplicatii Web bazate pe semantica, agenti si servicii

Structurile de date de baza pentru UDDI

businessEntity: Information about theparty who publishes information about

a service

businessService: Descriptiveinformation about a particular family of

technical services

bindingTemplate: Technicalinformation about a service entry point

and implementation specs

tModel: Descriptions of specificationsfor services or value sets. Basis for

technical fingerprints

businessEntities containbusinessServices

businessServices containbindingTemplates

bindingTemplates contain referencesto tModels. These references

designate the interface specificationsfor a service

Page 26: Aplicatii Web bazate pe semantica, agenti si servicii

Corespondenta WSDL UDDI

<import>

<port>

<port>

BusinessEntity

BusinessService

BindingTemplate

BindingTemplate

Service Implementation

UDDI

<service>

Service Interface

<types>

<message>

<portType>

<binding>

tModel

WSDL

Page 27: Aplicatii Web bazate pe semantica, agenti si servicii

O cerere catre UDDI Registry

Un registru UDDI actioneaza ca un serviciu

<?xml version="1.0" encoding="UTF-8"?><find_business xmlns="urn:uddi-org:api_v3"> <findQualifiers> <findQualifier> uddi:uddi.org:findqualifier:exactmatch </findQualifier> </findQualifiers> <!—gaseste informatii despre companiile cu numele (exactmatch) "WeatherService Inc." --> <name>WeatherService Inc.</name></find_business>

Page 28: Aplicatii Web bazate pe semantica, agenti si servicii

Raspuns de la UDDI Registry

<?xml version="1.0" encoding="UTF-8"?><businessList> <businessInfos> <businessInfo businessKey="...KO..."> <name>WeatherService, Inc.</name> <serviceInfos> <serviceInfo serviceKey="...KN..." businessKey="...K1..."> <name>Temperature Service</name> </serviceInfo> </serviceInfos> </businessInfo> </businessInfos></businessList>

Page 29: Aplicatii Web bazate pe semantica, agenti si servicii

Slide-uri bazate pe:

Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley, 2005