Web Services
 Chris McClelland
  DevDays, Belfast April 2009




      chris@ecliptic-design.com
About

Specialising in Mobile Strategy, Development,
Design and Usability.

New and rapidly developing company based in
Be...
Web Services?
WEB APP



                             “machine”
          API                 iPhone
                reque...
Why?
WEB APP




          API
                Outsource - community
                development

                Growth

...
Success Stories


            Google Maps
            Last.fm
            Ebay
            Facebook
            Twitter
iPhone Developers Why?


free content
large existing user-base
mashups
@stroughtonsmith
REST vs SOAP
SOAP
Simple Object Access Protocol




                       XML


                      SOAP


          XML to code and...
REST
REpresentational State Transfer
stateless
just HTTP + URIs

        HTTP verbs:
        GET: Retrieves a resource
   ...
SOAP
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<...
REST



GET www.example.org/user/2
methods        URI
               POST       /user/create
                GET      /user/show/1
NOT RESTful
              ...
SOAP
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version=quot;1.0quot;?>
...
REST
          http://api.flickr.com/services/rest/?
request   method=flickr.contacts.getList&api_key=XXX&api_sig=XXX



d...
REST - data received
       XML
       JSON
       RSS, Atom
 RSS




       PDF
       Other e.g. PNG, Microformats
SOAP - benefits

WS-*
offers options for Privacy,
Transfer, Eventing, Addressing,
Notification, ReliableMessaging
Mature
Ent...
REST Authentication
done via HTTPS

to avoid giving the application / developer your
username and password:



OAuth
“An o...
http://www.flickr.com/photos/factoryjoe/
http://www.flickr.com/photos/factoryjoe/
http://www.flickr.com/photos/factoryjoe/
REST - benefits
Simple
Popular, very Web 2.0
Better performance & scalability
Can be cached
Allows diverse formats e.g. JSO...
iPhone Libraries
HTTP - ASIHTTPRequest
XML, Microformats, RSS, Atom -
NSXMLParser, libxml
JSON - json-framework
Rails - Ob...
RESTful APIs
All Yahoo: flickr
myspace, virb, facebook
delicious
Amazon Web Services, SimpleDB
vimeo, youtube
ebay
google
Thanks!


   @chrismcclelland
chris@ecliptic-design.com
www.ecliptic-design.com
Upcoming SlideShare
Loading in …5
×

Web Services, for DevDays Belfast

1,975 views

Published on

Introduction to WebServices, Rest, SOAP, XML, iPhone

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,975
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
98
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Web Services, for DevDays Belfast

  1. 1. Web Services Chris McClelland DevDays, Belfast April 2009 chris@ecliptic-design.com
  2. 2. 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.
  3. 3. Web Services? WEB APP “machine” API iPhone reques t data
  4. 4. Why? WEB APP API Outsource - community development Growth Novel Use of Data
  5. 5. Success Stories Google Maps Last.fm Ebay Facebook Twitter
  6. 6. iPhone Developers Why? free content large existing user-base mashups
  7. 7. @stroughtonsmith
  8. 8. REST vs SOAP
  9. 9. SOAP Simple Object Access Protocol XML SOAP XML to code and to decode data SOAP to transport it
  10. 10. REST REpresentational State Transfer stateless just HTTP + URIs HTTP verbs: GET: Retrieves a resource POST: Sends data to create a resource PUT: Sends data to update a resource DELETE: Destroys a resource
  11. 11. SOAP POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version=quot;1.0quot;?> <soap:Envelope xmlns:soap=quot;http://www.w3.org/2001/12/soap-envelopequot; soap:encodingStyle=quot;http://www.w3.org/2001/12/soap- encodingquot;> <soap:Body xmlns:m=quot;http://www.example.org/stockquot;> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope> XML (Extensible Markup Language)
  12. 12. REST GET www.example.org/user/2
  13. 13. methods URI POST /user/create GET /user/show/1 NOT RESTful POST /user/update/1 POST/GET /user/delete/1 POST /user GET /user/1 RESTful PUT /user/1 DELETE /user/1
  14. 14. SOAP HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?xml version=quot;1.0quot;?> <soap:Envelope xmlns:soap=quot;http://www.w3.org/2001/12/soap-envelopequot; soap:encodingStyle=quot;http://www.w3.org/2001/12/soap- encodingquot;> <soap:Body xmlns:m=quot;http://www.example.org/stockquot;> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </soap:Body> </soap:Envelope>
  15. 15. REST http://api.flickr.com/services/rest/? request method=flickr.contacts.getList&api_key=XXX&api_sig=XXX data <contacts page=quot;1quot; pages=quot;1quot; perpage=quot;1000quot; total=quot;3quot;> <contact nsid=quot;12037949629@N01quot; username=quot;Ericquot; iconserver=quot;1quot; realname=quot;Eric Costelloquot; friend=quot;1quot; family=quot;0quot; ignored=quot;1quot; /> <contact nsid=quot;12037949631@N01quot; username=quot;nebquot; iconserver=quot;1quot; realname=quot;Ben Cervenyquot; friend=quot;0quot; family=quot;0quot; ignored=quot;0quot; /> <contact nsid=quot;41578656547@N01quot; username=quot;cal_abcquot; iconserver=quot;1quot; realname=quot;Cal Hendersonquot; friend=quot;1quot; family=quot;1quot; ignored=quot;0quot; /> </contacts>
  16. 16. REST - data received XML JSON RSS, Atom RSS PDF Other e.g. PNG, Microformats
  17. 17. SOAP - benefits WS-* offers options for Privacy, Transfer, Eventing, Addressing, Notification, ReliableMessaging Mature Enterprise
  18. 18. REST Authentication done via HTTPS to avoid giving the application / developer your username and password: OAuth “An open protocol to allow secure API authorisation in a simple and standard method from desktop and web applications.”
  19. 19. http://www.flickr.com/photos/factoryjoe/
  20. 20. http://www.flickr.com/photos/factoryjoe/
  21. 21. http://www.flickr.com/photos/factoryjoe/
  22. 22. 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
  23. 23. iPhone Libraries HTTP - ASIHTTPRequest XML, Microformats, RSS, Atom - NSXMLParser, libxml JSON - json-framework Rails - ObjectiveResource SOAP - wsdl2objc OAuth - MPOAuthConnection
  24. 24. RESTful APIs All Yahoo: flickr myspace, virb, facebook delicious Amazon Web Services, SimpleDB vimeo, youtube ebay google
  25. 25. Thanks! @chrismcclelland chris@ecliptic-design.com www.ecliptic-design.com

×