|By Dennis Baldwin||
|October 20, 2004 12:00 AM EDT||
Flash MX 2004 Pro Web service classes or Flash Remoting components for ActionScript 2.0: Which is right for you? This article offers some guidelines.
In just three years we've come a long way. It seems like an eternity since the days when I used to code CF pages with dynamic content served up to Flash, but let me stress how rudimentary it was. Flash back to December 14, 2001, when a little site called FlashCFM received Macromedia's Site of the Day designation. On several occasions I received e-mails asking me how on earth FlashCFM received this prestigious award. There was nothing spectacular about the site, no fancy graphics, Flash animation, or anything out of the ordinary. Yet the concept behind it was brilliant, or so I believed. As you can probably guess from its name, this site introduced the marriage of Flash and ColdFusion.
FlashCFM was a community site that educated developers about the power of Flash and ColdFusion integration. When I say that this process used to be rudimentary, let me give a quick example of ColdFusion code in a page called variables.cfm:
So the output would look like:
Flash would then retrieve this data and display it with a simple line of code:
A very simple framework indeed (more like a CSV screenscrape or accessing a query string), but it proved to be the start of something wonderful. Flash forward to the present and we have such powerful technologies as Flash Remoting and Web service components. In this article I will go into detail about the pros and cons of each solution, as well as give you enough information to decide which is the best fit for your project. This will be demonstrated with a simple application that calls identical service methods, one using Flash Remoting and the other using the Web service classes. Enough history, let's get started!
Flash MX Pro Web Service Classes
If you've opened Flash MX 2004 Pro, then you're probably aware of the new Web service classes. Macromedia has done a great job in releasing components that allow Flash developers to easily consume Web services. Throughout the rest of this article I'll be making reference to the WebServiceClasses component and not the WebServiceConnector component. The WebServiceClasses component is the minimum set of classes necessary to handle SOAP transactions programmatically, while the WebServiceConnector is more of a visual aid for accessing Web services from Flash. I believe in using a programmatic approach because it gives developers more control over their applications, allows them to better understand how the API works, and helps reduce file size.
I'm currently working for a company named SensorLogic and we're in the process of rewriting our Web portal to utilize Flash and Web services. SensorLogic is a machine-to-machine (M2M) ASP, and it's imperative that the user experience be as quick and reliable as possible. With the ASP model in mind, we'd like to expose certain services to our customers and resellers so they can build their own applications around our back-end system. We wanted our system to be flexible enough to serve data to Flash, ColdFusion, .NET, or Java. Web services gave us this flexibility. Figure 1 illustrates a basic communications architecture for Flash with Web services.
Although very extensible and flexible, Web services in Flash do have their limitations and drawbacks. The first and foremost is the overhead that SOAP transactions introduce. XML-based protocols are very descriptive, which means they add to code bloat because of markup tags and headers. With this overhead, data usually takes longer to get to the Flash client and the XML has to be parsed, which slows the process down even more. This is definitely not recommended for large data sets or complex objects. On the other hand, if you're dealing with smaller data sets and simple objects, then Web services may be the perfect fit.
Another issue worth considering is security. Unless you plan on implementing SSL, all data sent over the wire is unencrypted. So if your application contains sensitive data, then enforcing secure transactions is a must. In Flash MX 2004 a new security measure was introduced, known as the crossdomain.xml policy file. This file basically says that a Flash client coming from domain A has authority to access services on domain B. This file resides in the Web root of domain B and is automatically read by the Flash client when any Web services are called.
To further explain this issue, let's say we want to write a Flash component that accesses a weather Web service and displays the temperature for a specified locale. This will be a problem if we're not authorized to access the remote server through the crossdomain file. In most cases it won't even exist on the remote server. In a controlled environment this isn't a problem, however. If we have control of the server that provides the weather Web service, we can add the crossdomain file to grant access to authorized clients. For more information on configuring crossdomain files, visit www.macromedia.com/devnet/mx/flash/articles/fplayer_security_03.html.
With all the hype around the new Web service classes, developers seem to think Macromedia has forgotten about Remoting. This couldn't be further from the truth. The Flash Remoting components for ActionScript 2.0 were recently released - and they're larger than life. Nothing has changed in the underlying architecture of Remoting; the new components are just friendlier to ActionScript 2.0 developers. While Macromedia put a good amount of resources into the new Web service classes, this doesn't eliminate the need for Remoting.
If you've read any of my past ColdFusion Developer's Journal articles, then you probably know how much I rant and rave about Remoting. Yes, I'm a bit biased toward Remoting, but that's because I love CF and how nicely it integrates with Flash. All data that is transmitted between the Flash client and the application is serialized using the Action Message Format (AMF). AMF is a streamlined binary protocol that was modeled after SOAP. Flash Remoting automatically takes care of data type conversion from the server to the client and back again. Figure 2 illustrates a basic communications architecture with Flash Remoting.
Notice how Web services can still be introduced into this architecture. The application server can serve as a proxy between Flash and the Web service. An application server such as ColdFusion would invoke the remote method and return the data to the Flash client using Remoting. Taking this approach circumvents the crossdomain.xml security restriction.
As mentioned earlier, if you're dealing with large data sets and complex objects, then Flash Remoting is definitely worth a look. In most cases your performance will be better. If you're doing simple transactions such as retrieving stock quotes and weather data, then performance will be about the same or the difference will be too negligible to even notice.
One of the major drawbacks of Flash Remoting is the cost. The license runs $999 for a single-CPU license at the time of this writing. This is not an issue for CFMX developers (or Java/JSP developers using JRun 4) because Flash Remoting comes built in! If you are building enterprise applications with Flash but you're not on a CFMX server, then purchasing a Remoting license is a no-brainer. I can say from experience that it's worth every single penny for the performance you'll be gaining. Okay, enough talk; let's take a quick look at the application.
The File-Browsing Application
Although I've spent a good amount of your time talking about each technology, I'd like to walk you through a basic file-browsing application. If you'd like to download the source code for this application, please feel free to do so at www.sys-con.com/coldfusion/sourcec.cfm. View the README file to see how to configure the application. The application consists of a Tree component that allows you to select a folder and display its contents in a DataGrid component. Each time a tree node is clicked, a service call is made to the server for data. The ComboBox controls whether the service call is made using Web services or Flash Remoting. Figure 3 shows a screenshot of the application at work.
Web service and Flash Remoting objects are created with ActionScript in a similar manner. After the objects are created, a service method called getFiles is invoked. This method resides in a CFC called fileBrowser.cfc, which can be invoked through a Web service call and also through Flash Remoting. I want to take a quick second to say how truly amazing CF is. In less than 15 lines of code I can expose both a Web service and Flash Remoting method that can be consumed by a Flash client. If you've had experience exposing remote methods with any other technology, then you can truly appreciate how simple CF makes this.
After playing around with the application there are a couple of things that you'll most likely notice. Overall, the performance of Flash Remoting will be better than that of Web services. When retrieving a small number of data sets the difference will be negligible and not even worth noting. That's why the "Get All Records" button was added, because I think this truly demonstrates what I discussed earlier. Since we're dealing with what could be considered fairly complex objects (recordsets) and large amounts of data, you'll see that Flash Remoting truly outperforms Web services. While testing on my local machine it generally took the Web service classes 4-5 seconds to retrieve and display 783 records, while it took Flash Remoting less than a second. Play around with it and your results may vary!
In this article I touched the surface of Web services and Flash Remoting with a few pros and cons of each. There's definitely enough information on these two topics that an entire book could be devoted to them. I encourage you to download the sample application and test it, tweak it, and break it. I hope it will ultimately help give you enough information to decide which technology fits your needs, maybe one or the other, maybe both.
One area that I did not have a chance to touch upon is debugging. If you're interested in learning more, I recommend you take a look at the Log class for Web services and the NetConnection Debugger for Flash Remoting. If you'd like to learn more about the NetConnection Debugger, please check out my earlier article in CFDJ, Volume 4, issue 10. All in all, the future is bright for Flash and ColdFusion developers. Stay tuned!
SYS-CON Events announced today that CollabNet, a global leader in enterprise software development, release automation and DevOps solutions, will be a Bronze Sponsor of SYS-CON's 20th International Cloud Expo®, taking place from June 6-8, 2017, at the Javits Center in New York City, NY. CollabNet offers a broad range of solutions with the mission of helping modern organizations deliver quality software at speed. The company’s latest innovation, the DevOps Lifecycle Manager (DLM), supports Value S...
Apr. 27, 2017 08:00 PM EDT Reads: 1,112
The Internet of Things is clearly many things: data collection and analytics, wearables, Smart Grids and Smart Cities, the Industrial Internet, and more. Cool platforms like Arduino, Raspberry Pi, Intel's Galileo and Edison, and a diverse world of sensors are making the IoT a great toy box for developers in all these areas. In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists discussed what things are the most important, which will have the most profound e...
Apr. 27, 2017 07:45 PM EDT Reads: 2,297
Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deli...
Apr. 27, 2017 07:30 PM EDT Reads: 2,465
The explosion of new web/cloud/IoT-based applications and the data they generate are transforming our world right before our eyes. In this rush to adopt these new technologies, organizations are often ignoring fundamental questions concerning who owns the data and failing to ask for permission to conduct invasive surveillance of their customers. Organizations that are not transparent about how their systems gather data telemetry without offering shared data ownership risk product rejection, regu...
Apr. 27, 2017 07:15 PM EDT Reads: 1,617
SYS-CON Events announced today that Grape Up will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct. 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company specializing in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market across the U.S. and Europe, Grape Up works with a variety of customers from emergi...
Apr. 27, 2017 06:45 PM EDT Reads: 2,205
The age of Digital Disruption is evolving into the next era – Digital Cohesion, an age in which applications securely self-assemble and deliver predictive services that continuously adapt to user behavior. Information from devices, sensors and applications around us will drive services seamlessly across mobile and fixed devices/infrastructure. This evolution is happening now in software defined services and secure networking. Four key drivers – Performance, Economics, Interoperability and Trust ...
Apr. 27, 2017 06:45 PM EDT Reads: 731
@ThingsExpo has been named the Most Influential ‘Smart Cities - IIoT' Account and @BigDataExpo has been named fourteenth by Right Relevance (RR), which provides curated information and intelligence on approximately 50,000 topics. In addition, Right Relevance provides an Insights offering that combines the above Topics and Influencers information with real time conversations to provide actionable intelligence with visualizations to enable decision making. The Insights service is applicable to eve...
Apr. 27, 2017 06:30 PM EDT Reads: 2,817
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
Apr. 27, 2017 06:00 PM EDT Reads: 1,034
Cybersecurity is a critical component of software development in many industries including medical devices. However, code is not always written to be robust or secure from the unknown or the unexpected. This gap can make medical devices susceptible to cybersecurity attacks ranging from compromised personal health information to life-sustaining treatment. In his session at @ThingsExpo, Clark Fortney, Software Engineer at Battelle, will discuss how programming oversight using key methods can incre...
Apr. 27, 2017 05:30 PM EDT Reads: 3,961
Most technology leaders, contemporary and from the hardware era, are reshaping their businesses to do software in the hope of capturing value in IoT. Although IoT is relatively new in the market, it has already gone through many promotional terms such as IoE, IoX, SDX, Edge/Fog, Mist Compute, etc. Ultimately, irrespective of the name, it is about deriving value from independent software assets participating in an ecosystem as one comprehensive solution.
Apr. 27, 2017 03:45 PM EDT Reads: 561
The 20th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held June 6-8, 2017, at the Javits Center in New York City, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Containers, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal ...
Apr. 27, 2017 01:45 PM EDT Reads: 1,304
New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists will examine how DevOps helps to meet th...
Apr. 27, 2017 01:15 PM EDT Reads: 1,594
SYS-CON Events announced today that Juniper Networks (NYSE: JNPR), an industry leader in automated, scalable and secure networks, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Juniper Networks challenges the status quo with products, solutions and services that transform the economics of networking. The company co-innovates with customers and partners to deliver automated, scalable and secure network...
Apr. 27, 2017 01:15 PM EDT Reads: 1,466
SYS-CON Events announced today that Hitachi, the leading provider the Internet of Things and Digital Transformation, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Hitachi Data Systems, a wholly owned subsidiary of Hitachi, Ltd., offers an integrated portfolio of services and solutions that enable digital transformation through enhanced data management, governance, mobility and analytics. We help globa...
Apr. 27, 2017 12:45 PM EDT Reads: 1,309
SYS-CON Events announced today that T-Mobile will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on ...
Apr. 27, 2017 12:30 PM EDT Reads: 1,233
Five years ago development was seen as a dead-end career, now it’s anything but – with an explosion in mobile and IoT initiatives increasing the demand for skilled engineers. But apart from having a ready supply of great coders, what constitutes true ‘DevOps Royalty’? It’ll be the ability to craft resilient architectures, supportability, security everywhere across the software lifecycle. In his keynote at @DevOpsSummit at 20th Cloud Expo, Jeffrey Scheaffer, GM and SVP, Continuous Delivery Busine...
Apr. 27, 2017 12:30 PM EDT Reads: 1,064
20th Cloud Expo, taking place June 6-8, 2017, at the Javits Center in New York City, NY, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy.
Apr. 27, 2017 12:15 PM EDT Reads: 3,154
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo 2016 in New York. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place June 6-8, 2017, at the Javits Center in New York City, New York, is co-located with 20th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry p...
Apr. 27, 2017 12:15 PM EDT Reads: 1,234
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend @CloudExpo | @ThingsExpo, June 6-8, 2017, at the Javits Center in New York City, NY and October 31 - November 2, 2017, Santa Clara Convention Center, CA. Learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
Apr. 27, 2017 12:00 PM EDT Reads: 1,344
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Apr. 27, 2017 10:45 AM EDT Reads: 2,211