SlideShare une entreprise Scribd logo
1 sur 21
Web Services Par l'exemple
avec Ruby
Christian Kakesa
MOE/Ingénieur SI, RATP
2 sur 21
Web Service par l'exemple
RESTons Simple
3 sur 21
Sommaire
Nous allons voir :
#webdayesgi
Qu'est-ce qu'un service web ?
Soap, qu'est-ce que c'est ?
REST, qu'est-ce que c'est ?
XML or JSON ?
Live coding : Implémenter un serveur de blagues avec Ruby
Échange sur la sécurisation d'un service web
·
·
·
·
·
·
4 sur 21
Web Service par l'exemple
Qu'est-ce qu'un service web
5 sur 21
Web Service par l'exemple
Qu'est-ce qu'un service web ?
#webdayesgi
Échange de données inter-application
Communication synchrone ou asynchrone
Usage des normes et protocoles ouverts (standards web)
·
·
·
6 sur 21
Web Service par l'exemple
Soap, qu'est-ce que c'est ?
7 sur 21
Web Service par l'exemple
Soap, qu'est-ce que c'est ?
#webdayesgi
SOAP pour Simple Object Access Protocol
Technologie ouverte basée sur XML : Envelope - Header - Body - Error
Norme de description en WSDL (Web Service Description Language)
Notion d'annuaire des services web avec UDDI (Universal Discovery
Description and Integration)
·
·
·
·
8 sur 21
Structure d'un message SOAP
#webdayesgi
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
...
</soap:Header>
<soap:Body>
...
<soap:Fault>
...
</soap:Fault>
</soap:Body>
</soap:Envelope>
9 sur 21
Une requête SOAP
#webdayesgi
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
10 sur 21
Une réponse SOAP
#webdayesgi
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>
</soap:Body>
</soap:Envelope>
11 sur 21
Web Service par l'exemple
REST, qu'est-ce que c'est ?
12 sur 21
Web Service par l'exemple
REST, qu'est-ce que c'est ?
#webdayesgi
REST pour Representational State Transfer
Envoi et reception de message entre client et serveur
Représentation sous forme de ressource. Ex. : un Utilisateur est représenté
en JSON ou XML
S'appuie sur le protocole HTTP (Interface HTTP) : codes HTTP, methodes HTTP,
etc.
·
·
·
·
13 sur 21
Web Service par l'exemple
XML vs JSON
14 sur 21
XML or JSON ?
XML JSON
Verbosity More Less
Complexity More Less
Validty DTDs and XSDs widely used JSON Schema not widely used
Prog. Interface
Clunky
Impedence mismatch
More direct
Querying
XPath
XQuery
XSLT
JSON Path
JSON Query
JAQL
#webdayesgi
source: Coursera, cours de Jennifer Widom (Relational algebra)
15 sur 21
Web Service par l'exemple
Live coding : Implémenter un serveur de blagues avec Ruby
16 sur 21
Live coding
Ruby & Sinatra (DSL)
#webdayesgi
Ruby : https://www.ruby-lang.org
Sinatra : http://www.sinatrarb.com
·
·
17 sur 21
Web Service par l'exemple
Échange sur la sécurisation d'un service web
18 sur 21
Échange sur la sécurisation d'un service web
#webdayesgi
TLS (SSL) : Transport Layer Security (Secure Sockets Layer)
CSRF (Cross-Site Request Forgery)
CORS (Cross-origin resource sharing)
Authentification : apiKey - login/mot de passe - Oauth - etc.
·
·
·
·
19 sur 21
<Merci !>
/me
g+ kiq.li/4eZ
twitter @christiankakesa
www www.kakesa.net
github github.com/fenicks
20 sur 21
21 sur 21

Contenu connexe

PPTX
ลอยกระทง
MademoiselleFai
 
PDF
Scumblr, quick presentation
Christian KAKESA
 
PDF
S51 vos projets web services ibm i a l aide de php
Gautier DUMAS
 
PDF
.NET DotNet CF - 3
Riadh Tebourbi (Ai1990)
 
PPTX
programmation web.pptx
mahamatismaelabdelke
 
PDF
Ter Web Service Intro
Riadh Tebourbi (Ai1990)
 
PDF
intro-ws.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
HINDGUENDOUZ
 
PDF
les servlets-java EE
Yassine Badri
 
ลอยกระทง
MademoiselleFai
 
Scumblr, quick presentation
Christian KAKESA
 
S51 vos projets web services ibm i a l aide de php
Gautier DUMAS
 
.NET DotNet CF - 3
Riadh Tebourbi (Ai1990)
 
programmation web.pptx
mahamatismaelabdelke
 
Ter Web Service Intro
Riadh Tebourbi (Ai1990)
 
intro-ws.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
HINDGUENDOUZ
 
les servlets-java EE
Yassine Badri
 

Similaire à Web services par l'exemple avec ruby (20)

PPT
Présentation SOA
Cynapsys It Hotspot
 
PDF
Architectures orientées services
Donia Hammami
 
PPT
Web Services
Gregory Renard
 
PPTX
Chap1 p1-introduction
Moez Re
 
PDF
webservicesfhjtrddktkddflfddddddyuldydulyulfyul_RESTU.pdf
KHALIDBENABBES1
 
PDF
sqcq<svdsdvezsfvkjezbkjfb ckjhs;dvbqcjkhbazvuyaz.pdf
KHALIDBENABBES1
 
PDF
2 20 presentations_generales_des_web_services
Camus LANMADOUCELO
 
PDF
R109-slides introduction aux technologie web.pdf
CheickBDiallo1
 
PDF
Introduction aux technologies Web BUT R&T – S1 – Cours R109
CheickBDiallo1
 
PPTX
courwebwebewcourwebwebewcourwebwebewcourwebwebew.pptx
lacinekabre1
 
PPTX
Axis2 services fr
Ben Abdallah Helmi
 
PPT
Le WSDL (Web Services Description Language) est un langage de description bas...
diopissaseydina
 
PDF
WebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
HINDGUENDOUZ
 
PDF
Support Web Services SOAP et RESTful Mr YOUSSFI
ENSET, Université Hassan II Casablanca
 
PDF
Introduction au développement Web
Romain Willmann
 
PDF
Do you speak technique ?
JEAN-GUILLAUME DUJARDIN
 
PDF
Services web soap-el-habib-nfaoui
El Habib NFAOUI
 
PDF
Middleware Services Web, mode de fonctionnement et utilisation.pdf
AbdramaneIssaOumar
 
PPTX
WEB SERVICE SOAP, JAVA, XML, JAXWS
Lhouceine OUHAMZA
 
PDF
0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
hindguendouz2000
 
Présentation SOA
Cynapsys It Hotspot
 
Architectures orientées services
Donia Hammami
 
Web Services
Gregory Renard
 
Chap1 p1-introduction
Moez Re
 
webservicesfhjtrddktkddflfddddddyuldydulyulfyul_RESTU.pdf
KHALIDBENABBES1
 
sqcq<svdsdvezsfvkjezbkjfb ckjhs;dvbqcjkhbazvuyaz.pdf
KHALIDBENABBES1
 
2 20 presentations_generales_des_web_services
Camus LANMADOUCELO
 
R109-slides introduction aux technologie web.pdf
CheickBDiallo1
 
Introduction aux technologies Web BUT R&T – S1 – Cours R109
CheickBDiallo1
 
courwebwebewcourwebwebewcourwebwebewcourwebwebew.pptx
lacinekabre1
 
Axis2 services fr
Ben Abdallah Helmi
 
Le WSDL (Web Services Description Language) est un langage de description bas...
diopissaseydina
 
WebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
HINDGUENDOUZ
 
Support Web Services SOAP et RESTful Mr YOUSSFI
ENSET, Université Hassan II Casablanca
 
Introduction au développement Web
Romain Willmann
 
Do you speak technique ?
JEAN-GUILLAUME DUJARDIN
 
Services web soap-el-habib-nfaoui
El Habib NFAOUI
 
Middleware Services Web, mode de fonctionnement et utilisation.pdf
AbdramaneIssaOumar
 
WEB SERVICE SOAP, JAVA, XML, JAXWS
Lhouceine OUHAMZA
 
0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
hindguendouz2000
 
Publicité

Web services par l'exemple avec ruby

  • 2. Web Services Par l'exemple avec Ruby Christian Kakesa MOE/Ingénieur SI, RATP 2 sur 21
  • 3. Web Service par l'exemple RESTons Simple 3 sur 21
  • 4. Sommaire Nous allons voir : #webdayesgi Qu'est-ce qu'un service web ? Soap, qu'est-ce que c'est ? REST, qu'est-ce que c'est ? XML or JSON ? Live coding : Implémenter un serveur de blagues avec Ruby Échange sur la sécurisation d'un service web · · · · · · 4 sur 21
  • 5. Web Service par l'exemple Qu'est-ce qu'un service web 5 sur 21
  • 6. Web Service par l'exemple Qu'est-ce qu'un service web ? #webdayesgi Échange de données inter-application Communication synchrone ou asynchrone Usage des normes et protocoles ouverts (standards web) · · · 6 sur 21
  • 7. Web Service par l'exemple Soap, qu'est-ce que c'est ? 7 sur 21
  • 8. Web Service par l'exemple Soap, qu'est-ce que c'est ? #webdayesgi SOAP pour Simple Object Access Protocol Technologie ouverte basée sur XML : Envelope - Header - Body - Error Norme de description en WSDL (Web Service Description Language) Notion d'annuaire des services web avec UDDI (Universal Discovery Description and Integration) · · · · 8 sur 21
  • 9. Structure d'un message SOAP #webdayesgi <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Header> ... </soap:Header> <soap:Body> ... <soap:Fault> ... </soap:Fault> </soap:Body> </soap:Envelope> 9 sur 21
  • 10. Une requête SOAP #webdayesgi <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope> 10 sur 21
  • 11. Une réponse SOAP #webdayesgi <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </soap:Body> </soap:Envelope> 11 sur 21
  • 12. Web Service par l'exemple REST, qu'est-ce que c'est ? 12 sur 21
  • 13. Web Service par l'exemple REST, qu'est-ce que c'est ? #webdayesgi REST pour Representational State Transfer Envoi et reception de message entre client et serveur Représentation sous forme de ressource. Ex. : un Utilisateur est représenté en JSON ou XML S'appuie sur le protocole HTTP (Interface HTTP) : codes HTTP, methodes HTTP, etc. · · · · 13 sur 21
  • 14. Web Service par l'exemple XML vs JSON 14 sur 21
  • 15. XML or JSON ? XML JSON Verbosity More Less Complexity More Less Validty DTDs and XSDs widely used JSON Schema not widely used Prog. Interface Clunky Impedence mismatch More direct Querying XPath XQuery XSLT JSON Path JSON Query JAQL #webdayesgi source: Coursera, cours de Jennifer Widom (Relational algebra) 15 sur 21
  • 16. Web Service par l'exemple Live coding : Implémenter un serveur de blagues avec Ruby 16 sur 21
  • 17. Live coding Ruby & Sinatra (DSL) #webdayesgi Ruby : https://www.ruby-lang.org Sinatra : http://www.sinatrarb.com · · 17 sur 21
  • 18. Web Service par l'exemple Échange sur la sécurisation d'un service web 18 sur 21
  • 19. Échange sur la sécurisation d'un service web #webdayesgi TLS (SSL) : Transport Layer Security (Secure Sockets Layer) CSRF (Cross-Site Request Forgery) CORS (Cross-origin resource sharing) Authentification : apiKey - login/mot de passe - Oauth - etc. · · · · 19 sur 21
  • 20. <Merci !> /me g+ kiq.li/4eZ twitter @christiankakesa www www.kakesa.net github github.com/fenicks 20 sur 21