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
      ItemSearch("http://webservices.amazon.com/
      AWSECommerceService/AWSECommerceService.wsdl",
    onSuccess,onFault);
     var lReq:ItemSearchRequest = new ItemSearchRequest();
     lReq.searchIndex="Apparel";
     lReq.keywords="Shirt";
     var col:ArrayCollection = new ArrayCollection();
     col.addItem(lReq);
     oper1.call(null,"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
        com.amazon.webservices.AWSECommerceService._2007_06_13.Items).item
        trace(itemSearchResponse.toXML("ItemSearchResponse").toXMLString());
}

"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.

Conclusion
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.

References
Ted On Flex: XML(e4x) versus AMF www.onFlex.org/ted/2006/12/xmle4x-vs-amf.php.

Adobe - Adobe Flex 2: Flex Data Services www.adobe.com/products/Flex/dataservices/.

wsdl2as Open Source Flash www.osflash.org/wsdl2as.

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)

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.