Web Services, for DevDays Belfast
-
Upload
chrismcclelland -
Category
Technology
-
view
1.632 -
download
1
description
Transcript of Web Services, for DevDays Belfast
![Page 1: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/1.jpg)
Web ServicesChris McClelland
DevDays, Belfast April 2009
![Page 2: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/2.jpg)
About
Specialising in Mobile Strategy, Development, Design and Usability.
New and rapidly developing company based in Belfast, presently 4 people, but more to come!
Established Jan 2009.
![Page 3: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/3.jpg)
WEB APP
APIrequest
data
Web Services?
iPhone
“machine”
![Page 4: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/4.jpg)
WEB APP
API
Why?
Outsource - community development
Growth
Novel Use of Data
![Page 5: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/5.jpg)
Google Maps
Success Stories
Last.fm
Ebay
![Page 6: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/6.jpg)
iPhone Developers Why?
free content
large existing user-base
mashups
![Page 7: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/7.jpg)
@stroughtonsmith
![Page 8: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/8.jpg)
REST vs SOAP
![Page 9: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/9.jpg)
SOAP
SOAPSimple Object Access Protocol
XML
XML to code and to decode dataSOAP to transport it
![Page 10: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/10.jpg)
RESTREpresentational State Transfer
HTTP verbs:
GET: Retrieves a resource
POST: Sends data to create a resource
PUT: Sends data to update a resource
DELETE: Destroys a resource
stateless
just HTTP + URIs
![Page 11: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/11.jpg)
SOAPPOST /InStock HTTP/1.1Host: www.example.orgContent-Type: application/soap+xml; charset=utf-8Content-Length: nnn
<?xml version="1.0"?><soap:Envelopexmlns: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>
XML (Extensible Markup Language)
![Page 12: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/12.jpg)
REST
GET www.example.org/user/2
![Page 13: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/13.jpg)
POST /user
GET /user/1
PUT /user/1
DELETE /user/1
RESTful
POST /user/create
GET /user/show/1
POST /user/update/1
POST/GET /user/delete/1
NOT RESTful
methods URI
![Page 14: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/14.jpg)
SOAPHTTP/1.1 200 OKContent-Type: application/soap+xml; charset=utf-8Content-Length: nnn
<?xml version="1.0"?><soap:Envelopexmlns: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>
![Page 15: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/15.jpg)
REST
<contacts page="1" pages="1" perpage="1000" total="3"> <contact nsid="12037949629@N01"
username="Eric" iconserver="1"realname="Eric Costello"friend="1" family="0" ignored="1" />
<contact nsid="12037949631@N01" username="neb" iconserver="1"realname="Ben Cerveny"friend="0" family="0" ignored="0" />
<contact nsid="41578656547@N01" username="cal_abc" iconserver="1"realname="Cal Henderson"friend="1" family="1" ignored="0" />
</contacts>
http://api.flickr.com/services/rest/?method=flickr.contacts.getList&api_key=XXX&api_sig=XXX
request
data
![Page 16: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/16.jpg)
XML
JSON
RSS, Atom
Other e.g. PNG, Microformats
REST - data received
RSS
![Page 17: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/17.jpg)
SOAP - benefits
WS-*
offers options for Privacy, Transfer, Eventing, Addressing, Notification, ReliableMessaging
Mature
Enterprise
![Page 18: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/18.jpg)
REST Authentication
OAuth“An open protocol to allow secure API authorisation in a simple and standard method from desktop and web applications.”
done via HTTPS
to avoid giving the application / developer your username and password:
![Page 19: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/19.jpg)
http://www.flickr.com/photos/factoryjoe/
![Page 20: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/20.jpg)
http://www.flickr.com/photos/factoryjoe/
![Page 21: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/21.jpg)
http://www.flickr.com/photos/factoryjoe/
![Page 22: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/22.jpg)
REST - benefits
Simple
Popular, very Web 2.0
Better performance & scalability
Can be cached
Allows diverse formats e.g. JSON
Built into many web frameworks
Easier in Objective-C
![Page 23: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/23.jpg)
HTTP - ASIHTTPRequest
XML, Microformats, RSS, Atom - NSXMLParser, libxml
JSON - json-framework
Rails - ObjectiveResource
SOAP - wsdl2objc
OAuth - MPOAuthConnection
iPhone Libraries
![Page 24: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/24.jpg)
All Yahoo: flickr
myspace, virb, facebook
delicious
Amazon Web Services, SimpleDB
vimeo, youtube
ebay
RESTful APIs
![Page 25: Web Services, for DevDays Belfast](https://reader034.fdocuments.in/reader034/viewer/2022051412/54b795754a79591d4a8b46dd/html5/thumbnails/25.jpg)
Thanks!
@chrismcclelland
www.ecliptic-design.com