Freitag, Februar 03, 2006

Aspects of AJAX: An Engine for Java

This AJAX Engine was originating published in 2005 for the ASP.NET 2.0 Platform and is now partly also available in JAVA. This Engine can be ported very easily because it relies on web standards that are available on many platforms and in many languages:

JavaScript / ajax.js

A huge part of the coding is done using JavaScript on the client. This code needs shared by both projects and is always exchangeable.

WebServices

The asynchronous calls from the page in the browser to the server are implemented using the SOAP standard. On the server we only need Standard WebServices. Both platforms, ASP.NET and Java support the bottom up implementation of WebServices and we just need to write simple methods that get called from the client.

XSLT / WebService Proxies

To enable a communication from the client side, the server uses the WSDL definitions that can be generated from WebServices on both platforms and transforms them to proxy objects using JavaScript.

The retrieval of the WSDL and for the transformation is ported and needs only about 30 lines of code that you can find in ~/ajaxcore/GetJavaScriptProxy.aspx or ~/ajaxcore/GetJavaScriptProxy.jsp.

The definition of the translation itself is coded using an xslt definition in the file ~/ajaxcore/wsdl.xslt that is also identical on both platforms.

The AJAX Engine needs nothing else than these 3 building blocks.

Download

The download is available on my web side: http://www.mathertel.de/AJAXEngine/ in the download section containing a eclipse project. I use right now: Eclispe 3.1.2 with the Webtools plug-in 1.0, Java 1.4.2.x, Tomcat 5.5 incl. the compatibility jar and Axis 1.2.1

Documentation

If you search for more documentation use the following links that are part of the ASP.NET version written in C#. Java programmers should understand the code very easily and there are also many JavaScript hints and tricks documented in there.

http://www.codeproject.com/soap/JavaScriptProxy_01.asp A early available documentation about how the JavaScript proxies are generated and how they work.

http://ajaxaspects.blogspot.com/ The blog where all you can find all the documentation that was written while the project was growing.

http://www.mathertel.de/AJAXEngine/ The ASP.NET based demo WebSide containing all the samples I talked about in my blog.

http://www.mathertel.de/ajax/Aspects of AJAX_index.htm An eBook about the AJAX Engine. Here you can find most of the content of the blog and some more hints.

Please contact me via my blog and let me know how you find this work - and what you miss.

Kommentare:

Andrea R., Milano (Italy) hat gesagt…

Dear Mathias,
I'm trying to work with your ajax engine. I think it's a great job...
Actually I'm only using the javascript functions to call .NET webservices.
I have a question: is it possibile to send multiple parameters to a webservice in the "prepare" property of an action? I know I could wrap different parameters in an xml structure, but I'm working with a webservice which wait for three different dataype parameters (an integer, a string and an XmlDocument). Please, help me! I'd really like to go on working with your code...

MatHertel hat gesagt…

Glad to hear this.
I think I can post a solution to this problem on the weekend.