Bringing Interactivity to SOA and Web Services Using AJAX
AJAX programming techniques have recently created a lot of hype with their robustness
Jun. 9, 2006 01:15 PM
Web-based applications have been used widely and are quite popular - from booking tickets to checking e-mail, they are all Web-based. As the popularity of and demand for Web-based applications has grown, users expectations have also grown.
Users want their Web interfaces to be robust and they want instantaneous reactions. The present Web-based applications are typically client/server-based applications with a thin JSP/HTML client. The user has to wait for the response from the server since all the processing is done on the server side. The biggest drawback in Web-based applications is that the response time and waiting period is long. After sending the request, the client has to wait for the processing and subsequent response from the server. This major drawback can be solved by using Rich Internet Applications.
What Are Rich Internet Applications?
RIAs provide a faster response by taking advantage of a client's CPU. This richer functionality may include anything that can be implemented in the system that's being used on the client side including using a slider to change data, calculations that happen on the client, drag-and-drop features, and those things that don't need to be sent back to the server.
There are also performance benefits; for example, the resources that both the client and server handle are almost equal, thus freeing server resources and allowing the same hardware to handle more sessions concurrently. The traffic within the network decreases since the client knows exactly what it needs to send to the server side. Thus, it takes less time to transfer any single request or response for two reasons: they are smaller and the overall network load is lower.
Overview of AJAX
AJAX isn't a technology; it's a mixture of several technologies.
Constituents of AJAX
A typical Web application model works as shown in Figure 1. Almost every user action in the interface triggers an HTTP request back to a Web server. The server does some processing - retrieving data, talking to various legacy systems, and then returning an HTML page to the client. This approach makes a lot of technical sense, but it doesn't make for a great user experience. The user has to wait while the server is doing its thing, and, at every step in a task, the user waits some more. Through the browser, the user accesses a Web application and his request gets passed as an HTTP request to the server-side systems. The server-side systems have a Web server and a datastore, back-end processing, and legacy systems. The response from the Web server is in the form of HTML data that's passed on to the user interface.
How AJAX Works
What SOA and Web Services Can Add to AJAX
AJAX communicates through XMLHttpRequest. XMLHttpRequest helps communications between HTTP servers through XML. From the client side of the application, instantiate XMLHttpRequest and, through its methods, issue an HTTP command such as GET or PUT to the Web server. Through the XMLHttpRequest object you can now easily implement a Web service. Client code invokes them via HTTP, where they accept and return XML code. On both sides of the connection the XML code is managed and traversed.
AJAX is a user interface model and Web services is a back-end functional layer mechanism. AJAX is very helpful in handling multiple Web services where there is a need for updating part of the user interface.
The following are the logical steps for a Web service invocation using AJAX (see Figure 3):
Reader Feedback: Page 1 of 1
SOA World Latest Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
SYS-CON Featured Whitepapers
Most Read This Week