Wednesday 5 September 2007

AJAX & Web 2.0 Tutorial (Section 2) - Web Services




  1. Web Services are a way for disparate applications to work with each other over the web;
  2. In order for different applications to communicate with each other they need to agree on a protocol, webservices have three common protocols, JavaScript throws a fourth into the mix;
  3. REST - Simple request protocol, looks identical to a form being filled out, response is a basic XML document;
  4. XML-RPC - XML request-response protocol, format chosen is sub-optimal for parsing with DOM tools;
  5. SOAP - Heavy but well defined XML based request-response protocol;
  6. JSON - JavaScript Object Notation - information is passed back and forth in the JavaScript notation;
  7. Ditch SOAP & XML-RPC, (SOAP is too heavy for frequent small requests, XML-RPC is just ugly);
  8. REST - Light weight requests, some basic frameworks are available. Define your own response XML format;
  9. JSON - The JSON format is relatively lightweight but still ‘new’ enough that it’s not too widely supported (JSON support was added in PHP 5.2.0);
  10. It’s critical to remember that HTTP is a stateless protocol, every request must stand alone, independent of each other request. While technologies like sessions help can help when dealing with end users, they are inappropriate when using web services;
  11. When developing web services leverage and re-factor existing code, rather than duplicating;
  12. Objects are rather... different compared to other languages. Rather than defining a specific
    class, than instantiating instances of it, objects are created from functions that pull in their own required methods. This can be done on the fly, or by defining functions inside other functions.

No comments: