REST: Tying AJAX to the cloud

Martin elaborates further on how he sees 2010 as the year of AJAX and REST services

RELATED TOPICS
Page 2 of 2

In the past year or so, I've seen more and more RESTful services offered. I've also seen the connectivity emphasis in development systems that I like, such as Ruby on Rails, shift from XML Web services to RESTful services.

In the particular case of Alpha Five V10, calling a RESTful service boils down to writing a call to an HTTP function: the generic HTTP_FETCH() function, or specialized HTTP_GET(), HTTP_POST(), HTTP_PUT(), and HTTP_DELETE() functions. Building the URI and parameter strings is very straightforward using Alpha's Xbasic language, which has a strong set of string functions. Parsing the responses is also straightforward, even when they're in XML form. I typically package all of that as an Xbasic function.

Getting to the server to issue the REST call from an AJAX callback takes a few simple steps. First, tie an event to an AJAX callback: Alpha has a GUI to set that up, and you'd typically create a handler for a JavaScript onclick event. When configuring the handler, you can use a pre-built "Action JavaScript" AJAX callback routine, and set the function name in that callback's properties to the name of your Xbasic function. The hairiest part is parsing client grid variables to extract the required values from the current row to return to the server, but even that isn't hard once you've done it yourself a couple of times or copied the right code from a sample.

None of these things amounts to a magic bullet, but it does all hang together nicely. And I've managed to produce a fairly sophisticated application in a short amount of time.

If you'd like more information at a concrete step-by-step how-to level, a white paper of mine on using RESTful interfaces to create AJAX mashups with Alpha Five V10 is available for downloading.

This story, "REST: Tying AJAX to the cloud," was originally published at InfoWorld.com. Follow the latest news in software development at InfoWorld.com.

RELATED TOPICS
| 1 2 Page 2
From CIO: 8 Free Online Courses to Grow Your Tech Skills
View Comments
Join the discussion
Be the first to comment on this article. Our Commenting Policies