• Aucun résultat trouvé

Web Services

N/A
N/A
Protected

Academic year: 2022

Partager "Web Services"

Copied!
24
0
0

Texte intégral

(1)

7/12/2005

Web Services

Introduction à l’aide d’un exemple

Urs Richle

(2)

Problématique

Linux Windows

Data MySQL

Data Postgre

SQL Data Oracle

Data Access

Mac

ASP PHP Java Applet JSP Servlet

...

HTML XHTM CSS XML SVG XTM

...

Réponse Requête

IIS Apache Tomcat

...

(3)

Problématique

Apache

Workstation

IIS MySQL

Access

Tomcat

Postgres SQL

(4)

Problématique: comment interagir?

Service Provider

Data

Service Provider

Server

Data

Service Provider

Server Data

Service Provider

Server

Server Data

Service Provider

Servers

Data Data

Service Provider

Server

Data

Server

Workstation

Workstation

Laptop

ASP PHP

JAVA

Python

C++

MySQL Oracle

PostgreSQL Access

BD-XML VB

Oracle

(5)

Web Services

„

Définition:

… « Web Services are software applications that can be discovered, described, and accessed based on XML and standard Web protocols over intranets, extranets, and the Internet. »

Michael C. Daconta, Leo J. Obrst, Kevin T. Smith dans: THE SEMANTIC WEB, Wiley, Indianapolis, 2003

„

But:

… Permettre l’interopérabilité entre des applications diverses.

(6)

Les 3 rôles d’un Web Service

UDDI

Universal Description, Discovery and Integration

WSDL

Web Services

Description Language

Schéma adapté de: Web Services – Conceptual Architecture (WSCA 1.0), IBM

(7)

Architecture du Web Service

Workstation ou serveur

Application Client

Web Service

WSDL Réponse Requette UDDI Registre

Serveur

Protocole

(8)

Architecture du Web Service

Workstation ou serveur

Application Client

Web Service

WSDL

(XML)

Réponse Requette UDDI

(XML) Registre

Serveur

SOAP

(XML)

SOAP: Simple Object Access Protocol

(9)

Les différentes normes de base

„ Annuaire / Publication – basé sur XML

„ Description des méthodes – basé sur XML

„ Échange

„ – basé sur XML

„ Protocole de transfert

„ Protocole de transport

WSDL UDDI

SOAP

HTTP, SMTP, FTP, … TCP/IP

(10)

UDDI – les pages jaunes

„ www.uddi.org

„ http://www.xmethods.com/

„ http://uddi.microsoft.com/default.aspx

„ http://www.bindingpoint.com

(11)

WSDL – description des méthodes

„

Une description exacte du Web Service par

…

les méthodes avec les types de paramètres requises

…

les réponses avec les types de paramètres renvoyés

„

Basé sur XML

„

3 parties principales:

…

description des messages

…

description des types de données échangées

…

description des conventions pour la procédure de

l’échange

(12)

SOAP – les messages

„

Protocole pour l’échange des données

„

Basé sur XML

„

Utilise HTTP ou autre protocole (SMTP, FTP …)

„

Combinaison la plus fréquente:

…

Æ HTTP – TCP/IP

„

Va être remplacé par le standard XML Protocol

http://www.w3.org/2000/xp/Group/

(13)

Web Serices tool-kits

„ Java

… Axis – http://ws.apache.org/axis/

… JDeveloper – http://www.oracle.com/technology/software/products/jdev

„ PHP

… NuSOAP – http://sourceforge.net/projects/nusoap/

„ ASP

…

MS .Net (Visual Studio) – http://www.microsoft.com/net/default.mspx

(14)

Exemple

Application PHP

ASP JSP Servlet

SOAP- client Application

Visualisation

Serveur ou PC

Browser / Interface

Client

HTTP

SOAP- requête

SOAP- réponse

WSDL

MediaWiki

Extension Extraction

des lines NuSOAP

SOAP- serveur

Serveur Apache

Tecfa MediaWiki-Web Service avec NuSOAP:

http://tecfax.unige.ch/portails/mediawiki/extensions/WebService/

La librairie PHP NuSOAP: http://sourceforge.net/projects/nusoap/

(15)

Tecfa MediaWiki-Web Service

Le Web Service propose 3 méthodes (services):

„

getTopicNames()

… Cette méthode retourne tous les topics existants dans la plateforme MediaWiki(articles, catégories, auteurs, images).

… Retourne un tableau: array(topicTypeName => array(array(name, url)))

„

getTopicLinkage($term)

… Cette méthode retourne tous les différents liens pour un topic donné, et quelques informatins sur le topic lui-même.

… Retourne un tableau: array (name, type, numberOfLinksToThisTopic, URL, array with all links from this topic to other topics (each link is an array(name, type, url))

„

getTopicMap()

… Cette méthode retourne le contenu sémantique du MediaWiki en forme d’un topic map. Il s’agit d’un fichier XML respectant la DTD du standard ISO 13250 TopicMaps

… Retourne un string: le fichier XTM

(16)

Le côté serveur du MediaWiki WS

„ Le fichier « serveur »

… http://tecfax.unige.ch/portails/mediawiki/exten sions/WebService/index.php

„ Le fichier WSDL

… http://tecfax.unige.ch/portails/mediawiki/exten

sions/WebService/index.php?wsdl

(17)

Deux exemples de WS-Clients

Cluster

SOAP WSDL SOAP

MediaWiki

Extraction

NuSOAP

MySQL Serveur-Apache

NuSOAP Test.

php

Java Application

JRE Test.

class

JAVA

PHP XML PHP

(18)

Exemples de Web Service-Clients

„ WS-Client avec NuSOAP

… http://tecfax.unige.ch/portails/mediawiki/extensions/WebService_CLIENT/

„ WS-Client en Java

… Création des fichiers de base avec

JDeveloper (Démo)

(19)

SOAP – la requête

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

<SOAP-ENV:Envelope SOAP-

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

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"

xmlns:si="http://soapinterop.org/xsd"

xmlns:tns="urn:MediaWikiTopicMap_wsdl">

<SOAP-ENV:Body>

<tns:getTopicLinkage xmlns:tns="urn:MediaWikiTopicMap_wsdl">

<term xsi:type="tns:Term">

<term xsi:type="xsd:string">Accueil</term>

</term>

</tns:getTopicLinkage>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

(20)

SOAP – la réponse

<?xml version="1.0" encoding="ISO-8859-1"?>

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle….

xmlns:tns="urn:MediaWikiTopicMap_wsdl">

<SOAP-ENV:Body>

<ns1:getTopicLinkageResponse

xmlns:ns1="urn:MediaWikiTopicMap_wsdl">

<return xsi:type="tns:TopicLinkage">

<topicName xsi:type="xsd:string">Accueil</topicName>

<type xsi:type="xsd:string">ArticleTopic</type>

<numLinksTo xsi:type="xsd:int">0</numLinksTo>

<url

xsi:type="xsd:string">http://tecfaX.unige.ch/portails/mediawiki/index.php/Accu eil</url>

<links xsi:type="SOAP-ENC:Array" SOAP- ENC:arrayType="tns:link[21]">

<item xsi:type="tns:link">

<name xsi:type="xsd:string">ToDoList</name>

<type xsi:type="xsd:string">existingArticle</type>

<url

xsi:type="xsd:string">http://tecfaX.unige.ch/portails/mediawiki/index.php /ToDoList</url>

</item> …

(21)

Évaluation

„

Avantages

… Interopérabilité entre des systèmes d’information divers

… Accès aux informations de manière dynamique

… Standards « open source » (pas de charges)

„

Désavantages

… Multiplication de la masse d’informations véhiculée

… Surcharge de traitements (facteur 25 pour les requêtes – facteurs 500 pour les réponses)

… Sécurité encore discutable

(22)

Autres exemples (Démo)

„

WS-Client en Java qui consomme le Web Service de ViaMichelin

… http://ws.viamichelin.com/wswebsite/gbr/jsp/hme/MaHomePage.jsp

„

WS-Client en PHP (NuSOAP) qui consomme un Web Service de

…

http://www.xmethods.com

„ traducteur anglais-bulgare:

http://www.xmethods.com/ve2/ViewListing.po?key=uuid:093D2207-3ADE-56A7-A171-8447C6F12D5F

(23)

Sources et informations

„ Web Services spécifications:

http://www.w3.org/2002/ws/

„ WSDL spécifications:

http://www.w3.org/TR/wsdl

„ UDDI spécifications:

http://www.uddi.org/

„ SOAP:

http://www.w3.org/TR/soap/

„ XML Protocol:

http://www.w3.org/2000/xp/Group/

„ Une introduction

http://www-306.ibm.com/software/solutions/webservices/pdf/WSCA.pdf

„ Une brève description:

http://en.wikipedia.org/wiki/Web_service

„ http://www.gotdotnet.com/team/XMLwebservices/gxa_overview.aspx

„ MSDN Library:

http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebsrv/html/webservbasics.asp

„ Web Services avec NuSphere:

http://www.nusphere.com/products/library/webservices_whitep_012502.pdf

„ Exemple:

Un exemple d’un client avec NuSOAP: http://tecfax.unige.ch/portails/mediawiki/extensions/WebService_CLIENT/

„ Livres:

Michael C. Daconta, Leo J. Obrst, Kevin T. Smith dans: THE SEMANTIC WEB, Wiley, Indianapolis, 2003

(24)

Pour tester (sur le serveur de Tecfa) :

„ Créer un nouveau « Favori réseau »

… Ouvrir « Favoris réseau »

… « Ajouter un Favoris réseau »

… Choisir « site web »

… donner l’adresse suivante:

„ http://tecfax.unige.ch/formcont/xml05/

… NU: formcont – MP:

… Retourner dans « Favoris réseau »

„ Installer NuSOAP

… Créer un nouveau dossier avec votre nom

… Copier « Basic_WSClient » dans votre dossier

„ Définir le WS-Client

… Ouvrir le fichier « proxy_WS_Client.php » en local (attention: ne pas reprendre le fichier du serveur! Prendre le fichier sur:

http://tecfax.unige.ch/portails/mediawiki/extensions/WebService_CLIENT/proxy_basicWS_Cl ient.phps )

… Changer l’adresse du fichier WSDL

… Changer le nom de la méthode et mettre des paramètres éventuels

… Ouvrir un browser et aller sur l’adresse suivante:

„ http://tecfax.unige.ch/formcont/xml05/

… Choisir votre dossier et aller dans le dossier NuSOAP – ouvrir le fichier de votre WS-Client - le résultat de votre Web Service-Client s’affiche.

Références

Documents relatifs

Microfibrillated cellulose is currently extracted from a number of different cellulose sources. Since wood is the most important industrial source of cellulosic fibers, it is thus

The cytotoxicity of these complexes was increased substantially upon 365 nm light irradiation, which suggested the high potential to be mitochondria-targeting theranostic

Erire une fontion strCompare qui prend en param etre deux ha^ nes de arat eres s1..

Dénir int* tabFitness dans le main, qui recupère les valeurs calculées dans

An association of MGMT gene promoter methylation and the benefit from alkylating chemotherapy was investigated within the randomized pivotal European Organisation of Research

 RECREATIONS : vous ne pouvez pas utiliser les bancs, vous devez respecter des distances entre vous (les contacts physiques seront impossibles/ groupes de 4 max).. 

Le séisme de 2003, l’amnésie d’Amina, le recours à la bibliothèque-monde avec les nombreux mythes, ne sont qu’un prétexte pour traiter de la mémoire individuelle

- Je n’avais pas réfléchi à cet artéfact lors de notre vie à deux… C’est bien plus tard, à l’aune d’une problématique face à un challengeur mage… Une