Blog

Article: AJAX Web Services' Next Generation

Posted on

Preface

The content of this article is intended to be read in relation to the web services tutorials offered at arstectura.com with the primary goal of illustrating how to use javascript or PHP (and XSL) to place live data on any web page. Some of the opinions and data used in the article have been collected from many sources which are referenced below.

Introduction

The value of Web Services to the Internet, and specifically web applications, is hard to deny.

Bill Gates, in his memo, calls it “the next sea change” and notes that the Internet can “make software far more powerful by incorporating a services model.” ( 1 )

In technology, this rise in the importance of Web Services has triggered a move to AJAX and client-side development.

AJAX has rapidly become the presentation valve of choice for Web Services. Though Microsoft invented AJAX, short for Asynchronous JavaScript and XML, in the late 1990s and introduced it ( on the market ), it is companies like Google, Netflix and Yahoo! that are capitalizing on the technology today.

AJAX represents a new approach to webware development – a changing of the guard, or handing over of power, from the narrow sector of nigh-omnipotent systems engineers to Mr. & Mrs. Joe Programmer. Armed with only an Application Programming Interface (API) and an extremely accessible battery of technical documentation, the programming public now wields an infinately vast wealth of data to operate anything from a custom search engine to a social network to planetary observation posts at a whim, courtesy of an ever growing class of service providers.

How and why did this change happen? Basically, because of a growing shift among software vendors in their distribution methods from a product to a services model. This shift resulted in a decentralization of their code across the server/client interface allowing former end users to become 2ndtier programmers in the software lifecyle. In short, AJAX builds applications that run inside a Web browser but behave like client-based apps. When a page needs updating, the application uses XML to tell the Web server what it needs to update and JavaScript to process the response. The end result is a faster interface that allows for added functionality such as drag and drop.

Future Promise, but also challenges

AJAX is not without its challenges. After all, the J stands for JavaScript, which ( is ) described as “difficult to debug, difficult to deploy in large applications and convoluted.” And for AJAX to continue innovating, all Web browsers will have to ( innovate ).

“If you take any existing enterprise app… and lay AJAX on top, it requires a fair amount of reengineering on the server side as to how the application is actually built.”( 2 )

Robert Lepack, Vice President, Marketing, ICESoft Technologies

“AJAX also emphasizes complex, client-side coding, whereas the market focus in the last five years has been server-side work” ( 3 )

Brian Goldfarb, lead product manager, Web platform and tools, Microsoft.

The Connectivity Problem

One of the big limitations involved in consuming third party web services with AJAX is the difficulty in getting data straight to the browser. Cross-domain security restrictions prevent XMLHttpRequest (the cornerstone of AJAX) from being able to call up third-party URLs, and XML is too complex and tedious to parse using Javascript. In other words, you can’t easily call up Amazon’s or Google’s API from a web page on “tropicaltalent.com” without going through your own separate (proxy) server first.( 4 )

Immediate Solutions, XSLT…

Both Amazon and Google provide a free XSLT transformation service that enables the user to place live data (transformed via JSON (JavaScript Object Notation) output format) directly onto the browser web page using a little javascript code.

XSL (Extensible Stylesheet Language) is a language for transforming XML documents (into other documents/document types). Since the web services output from Amazon, Google & Yahoo! is essentially in XML, XSL is useful to transform those documents into stylized XML documents, plain text, HTML, or – for this tutorials’ purpose – javascript. It’s just text after all. Additionally, XSLT (XSL transformation) allows you to define not only the output, but the content-type of the output as well.

Conclusion

The examples in the web services tutorials show you not only how to use javascript (and a bit of XSL) to place live data on any web page, but also how to combine PHP for additional processing.

References

Some of the opinions and the data set out in the above article have been collected from external sources which are referenced below.


1 – 3 Web services, AJAX loom for developers.

4 Consuming Amazon’s Web API Directly with Javascript (via JSON and XSLT).