Aplicatii Web bazate pe semantica, agenti si servicii
Universitatea Politehnica BucurestiAnul universitar 2007-2008, MasterAdina Magda Florea
http://turing.cs.pub.ro/webs_07
Servicii Web
Servicii SOA Standarde SOAP WSDL UDDI
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
Service Oriented Architecture
SOA este un pattern arhitectural mai multi consumatori de servicii mai multi ofertanti de servicii potential, mai multe directoare de
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)
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
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
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
Descrierea unui serviciu
Numee.g., GetTemperature
Tipul parametrilor de intraree.g., (String, String)
Tipul parametrilor de iesiree.g., Integer
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
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>
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>
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
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
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/">
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>
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>
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>
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>
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>
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
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
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
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
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
Corespondenta WSDL UDDI
<import>
<port>
<port>
BusinessEntity
BusinessService
BindingTemplate
BindingTemplate
Service Implementation
UDDI
<service>
Service Interface
<types>
<message>
<portType>
<binding>
tModel
WSDL
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>
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>
Slide-uri bazate pe:
Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley, 2005
Top Related