INTEGRATING AJAX AND WEB SERVICES FOR CO-OPERATIVE IMAGE EDITING CS 708 Seminar
MARIAM VARGHESE (Roll No. 05085) B. Tech. Computer Science & Engineering
College of Engineering Kottarakkara Kollam 691 531 Ph: +91.474.2453300 http://www.cek.ihrd.ac.in
[email protected]
Certificate
This is to certify that this report titled Integrating AJAX and web services for co-operative image editing is a bonafide record of the CS 708 Seminar work done by Miss.Mariam Varghese, Reg No. 10264040, Seventh Semester B. Tech. Computer Science & Engineering student, under our guidance and supervision, in partial fulfillment of the requirements for the award of the degree, B. Tech. Computer Science and Engineering of Cochin University of Science & Technology.
October 8, 2008
Guide
Coordinator & Dept. Head
Miss Geetha Raj R Lecturer Dept. of Computer Science & Engg.
Mr.Ahammed Siraj K K Asst. Professor Dept. of Computer Science & Engg.
Acknowledgment I express my whole hearted thanks to our respected principal Dr.Jacob Thomas,our seminar coordinator Mr.Ahammed Siraj K K,Head of the Department, for making my seminar successful. I wish to express my sincere thanks to my guide Miss.Geetha Raj R,Lecturer in computer science Department , for providing valuable help and support for my seminar. I thank all faculty members of computer science engineering department in College of Engineering, Kottarakara for their co-operation in completing my seminar. My sincere thanks to all those well wishers and friends who have helped me during the course of the seminar work and have made it a great success. Above all I would like to acknowledge with thanks ”THE LORD ALMIGHTY”,the foundation of all wisdom who have been wonderfully guiding me step by step.
MARIAM VARGHESE
Abstract Ajax is a group of web related technologies used for providing interactive web applications.A key advantage of AJAX application is that they look and more like desktop applications.Proponents argue that AJAX applications perform better than traditional web programs.As an example AJAX application can add or retrieve a new data for a page it is working with and the page will update immediately without reloading. The existing technologies such as SOAP for Web service communication,Web Services Description Language (WSDL) for Web services interface description and UDDI for Web service publishing and searching and so on ,are based on XML-centric approaches,so web services can implement loosely coupled distributed Web applications across different platform. Because technologies that support both AJAX and Web services are XML based the two can leverage each others strengths.Our system integrates the two for Web based co-operative image editing. During co-operative image editing multiple authors can simultaneously work on editing an image file in either Synchronous or asynchronous co-operative modes.In Synchronous cooperative mode,when an author modifies the image,other authors can see the modifications instantly and perform their own edits immediately.In asynchronous co-operative mode author must make modifications sequentially-that is author must finish editing the image file and submit the revised file to the server before another author can obtain the file and edit it.Co-operative image editing system can employ one of 3 types of architecture-centralised,distributed,hybrid of the two.Our integration frame work involves four kinds of actors-management web sevices,image web services,visualization clients and proxy servlets.A visualization client can interact with the proxy servlet to complete the following tasks for image file such as import,export,modify,update and submit. Because this integration framework makes use of AJAX and Web Services to resolve the problem of message exchange delays and browser security limitations,it increases Web based co-operative image editing’s effectiveness.In future this integration frame work can be used to build generic co-operative business processes.
i
Contents 1 INTRODUCTION
1
2 TRADITIONAL WEB APPLICATION COMMUNICATION FLOW 2 3 AJAX STYLE COMMUNICATION FLOW
3
4 AJAX WORLD IN ACTION
4
5 COMPONENT TECHNOLOGIES
6
6 INTEGRATING AJAX AND WEB SERVICES FOR CO-OPERATIVE IMAGE EDITING 11 7
IMAGE EDITOR FEATURES
13
8 CO-OPERATIVE IMAGE EDITING
20
9 INTEGRATION FRAMEWORK
21
10 ACTORS
24
11 ADVANTAGES OF AJAX
29
12 DISADVANTAGES OF AJAX
29
13 FUTURE SCOPE
30
14 CONCLUSION
31
REFERENCES
32
ii
1
INTRODUCTION
AJAX(Asynchronous Javascript and XML) is a group of interrelated web development techniques used for creating better, faster and more interactive web applications or rich Internet applications. The name AJAX was given by Jesse James Garrett.With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page. Data is retrieved using the XMLHttpRequest object.With this object, JavaScript can trade data with a web server, without reloading the page. AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information from the server instead of whole pages. The AJAX technique makes Internet applications smaller, faster and more user friendly. AJAX is a browser technology independent of web server software. AJAX is not a new programming language, but a new way to use existing standards. In the article that coined the term Ajax,Jesse James Garrett explained that it refers specifically to these technologies: XHTML and CSS for presentation the Document Object Model for dynamic display of and interaction with data XML and XSLT for the interchange and manipulation of data, respectively the XMLHttpRequest object for asynchronous communication JavaScript to bring these technologies together It is such an exciting technology that it’s already found use in Googles most popular applications, such as Gmail and Google Maps. All of the major products Google has introduced over the last years Orkut, Gmail, the latest beta version of Google Groups, Google Suggest, and Google Maps are Ajax applications.Ajax applications can be any size, from the very simple, single-function Google Suggest to the very complex and sophisticated Google Maps.With conventional JavaScript when you fetch and send information to the server, you need to wait for a response before the user can do anything on the Webpage. Once the browser receives this information, the webpage will blink a few times and refresh.
1
2 TRADITIONAL WEB APPLICATION COMMUNICATION FLOW First a page is loaded. Next the user performs some action such as filling out a form or clicking a link. The user activity is then submitted to a server-side program for processing while the user waits, until finally a result is sent, which reloads the entire page.This model is slow, as it needs to retransmit data that makes up the complete presentation of the Web page over and over in order to repaint the application in its new state.
Figure 1: Traditional Web application communication flow
2
3 AJAX STYLE COMMUNICATION FLOW Ajax-style applications use a significantly different model where user actions trigger behind the scenes communication to the server fetching just the data needed to update the page in response to the submitted actions. This process generally happens asynchronously, thus allowing the user to perform other actions within the browser while data is returned. Only the relevant portion of the page is repainted.In Ajax-style Web application typically JavaScript invokes communication to the server, often using the XMLHttpRequest (XHR) object. After receiving a request, a server-side program may generate a response in XML, or alternate formats such as plain text, HTML fragments, or JavaScript Object Notation (JSON) being passed back to the browser. Consumption of the received content is typically performed using JavaScript in conjunction with Document Object Model (DOM) methods, though in some rare cases you see native XML facilities in the browser used.
Figure 2: Ajax-style communication flow
3
4
AJAX WORLD IN ACTION
To send off a request to the server ,we use the open( ) method and the send( ) method.The open( ) method takes 3 arguments.The first argument defines which method to use when sending the request(GET or POST). The second argument specifies the URL of the server side script.The third argument specifies that the request should be handled asynchronously.The send( ) method sends the request off the server.We will press a button and trigger an asynchronous communication request using an XMLHttpRequest (XHR) object and the Web server will issue an XML response which will be parsed and displayed in the page. The whole process is overviewed in Figure. To trigger the action, a simple form button is used which, when clicked, calls a custom JavaScript function sendRequest( ) that will start the asynchronous communication