SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
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

Similaire à Web services par l'exemple avec ruby

Architectures orientées services
Architectures orientées servicesArchitectures orientées services
Architectures orientées servicesDonia Hammami
 
Chap1 p1-introduction
Chap1 p1-introductionChap1 p1-introduction
Chap1 p1-introductionMoez Re
 
2 20 presentations_generales_des_web_services
2 20 presentations_generales_des_web_services2 20 presentations_generales_des_web_services
2 20 presentations_generales_des_web_servicesCamus LANMADOUCELO
 
WebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
WebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbWebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
WebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbHINDGUENDOUZ
 
Introduction au développement Web
Introduction au développement Web Introduction au développement Web
Introduction au développement Web Romain Willmann
 
Services web soap-el-habib-nfaoui
Services web soap-el-habib-nfaouiServices web soap-el-habib-nfaoui
Services web soap-el-habib-nfaouiEl Habib NFAOUI
 
WEB SERVICE SOAP, JAVA, XML, JAXWS
WEB SERVICE SOAP, JAVA, XML, JAXWSWEB SERVICE SOAP, JAVA, XML, JAXWS
WEB SERVICE SOAP, JAVA, XML, JAXWSLhouceine OUHAMZA
 
0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbhindguendouz2000
 
20140130 mug lyon - post-mortem d'une application métier
20140130   mug lyon - post-mortem d'une application métier20140130   mug lyon - post-mortem d'une application métier
20140130 mug lyon - post-mortem d'une application métierMatthieu DUFOURNEAUD
 
Chp4 - Composition, Orchestration et Choregraphie de services
Chp4 - Composition, Orchestration et Choregraphie de servicesChp4 - Composition, Orchestration et Choregraphie de services
Chp4 - Composition, Orchestration et Choregraphie de servicesLilia Sfaxi
 
Chp3 - Les Services Web
Chp3 - Les Services WebChp3 - Les Services Web
Chp3 - Les Services WebLilia Sfaxi
 

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

Architectures orientées services
Architectures orientées servicesArchitectures orientées services
Architectures orientées services
 
Web Services
Web ServicesWeb Services
Web Services
 
Chap1 p1-introduction
Chap1 p1-introductionChap1 p1-introduction
Chap1 p1-introduction
 
2 20 presentations_generales_des_web_services
2 20 presentations_generales_des_web_services2 20 presentations_generales_des_web_services
2 20 presentations_generales_des_web_services
 
Axis2 services fr
Axis2 services frAxis2 services fr
Axis2 services fr
 
WebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
WebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbWebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
WebServices.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
 
Support Web Services SOAP et RESTful Mr YOUSSFI
Support Web Services SOAP et RESTful Mr YOUSSFISupport Web Services SOAP et RESTful Mr YOUSSFI
Support Web Services SOAP et RESTful Mr YOUSSFI
 
Introduction au développement Web
Introduction au développement Web Introduction au développement Web
Introduction au développement Web
 
Do you speak technique ?
Do you speak technique ?Do you speak technique ?
Do you speak technique ?
 
Services web soap-el-habib-nfaoui
Services web soap-el-habib-nfaouiServices web soap-el-habib-nfaoui
Services web soap-el-habib-nfaoui
 
WEB SERVICE SOAP, JAVA, XML, JAXWS
WEB SERVICE SOAP, JAVA, XML, JAXWSWEB SERVICE SOAP, JAVA, XML, JAXWS
WEB SERVICE SOAP, JAVA, XML, JAXWS
 
0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
0570-les-services-web.pdfbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
 
20140130 mug lyon - post-mortem d'une application métier
20140130   mug lyon - post-mortem d'une application métier20140130   mug lyon - post-mortem d'une application métier
20140130 mug lyon - post-mortem d'une application métier
 
Chp4 - Composition, Orchestration et Choregraphie de services
Chp4 - Composition, Orchestration et Choregraphie de servicesChp4 - Composition, Orchestration et Choregraphie de services
Chp4 - Composition, Orchestration et Choregraphie de services
 
Chp3 - Les Services Web
Chp3 - Les Services WebChp3 - Les Services Web
Chp3 - Les Services Web
 
Web services SOAP et REST
Web services  SOAP et RESTWeb services  SOAP et REST
Web services SOAP et REST
 

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