YOUR FEEDBACK
José D'Andrade wrote: "...it may never be released..." Why? "...if Midori isn’t heir to Windows Mi...
AJAXWorld RIA Conference
$300 Savings Expire August 8
Register Today and SAVE!

SYS-CON.TV

2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
TOP THREE LINKS YOU MUST CLICK ON


AJAX Reporting Challenges & Solutions with Adobe Flex
Bringing together JavaScript, Flash Player, and Web Services

Browser Incompatibilities
Challenge #1: Reporting requires complex UI programming, but maintaining browser-specific code is a huge effort. Optimizing code delivery is an art. Optimizing data delivery isn't easy because it needs to support ever-changing protocols (SOAP, REST).

Solution: Flash Player is a virtual machine that works the same way in every browser

Challenge #2: Code packaging (in Internet Explorer Web Services are packaged as HTC, which is not supported by Mozilla browsers.

Solution: Use a browser-agnostic invisible Flash Player-based agent that supports communications with Web Services regardless of the Web browser you're using.

Performance
Challenge #3: Large JavaScript projects such as reporting applications need to be loaded, pre-processed, and executed on every page load

Solution: Use Flash agents that are pre-compiled, compressed, and optimized for streaming and caching.

Robustness
Challenge #4: The HTTP protocol is very forgiving because it was optimized for non-reliable networks. Web browsers were designed to display whatever has arrived with a Web page. If a page includes an image, which was not available at the moment, you'll see an icon of the broken image, and, maybe an alternative text. But what if a piece of JavaScript code doesn't arrive for whatever reason?

There's no built-in way to ensure the delivery of JavaScript. This means that AJAX programmers have to write additional code just to check if the application code has arrived. On top of this, Web browsers offer mediocre debugging support.

Solution: Use a virtual machine with reliable code delivery and good development and debugging tools.

Web Browsers Have an Unpredictable Future
Challenge #5: Software vendors don't seem to be eager to invest into browsers. Microsoft is investing in .NET (WPF) and Silverlight, which runs on CLR. Adobe is developing AIR. Sun Microsystems is about to release a small consumer VM for rich Internet applications written in Java and JavaFX.

Solution: Select a ubiquitous technology (currently it's Flash Player) that offers a solid development and deployment environment.

I've listed some major challenges that any RIA developers would face regardless of what protocol they use for data delivery. Recently, our company, Farata Systems, which was working mainly with Flex/Java applications, decided to create a version of our ClearBI reporter as a component for AJAX applications as well. After experimenting with various protocols, we created a component called WebService.swf, which is a Flash Player and can easily turn a SOAP Web Service into an object with methods that correspond to WSDL operations, and the XML processing is done using ECMAScript for XML (E4X), which lets you avoid XML parsing headaches

Figure 1 shows an HTML/JavaScript application that uses an invisible Flash Player component (WebService.swf) and one visible (ClearBI.swf). In this example we'll use the data coming from a publicly available book search Web Service off Amazon .com.

The entire process works like this:
1.  The JavaScript code gives a URL of Amazon's WSDL to a hidden WebService.swf.
2.  The WebServices.swf loads WSDL from Amazon and automatically converts XML into an object with properties (it uses E4X as will be explained below).
3.  The JavaScript asks WebService.swf to call the selected operation from Amazon's WSDL.
4.  WebService.swf gets the data and passes them to JavaScript (XML or JavaScript objects). If you're just interested in simplified processing of SOAP in your AJAX application, you don't need to do step 5 - WebService.swf is all you need.
5.  To produce reports that look as shown below and can be customized by the end users, pass the data from JavaScript to ClearBI swf.

What's Under the Hood
The entire workflow consists of two major steps described below: (Figure 2)
1.  Using JavaScript initialize the WebService.swf object, register event listeners, and load the WSDL:

Var ws=com.farata.jsfx.WebServices("MyWebService");
Add the WSDL load listener
ws.addEventListener("serviceload", onWsdlLoaded);
Add the error listener

ws.addEventListener("servicefault", onError);
Initialize the WebService.swf with wsdl. Load wsdl and notify ServiceLoadListeners on success.
ws.useService("http://soap.amazon.com/schemas2/AmazonWebServices.wsdl", "Amazon");

This call will load Amazon's WSDL, which among other things will contain the operation KeywordSearchRequest:

<wsdl:message name="KeywordSearchRequest">
<wsdl:part name="KeywordSearchRequest" type="typens:KeywordRequest"/>
</wsdl:message>

As you can see, this operation expects an argument of a KeywordRequest type that is described in the same WSDL:

<xsd:complexType name="KeywordRequest">
<xsd:all>
<xsd:element name="keyword" type="xsd:string"/>
<xsd:element name="page" type="xsd:string"/>
<xsd:element name="mode" type="xsd:string"/>
<xsd:element name="tag" type="xsd:string"/>
<xsd:element name="type" type="xsd:string"/>
<xsd:element name="devtag" type="xsd:string"/>
<xsd:element name="sort" type="xsd:string" minOccurs="0"/>
<xsd:element name="variations" type="xsd:string" minOccurs="0"/>
<xsd:element name="locale" type="xsd:string" minOccurs="0"/>
</xsd:all>
</xsd:complexType>


About Yakov Fain
Yakov Fain is a managing principal of Farata Systems, consulting, training and product company. He has authored several Java books, dozens of technical articles. SYS-CON Books released his latest co-authored book , "Rich Internet Applications with Adobe Flex and Java: Secrets of the Masters" in Spring 2007. Sun Microsystems has nominated and awarded Yakov with the title Java Champion. He leads the Princeton Java Users Group. Yakov teaches Java and Flex 2 part time at New York University. He is an Adobe Certified Flex Instructor and an Editor-in-Chief of Flex Developers Journal.

LATEST AJAXWORLD RIA STORIES
SQL Injection attacks are one of the easiest ways to hack into a website. One recent hack, using a script from verynx.cn, involves injecting sql into a web form that then appends some JavaScript code into fields in a database that then gets executed on the client side when a user...
The Web has evolved into a structured data space of loosely connected databases, enabling granular data access-by-reference to Web-accessible entities, courtesy of HTTP. This evolution and the emergence of AJAX-based RIA technologies lay the foundation for a new generation of lib...
As Web-based applications are pushing the "Rich User Experience" envelope, AJAX is quickly becoming a standard front-end for any PHP application. But unfortunately as PHP applications that utilize AJAX are being forced to morph from two-tier to three-tier architectures, pushing c...
JavaScript 2 is becoming increasingly important. Learn how to take advantage of JavaScript 2 while still running in today's browsers. Leverage your current JavaScript and HTML skills to build applications that run in Flash 7-9, DHTML and more with no code changes! OpenLaszlo 4.2 ...
Not only enterprise portals integrators are using AJAX at the portal level but now they can also use it for the development of more user-friendly JSR-168 portlets. With the arrival of new standards, AJAXified JSF Components like IceFaces ot RichFaces became a reality that can be ...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE