52
Architecture logicielle GLO-3001 Partie I : Systèmes distribués Félix-Antoine Bourbonnais Département d’informatique et de génie logiciel Université Laval Hiver 2010

Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architecture logicielleGLO-3001

Partie I : Systèmes distribués

Félix-Antoine Bourbonnais

Département d’informatique et de génie logicielUniversité Laval

Hiver 2010

Page 2: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués →

Avant-propos

Mise en garde

Le monde du SOA est pavé d’acronymes...

Ex. : SOA, ESB, WS, RPC, WS-*, WSDL, UUDI, SOAP, REST, BPM,XSD, MEP, ...

N’hésitez pas à poser des questions pendant laprésentation !

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 2 / 52

Page 3: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués →

Avant-propos

«Le développement logiciel est l’art de

l’abstraction !» [3]

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 3 / 52

Page 4: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Architectures distribuées classiques

Partie I : Systèmes distribuésPlan

1 Architectures distribuées classiques

2 Services web (WS)

3 REST

4 ESB

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 4 / 52

Page 5: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Architectures distribuées classiques

Client-serveur (2-tiers)

• Rôles spécifiques

• Caractéristiques distinctes

• Les paires peuvent utiliser différents protocoles

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 5 / 52

Page 6: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Architectures distribuées classiques

3-tiers ou N-tiersDistribué

DatabaseStorage

>GET SALES TOTAL

>GET SALES TOTAL

GET LIST OF ALLSALES MADELAST YEAR

ADD ALL SALESTOGETHER

4 TOTAL SALES

QUERYSALE 1SALE 2SALE 3SALE 4Data tier

Presentation tier

Logic tier

This layer coordinates the application, processes commands, makes logical decisions and evaluations, and performs calculations. It also moves and processes data between the two surrounding layers.

Here information is stored and retrieved from a database or file system. The information is then passed back to the logic tier for processing, and then eventually back to the user.

The top-most level of the applicationis the user interface. The main functionof the interface is to translate tasks and results to something the user can understand.

Source : Wikipedia.org

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 6 / 52

Page 7: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Architectures distribuées classiques

RPC

• Permet de faire des appels distants à procédure/méthode

• Nom de la méthode• Paramètres

• Étant le concept d’un appel de fonction local

• La communication et le transfert (sérialisation) sont transparents• Création d’un « stub » local

• Normalement synchrone

• Plusieurs protocoles/implémentations incompatibles

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 7 / 52

Page 8: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Architectures distribuées classiques

RPCInterface et offre de services

• Un serveur RPC « expose » des fonctions (interface)

• Interface Definition Language (IDL)

• Compilation pour générer le code nécessaire pour le client et leserveur (dans le bon langage)

• Souvent, le client doit connaître l’interface et le contrat

• Pour les protocoles « classiques » (1ère génération)• Comment appeler la procédure X offerte par un fournisseur tiers

sur Internet ?• Nous verrons plus tard que d’autres protocoles basés sur RPC

permettent d’exposer publiquement cette information

• Pas de découverte des services (1ère génération)

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 8 / 52

Page 9: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Architectures distribuées classiques

XML-RPC

• Utilisation du XML

• Quelques types de base

• Sérialisation des données

• Précurseur de SOAP

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 9 / 52

Page 10: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Architectures distribuées classiques

Objets distribuésDistributed Object Application

• « Orienté-objet »

1 Le client obtient une référence sur un objet distant (remoteobject)

2 Le client appelle des méthodes sur cet objet

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 10 / 52

Page 11: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Architectures distribuées classiques

Autres architectures

• Pair-à-pair (Peer-to-Peer)

• Architecture à base d’espaces (Space-Based Architecture ;SBA)

• Fermes informatiques (Clustered)

• Grilles informatiques (Grid)

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 11 / 52

Page 12: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → Introduction

Partie I : Systèmes distribuésPlan

1 Architectures distribuées classiques

2 Services web (WS)IntroductionWSDLSOAPUDDIWS-*

3 REST

4 ESB

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 12 / 52

Page 13: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → Introduction

Service webMotivation

• Web Service (WS)

• Groupe de standards ouverts

• Pour standardiser la communication entre composantsdistribués (réseau)

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 13 / 52

Page 14: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → Introduction

Service webCaractéristiques

• Principalement basé sur XML

• Utilise généralement HTTP

• Regroupe plusieurs entreprises :

• Microsoft• IBM• Sun et Oracle• HP• ...

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 14 / 52

Page 15: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → Introduction

Service web (suite)Caractéristiques

• Regroupe et utilise plusieurs standards [3] :

• Environ 10 de bas niveau (XML, HTTP, ...)• Plus de 50 directement liés aux WS• Environ 10 profiles

• Plusieurs organismes de normalisation :

• W3C• OASIS• WS-I (Web Services Interoperability Oraganization)

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 15 / 52

Page 16: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → Introduction

Service webTerminologie

Note terminologique

• La définition de « web service » peut varier.

• Certains utilisent « web service » d’une manière générique(synonyme de « service »). Dans ce cas, le WS n’est pasforcément basé sur le XML et pourrait englober d’autre types deservices comme REST.

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 16 / 52

Page 17: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → Introduction

Standards fondamentaux

Bas niveau :

• XML (XML 1.0 ; XSD ; XML-NS)

• HTTP (HTTP, HTTPS)

WS :

• WSDLDescription technique d’une interface (service).

• SOAPProtocole pour échanger des données/informations entre desservices.

• UDDIEnregistrement et découverte de services.

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 17 / 52

Page 18: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → Introduction

Standards fondamentaux (suite)

Note

Ces standards ne sont pas tous obligatoires

• Certains peuvent ne pas être utilisés dans tous les cas

• Certains peuvent se combiner avec d’autres protocoles

• On considère généralement WSDL comme obligatoire

• WS-I Basic Profile force WSDL et SOAP [8]

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 18 / 52

Page 19: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → Introduction

Notion préalable : XSD

• XML Schema Definition Language / XML Schema (XSD) [5]

• Validation d’un document XML

• Contenu (type et domaine de validité)• Structure

• Documentation

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 19 / 52

Page 20: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → Introduction

XSDExemple

<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="cours"><xs:complexType>

<xs:sequence><xs:element name="sigle" type="xs:string" /><xs:element name="nom" type="xs:string" />

</xs:sequence></xs:complexType>

</xs:element></xs:schema>

<?xml version="1.0" encoding="UTF-8"?><cours xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="cours.xsd"><sigle>GLO−3001</sigle><nom>Architecture logicielle</nom>

</cours>

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 20 / 52

Page 21: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WSDL

Partie I : Systèmes distribuésPlan

1 Architectures distribuées classiques

2 Services web (WS)IntroductionWSDLSOAPUDDIWS-*

3 REST

4 ESB

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 21 / 52

Page 22: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WSDL

WSDL

• Web Services Description Language (WSDL) [7]

• Web Services Definition Language (WSDL 1.1)• WSDL 1.1 est encore ce qui est le plus supporté et utilisé

• Description d’un service

• Format des messages• Les opérations (fonctions)• L’emplacement du service

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 22 / 52

Page 23: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WSDL

Contenu

Source : Wikipedia.org

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 23 / 52

Page 24: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WSDL

Exemple (WSDL 2.0)

<?xml version="1.0" encoding="UTF-8"?><description

targetNamespace="http://glo3001.ift.ulaval.ca/cours.wsdl"xmlns:tns="http://glo3001.ift.ulaval.ca/cours.wsdl"xmlns:wsULCours="http://glo3001.ift.ulaval.ca/cours.xsd"xmlns="http://www.w3.org/ns/wsdl"xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:soap="http://www.w3.org/2006/01/wsdl/soap"xsi:schemaLocation="http://www.w3.org/ns/wsdl

http://www.w3.org/2007/06/wsdl/wsdl20.xsd">

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 24 / 52

Page 25: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WSDL

Exemple (WSDL 2.0) (suite)

<types><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://glo3001.ift.ulaval.ca/cours.xsd">

<xs:import schemaLocation="cours.xsd"namespace="http://glo3001.ift.ulaval.ca/cours.xsd" />

<xs:element name="getCourseNameRequest"><xs:complexType>

<xs:sequence><xs:element name="sigle" type="xs:string" />

</xs:sequence></xs:complexType>

</xs:element>

<xs:element name="getCourseNameResponse"type="cours" />

</xs:schema></types>

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 25 / 52

Page 26: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WSDL

Exemple (WSDL 2.0) (suite)

<interface name="CoursInterface">

<operation name="getCourseName"pattern="http://www.w3.org/ns/wsdl/in-out">style="http://www.w3.org/ns/wsdl/style/iri">

<input messageLabel="In"element="wsULCours:getCourseNameRequest"/>

<output messageLabel="Out"element="wsULCours:getCourseNameResponse"/>

</operation></interface>

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 26 / 52

Page 27: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WSDL

Exemple (WSDL 2.0) (suite)

<binding name="CoursSOAPBinding"interface="tns:CoursInterface"type="http://www.w3.org/2006/01/wsdl/soap"soap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP">

<operation ref="tns:getCourseName"soap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/>

</binding>

<service name="CoursService"interface="tns:CoursInterface">

<endpoint name="CoursEndpoint"binding="CoursSOAPBinding"address="http://glo3001.ift.ulaval.ca/services/cours" />

</service>

</description>

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 27 / 52

Page 28: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WSDL

Considérations architecturales

Conseil...

Séparer les types de données utilisées à l’externe (interface) decelles à l’interne dans la logique d’affaires du service. [3]

• Même idée que les couches/niveaux (layers).

• Couplage ! !

• Penser aux versions subséquentes (versioning) !

• Analyser correctement le support des versions en fonction du« framework »

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 28 / 52

Page 29: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WSDL

Versionnage des types

• Changer le nom des types

• Fusion (ajout des nouveaux attributs)

• Types génériques

Attention

• Franchissez la rivière quand vous y serez !

• SIMPLE !

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 29 / 52

Page 30: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → SOAP

Partie I : Systèmes distribuésPlan

1 Architectures distribuées classiques

2 Services web (WS)IntroductionWSDLSOAPUDDIWS-*

3 REST

4 ESB

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 30 / 52

Page 31: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → SOAP

SOAP

• SOAP (v 1.2 [6])

• Anciennement (< 1.2) « Simple Object Access Protocol »

• Protocole de transmission de messages entre services

• Évolution de XML-RPC

• Appel de méthodes distantes

• Indépendant du protocole de bas-niveau

• Presque toujours utilisé avec HTTP

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 31 / 52

Page 32: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → SOAP

Exemple

Requête :POST /services/cours HTTP/1.1Host: glo3001.ift.ulaval.caContent−Type: application/soap+xml; charset=utf−8Content−Length: nnn

<?xml version="1.0"?><soap:envelope>

<soap:header>...

</soap:header><soap:body>

<getCourseNameRequest><sigle>GLO−3001</sigle>

</getCourseNameRequest</soap:body>

</soap:envelope>

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 32 / 52

Page 33: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → SOAP

Exemple (suite)

Réponse :HTTP/1.1 200 OKContent−Type: application/soap+xml; charset=utf−8Content−Length: nnn

<?xml version="1.0"?><soap:envelope>

<soap:header>...

</soap:header><soap:body>

<getCourseNameResponse><cours>

<sigle>GLO−3001</sigle><nom>Architecture logicielle</nom>

</cours></getCourseNameResponse>

</soap:body></soap:envelope>

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 33 / 52

Page 34: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → SOAP

Choix du style de message

• Le corps de SOAP peut être exprimé de plusieurs façons : [1][4]

• RPC/encoded• RPC/literal• Document/literal

• « Document/literal » devrait être privilégié

• Réduit le couplage• Permet au contenu d’être validé (XSD)• Facilite le versionnage

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 34 / 52

Page 35: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → UDDI

Partie I : Systèmes distribuésPlan

1 Architectures distribuées classiques

2 Services web (WS)IntroductionWSDLSOAPUDDIWS-*

3 REST

4 ESB

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 35 / 52

Page 36: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → UDDI

UDDI

• Universal Description Discovery and Integration (UDDI)

• Dépôt/Registre (repository/registry)

• « Service broker »

• Permet d’enregistrer des services

• Permet de découvrir des services

• But : Ne pas avoir à écrire en dur (hardcoder) l’adresse d’unservice

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 36 / 52

Page 37: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → UDDI

UDDI

Contient

Décrit

Référence

(endpoint)Cherche

Utilise

(SOAP)

Publie

WSDLUDDI

FournisseurConsommateur

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 37 / 52

Page 38: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WS-*

Partie I : Systèmes distribuésPlan

1 Architectures distribuées classiques

2 Services web (WS)IntroductionWSDLSOAPUDDIWS-*

3 REST

4 ESB

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 38 / 52

Page 39: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WS-*

WS-*

• 2ième génération

• Extensions à WS

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 39 / 52

Page 40: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → Services web (WS) → WS-*

Quelques WS-*

• WS-Security

• WS-Policy

• WS-Trust

• WS-AtomicTransaction /WS-Transaction

• WS-Management

• WS-Coordination

• WS-Choreography

• WS-ReliableMessaging

• WS-Federation

• WS-BPEL

• WS-Addressing

• WS-MetadataExchange

• WS-Notification

• WS-Enventing

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 40 / 52

Page 41: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → REST

Partie I : Systèmes distribuésPlan

1 Architectures distribuées classiques

2 Services web (WS)

3 REST

4 ESB

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 41 / 52

Page 42: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → REST

REST

• Representational State Transfer (REST)

• Travaux de Roy Fielding (2000) [2]

• De plus en plus utilisé

• Simple !

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 42 / 52

Page 43: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → REST

Principes

• Identification : URIs

• Opérations (HTTP) : GET, PUT, POST, DELETE

• Contenu

• Représentation• Utilise le principe des « MIME types » dans l’en-tête HTTP

XML (application/xml), JSON (application-/json), ...

• Pas d’état (stateless)

• Chaque requête est auto-suffisante

• Orienté ressources

• Représentation = état courant de la ressource• Liens entre les ressources par hyperliens (href)

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 43 / 52

Page 44: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → REST

Exemples

Exemples

• Obtenir la liste des contactsGET /contacts

• Effacer Alice :DELETE /contacts/alice

• Ajouter un rendez-vous le 10 avril 2010 :POST /agenda/2010/04/10/

• Modifier le rendez-vous #35 :PUT /agenda/2010/04/10/35–OU–PUT /rendezvous/35

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 44 / 52

Page 45: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → REST

Exemple HTTP

RequêteGET /contact/alice HTTP/1.1Host : glo3001.ift.ulaval.caAccept : application/xml

• Opération : GET

• Ressource : /contact/alice

RéponseHTTP/1.1 200 OK...Content-Type : application/xml

<?xml version=’1’?><contact>

...Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 45 / 52

Page 46: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → REST

Extensibilité

Démonstration.

• On désire augmenter la flexibilité et l’extensibilité

• Quoi de plus extensible que le WWW

• Si REST est basé sur les principes du WWW

• Alors REST devrait être plus extensible...

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 46 / 52

Page 47: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → REST

REST vs RPCNoms VS verbes

RPC RESTgetContactList() GET /contactsgetContactData(56985) GET /contacts/56985

GET /contacts/alicegetContactsByfilter(letter=’A’,max=10)

GET /contacts/bylet-ter/a/ ?max=10

purgeAgendaByYear(2005)purgeAgendaByMonthAtYear(2005,10)

DELETE /agenda/2005/DELETE /agenda/2005/10/

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 47 / 52

Page 48: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → REST

REST vs RPCContre-exemples (PAS RESTful)

• /banque/deposerNON ! C’est un verbe !

• POST /banque<action>deposer</action>NON ! C’est du XML-RPC, SOAP, ... mais pas REST !

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 48 / 52

Page 49: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → ESB

Partie I : Systèmes distribuésPlan

1 Architectures distribuées classiques

2 Services web (WS)

3 REST

4 ESB

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 49 / 52

Page 50: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Architectures distribuées classiques Services web (WS) REST ESB

Partie I : Systèmes distribués → ESB

ESB

• Enterprise Service Bus (ESB)

• Intergiciel (middleware)

• « Message broker »

• Simplifie la communication entreservices hétérogènes

• Peut inclure :

• Routage• Événements• QoS• Sécurité• Gestion (journal, surveillance, ...)• Etc...

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 50 / 52

Page 51: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Partie I : Systèmes distribués → Annexe →

Références

[1] Russell Butek, Which style of WSDL should i use ?, Mai 2005.http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/.

[2] Roy Thomas Fielding. Architectural Styles and the Design of Network-basedSoftware Architectures.PhD thesis, University of California, Irvine, 2000.http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm.

[3] Nicolai M. Josuttis. Soa in Practice : The Art of Distributed System Design.O’Reilly Media, 1 edition, Août 2007.

[4] James McCarthy, Reap the benefits of document style web services, Juin2002.http://www.ibm.com/developerworks/webservices/library/ws-docstyle.html.

[5] W3C, XML schema part 0 : Primer second edition, Octobre 2004.http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/.

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 51 / 52

Page 52: Partie I : Systèmes distribuéslamontagne/glo3001/partie1-sysdistrib.pdf · 1 Le client obtient une référence sur un objet distant (remote object) 2 Le client appelle des méthodes

Partie I : Systèmes distribués → Annexe →

Références (suite)

[6] W3C, SOAP version 1.2 part 1 : Messaging framework (Second edition), Avril2007. http://www.w3.org/TR/soap12-part1/.

[7] W3C, Web services description language (WSDL) version 2.0 part 1 : Corelanguage, Juin 2007. http://www.w3.org/TR/wsdl20/.

[8] The Web Services-Interoperability Organization (WS-I), Basic profile - version1.0 (Final), Avril 2004.http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html.

Félix-Antoine Bourbonnais Architecture logicielle GLO-3001 Hiver 2010 52 / 52