| By Indroniel Deb Roy, Alex Nhu | Article Rating: |
|
| September 11, 2007 03:30 PM EDT | Reads: |
32,565 |
The Importance of XML Schema & Interface-based Programming
When speaking of XML integration it becomes crucial to know the exact
representation of the XML data structure and hierarchy. There are
various ways to describe the same data in XML and so it becomes
impossible to come up with a generic integration solution on raw XML
data. An XML schema is needed to describe the XML data structure and
hierarchy and provide the generic interface on which both the client
and server implementation can be based, If needed it can also be used
to validate the data while sending and receiving.
With the advent of SOA and the adaptation of XML as a data exchange mechanism, several servers provide XML-based access to their services namely RSS feeds, the REST API, traditional HTTP/HTTPS implementations, and Web Services implementations. These server implementations often define XML schema to describe their internal data structure. For Web Services-compatible systems the WSDL file describes all the operations and internal XML complex types needed for a particular operation in the WSDL file or referenced schema file.
The new framework considered here is XML Schema-based and so loosely coupled with the server-side implementation. The concept is based on generating AS classes from the schema definition that are direct counterparts of the server-side business classes. (See Figure-3 for details.) The objects generated on the AS side have the same data structure as their server side counterparts since they're based on the same schema representation. But to talk effectively with the server side a framework is still needed on the Flex side to convert these objects to XML and back to AS objects, as described below.
XML Schema binding to the AS classes to compile server-side classes to their AS counterparts have certain advantages such as:
• Client-side implementation can be done independent of the
server side. Schema-based implementation ensures seamless integration
to the server side.
• To come up with a Flex-based user interface there's no need to shut down a production server.
• For the Flex client working on AS objects, schema-based architecture
also provides the resources to generate client-side AS classes to mimic
strongly typed AS counterparts of server objects, which may be referred
directly while programming the client UI. So this approach provides
complete segregation between the client and server but provides a solid
bridge to bind them together with XML Schema.
• Basing on XML Schema makes this approach equally good for J2EE and
.NET implementations since the underlying infrastructure is hidden
behind the XML Schema interfaces.
• Strongly typed AS objects.
• The new approach also provides an efficient mechanism to build a
functional application based on several Web Services since the states
and logical flow of execution when using one Web Service to invoke
another may be captured in the Flex layer itself. Thus the framework
can be used to implement a fully functional BPEL engine in the client
layer using Flex.
• Over the last years the enterprise has embraced SOA and Web Services
technologies and a plethora of implementations are now found everywhere
on the World Wide Web. Integrated application development has already
started consuming these Web Services in a workflow on the server side
using BPEL (Business Process Execution language) and similar
technologies in the server side. But with Flex and this new framework
plugged in all the intricate Web Service implementations can be
implemented on the client tier where internal objects pertaining to
those Web Services are exposed as AS objects. Statically typed business
object classes with a rich Flex API will definitely open up new ways of
integrating Web Services on the client tier. And with the Flex 3
release, versatile GUI-rich Web Service-enabled applications will fill
user with delight just like the standalone applications on their
desktop.
• With default Web Services support Flex clients can connect to Web
Services, but data from Web Services is dynamically typed so making a
workflow implementation with default Web Services support in Flex will
be daunting without this framework support.
• Our new framework is all interface-based and loosely coupled with the
server-side implementation. This lets an application using this
framework implement the Flex UI layer regardless of the server-side
implementation. The only data contact with the server is the XML Schema
interface, which the server publishes. Based on the schema and a list
of functions described either in a WSDL or any native schema form, both
the client and server can be implemented on their own as completely
disintegrated systems. This feature provides the framework to easily
implement a Flex-based user interface for any live Service and deploy
it on the server at any time to enable a Flex-based UI without stopping
a production server and fully functional Flex 3 client programs can be
put together without deploying on the production server. So, this
framework provides a rich platform for system integrators consuming Web
Services and XML data to create applications rich with the Flex UI.
• This framework also opens up an avenue to integrate REST based
services with classical Web Services and build robust client
applications using Flex.
A Comparison with FDS and AMF
Adobe provides a Flex
Data Service (FDS) based on the ActionScript Messaging Format (AMF).
It's a very robust solution but need server-side deployment to work.
AMF is a binary format so it's ideally faster than XML, (but there are
ways to make the XML footprint small on the wire with compression).
It supports server push to update the Flex client in server data state changes. It can readily integrate with any J2EE/Web Service/.NET implementation but needs server-side deployment.
On the flip side it's based on the proprietary AMF format from Adobe that exacts a huge per-seat license fee. It can't work on any server without deploying the server-side FDS, whereas our framework can readily connect to any production server.
For the huge enterprise community using XML as a data interchange, leaning towards AMF (a proprietary format) may be difficult. For production servers implementing Web Services or the REST-based API, the new approach plugs in seamlessly while FDS needs server-side deployment to work.
For servers that understand XML the new approach provides a more robust solution than FDS and keeps all the ease of use and flexibility provided by FDS.
XML & Flex, E4X
Flex comes with a new concept
of easy XML parsing with ECMAScript for XML (E4X) implementation, where
the XML hierarchy can be navigated with easy "." syntax. It supports
all XML semantics including namespaces. So robust XML
serialization/de-serialization can be very easily implemented in Flex
using a new XML object with e4x in action. The new framework uses e4x
to parse XML data and HTTPService and Web Service components to send
and receive from the back-end server. This approach is based on the
infrastructure provided by Flex 2 and may be distributed as a Flex
library that can be plugged into any Flex project needing an elegant
data service solution using XML.
The New Framework Explained
Our framework can be
ideally termed a layer between the Flex ActionScript UI object layer
and the HTTP/Web Service layer. See Figure 4 for details.
Published September 11, 2007 Reads 32,565
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
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.
![]() |
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. |
||||
![]() |
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 http://osflash.org/wsdl2as) to generate as3 code. 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 |
||||
![]() |
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. |
||||
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Unveils LiveCycle Enterprise Suite 2 for Deployment in the Cloud
- Adobe Flex Developer Earns $100K in New York City
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Ph.D. in Twitter Anyone?
- Eolas Sues the Internet
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Special Report on the Emerging Cloud Computing Trend
- Adobe Cans Another 9% of its Workforce
- My Thoughts on Ulitzer
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Ulitzer Live! New Media Conference & Expo
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Executives Feature on Cloud Computing Expo Power Panel
- Software Flexibility in the Cloud - Part 4 of 5
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- Adobe Unveils LiveCycle Enterprise Suite 2 for Deployment in the Cloud
- Where Are RIA Technologies Headed in 2008?
- Cover Story: How to Increase the Frame Rates of Your Flash Movies
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Your First Adobe Flex Application with a ColdFusion Backend
- Adobe Flex 2: Advanced DataGrid
- i-Technology Blog: Death-Knell For "Rich Media? Hardly!
- Adobe/Macromedia - Microsoft, Look Out!
- How To Create a Photo Slide Show ...
- Adobe Flex Interface Customization - Themes, Styles, Skins
- Personal Branding Checklist
- Has the Technology Bounceback Begun?
- "Real-World Flex" by Adobe's Christophe Coenraets




































