Thursday, July 26, 2007

OSCON: Ajax and Web Services

I'm in Mark Pruett's talk on Ajax and Web Services. He's defining an Ajax application as a web service client that runs inside a web browser, and he's going to be talking about both REST and SOAP services.


Mark Pruett's talk on Ajax and Web Services

Mark argues that people go through an evolutionary path in the way they use Ajax, they start off sending back a chunk of HTML, they move on to sending back delimited text, then XML and finally some people move to JSON.

There a bunch of client side Ajax toolkits: prototype, Dojo, GWT (Google), Atlas (Microsoft), Rico, Zimbra, DWR. Some of these, like GWT and DWR are tightly coupled with the server side language. You probably want to pick a toolkit that doesn't do that...

Update: He's talking about the whole SOAP vs REST debate, and arguing that externally you should expose your services via REST, but internally SOAP might be more appropriate, or at least more frequently used. Which isn't necessarily the same thing.

Update: REST uses GET, PUT, POST and DELETE. Where GET will get data, a PUT will create a new resource, POST will update an existing resource and DELETE will delete an existing service. Although of course there are certain limitations to GET which means that you sometimes have to use POST anyway.

Update: He's just totally dismissed synchronous REST requests, arguing that you should always use asynchronous requests. Which seems like a lot of overhead for simpler services. Although he's also arguing that you shouldn't bother with XML, but you should be using JSON instead, which means you can do this,

var my_json;
my_json = eval ("(" + http_request.respinseText + ")");

which I think is probably officially evil.

Update: He's moving on to talk about the cross-domain problems. This is something we've all run into before, because of course you can only do Ajax calls to the server that delivered the original page. One way around this, which actually hadn't occurred to me before, is to use Apache ProxyPass rules and redirect calls to other servers transparently to your client side Javascript.

No comments:

Post a Comment