Build Rich Internet Applications that Run Outside the Browser

Adobe AIR on Ulitzer

Subscribe to Adobe AIR on Ulitzer: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Adobe AIR on Ulitzer: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Adobe AIR Authors: Yeshim Deniz, Yakov Fain, David Weinberger, Maureen O'Gara, Tad Anderson

Related Topics: Java EE Journal, Adobe AIR on Ulitzer, XML Magazine, SOA & WOA Magazine

J2EE Journal: Article

Data Services Made Easy for Adobe Flex Applications

An approach based on XML and e4x

This "ItemSearch" class is used from the application code shown in Listing 3 to invoke the service in the back-end server and to parse the response back to the AS object. The two main functions to search and parse the response through framework are:

public function searchAmazon():void{
    var oper1:ItemSearch=new
     var lReq:ItemSearchRequest = new ItemSearchRequest();
     var col:ArrayCollection = new ArrayCollection();
     col.addItem(lReq);,"0K8EYY5Z00B7MCNQ2H82",null,null,null,null,null,col,null,null );

public function onSuccess(obj:Object):void{
    itemSearchResponse = obj as ItemSearchResponse;
    if( itemSearchResponse.items.length >0)
      items = (itemSearchResponse.items[0] as

"ItemSearchResponse" class is generated from the wsdl and can be found in Listing-4 and inside amazon.ecs.jar file.

One point to note in the above samples is that, for REST API based application the response from the server side is needed to be parsed by the application developer with generated classes with the help of the framework, but for web services based application as the operation classes are also generated and the return for a service is already defined in the WSDL file, the response is automatically parsed to the defined class object as per the WSDL definition.

Reference Implementation
The reference implementation for the framework is ready and I'm hoping to start an open source project after I see the community response. The concept explained here needs a full project to sustain all the requirements of the enterprise and a collective effort to do it. So, if you're interested in implementing the framework in your project and need the recent source code please contact me.

This framework will solve the data integration needs of several Flex projects in a uniquely elegant fashion for both Web Services- and REST API-based servers. With Flex's rich UI capabilities, this framework based on XML and e4x will definitely give developers an upper hand in coming up with versatile Web applications quickly. It can be a direct alternative to Flex Data Services based on its adherence to open technologies like XML and e4x but with the same ease of use as FDS. It also provides all the flexibility of open source projects and won't cost big bucks to build an enterprise application. With the advent of Adobe Integrated Runtime (AIR) this framework can be used to build complex desktop applications integrating different REST- and Web Service-based services.

Ted On Flex: XML(e4x) versus AMF

Adobe - Adobe Flex 2: Flex Data Services

wsdl2as Open Source Flash

More Stories By Indroniel Deb Roy

Indroniel Deb Roy works as an UI Architect for BlueCoat Systems.He has more than 10 years of development experience in the fields of J2EE and Web Application development. In his past he worked in developing web applications for Oracle, Novell, Packeteer, Knova etc. He has a passion for innovation and works with various Web2.0 & J2EE technologies and recently started on Smart Phone & IPhone Development.

More Stories By Alex Nhu

Alex Nhu works as a manager, UI Development at Packeteer Inc. He has more than 11 years of work experience designing and architecting complex server-side J2EE and XML applications. He loves developing Web applications with Flex now after getting a taste of developing UI using other RIA platforms.

Comments (13) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

Most Recent Comments
pixelwiz 10/14/09 12:05:00 PM EDT

I've been a ColdFusion developer for about 5 years, and can do a lot of cool stuff with jQuery and alike, but time has come for me to have to write my first Flex app, and I'm hoping you might have a few suggestions.

I'm doing research on if it's even possible for me to do what I need. I'm building an app to manage scores for golf tournaments, and some things like the leader boards, really need to be refreshing in real time. So as new scores come in, they should immediately be reflected on all leader boards, ideally with some animation or highlight that indicates a score just changed. Now the closest thing I've seen to what I need to do were all those CNN, Fox, CNBC apps during the last presidential elections, where as results were coming in the data was automatically refreshing. I don't even know how that works conceptually, is it the server somehow pushing the data to the Flex clients? Cause I don't want every Flex client to have to keep hitting the server every couple of seconds querying for changes like a web page would have to.

Any help, suggestions, examples are highly appreciated.

sailbv 12/03/08 10:56:23 PM EST

Where are listing 3 and listing 4?

Humberto A. Sanchez II 12/10/07 07:52:20 AM EST

Are you having any success either releasing the reference implementation or starting an open source project around this?

Indroniel Deb Roy 11/04/07 01:27:38 PM EST

The wsdl2as framework mentioned here is not the wsdl2as open source one. It's a fresh implementation!

Sebastien Arbogast 10/29/07 05:49:05 PM EDT

Your framework is exactly what I'm looking for. I thought similar functionality was already embedded into Flex but to my great disappointment, it's not. So I'd really love to see what you've come up with. And if I can help, it's with pleasure.
Is open source flash's wsdl2as the framework you're talking about?

Indroniel Deb Roy 09/21/07 12:33:00 PM EDT

This paper or the sample implementation (not currently available for public use) do not use wsdl2as tool(found in to generate as3 code.
So, why wsdl2as tool fails is not pertinent to this paper as such. Please, visit any discussion forum provided by the project to discuss about specific issues in the wsdl2as tool.

The sample implementation in this paper do generate as3 code, but is implemented fresh from scratch. This paper is trying to just explain the architectural details of the approach ...

Ryan K 09/21/07 10:02:01 AM EDT

wsdl2as simply does not work. Worse, it doesn't tell you what the problem is:

Exception in thread "main" java.lang.IllegalArgumentException: local part cannot be "null" when creating a QName
at javax.xml.namespace.QName.(Unknown Source)
at javax.xml.namespace.QName.(Unknown Source)

Indroniel Deb Roy 09/12/07 12:51:28 PM EDT

The generated code might need to change if there are major changes in the action script language or some API change in flex web-services support. In Moxie(flex 3) release there is no major change in the AS language and flex Web Service API, so the generated code should just work fine.

Tom Van den Eynde 09/12/07 05:45:20 AM EDT

If I'm correct there will be similar support for this in Flex 3. If so: can the generated code easily be replaced by what is available through Flex 3 later on?

Thiru Rajesh 09/11/07 11:49:09 AM EDT

This is indeed a nice article on overall architecture of flex based applications based on complex server side data requirements. It will definitely serve as an alternative to FDS for programming flex ui for public web services.

Steve 09/05/07 05:15:52 PM EDT

This is one of those ideas that entice us designer crossovers with visions of easily discoverable, accessable, post-processable server-side stuff. And if we know enough T-SQL we can really take better at an architectural level.

Can't help but wonder at the lack of followup/comments by the community.

On the subject of compression; what's it take to bring XML into line AMF much less AMF3 (& setting aside scalability issues) for a 'text-heavy' object.

What would the reverse look like? if one were defining the server-side objects from the native Flex? Couldn't we literally feed mxml components in a digestible way?

Dave 08/24/07 09:56:39 AM EDT

Could you provide a link to a much larger version of your 1st diagram?

FDJ News Desk 08/21/07 12:59:19 PM EDT

Flex has gotten popular lately because of its rich GUI capabilities. It also comes in handy with HTTPService and Web Service components connecting to back-end servers to fetch and update data. But using this mechanism to talk to the back-end server requires formulating a unique service object from the Flex side, making a request, and getting back data from the back-end either in XML or plain text format. The response data then has to be parsed and fed to the Flex objects to update the UI. For small to medium-size Flex projects it's a viable solution, but for enterprise projects with thousands of external service calls it will get quite repetitive and could result in a lot of unmanageable, buggy code.