Welcome!

You will be redirected in 30 seconds or close now.

ColdFusion Authors: Yakov Fain, Jeremy Geelan, Maureen O'Gara, Nancy Y. Nee, Tad Anderson

Related Topics: ColdFusion

ColdFusion: Article

Developing Flex 2 Applications with ColdFusion and XML Without Needing FDS or Mystic

Solutions for the low-budget developer using HTTP services

Flex is one of the greatest technologies around. Combine it with ColdFusion and it just gets better. Adobe has made it possible to use Flex 2 efficiently with ColdFusion and easily get data across the server to a Flex front-end.

It's also released Flex data services that don't need ColdFusion to pass data in and out. However, these technologies might be outside the price range of a small developer or hard to deploy. Take FDS, for example. Of course Adobe has an Express edition, but deploying a good application for all the world to see hosted on your own computer is a hassle, and if you were to go out and look for a host that supports FDS it would cost you about $360 a year. Not a lot for some, but for an individual developer who's already paying for a solid ColdFusion host, it may be too much. Another technology that Adobe introduced was an update to Flash remoting in ColdFusion 7.0.2, yet most hosting providers won't support Flex connectivity on their servers, and again you'd have to buy a VPS, which would cost you $360 a year. Nevertheless, in the world of dynamic technology there are other alternatives. And ColdFusion-generated XML or what some might consider HTTP services is one of them. This is an easy way to get data from your MySQL, Access, and Oracle database and bring it into Flex, read it, update it, and if you want even delete records based on the user level. This article will discuss the basics of using this method, teach you how to build ColdFusion-based XML files, and bring them in and explain how you can use them in your Flex application.

The Background
Using XML as a data delivery source has been around since the dawn of Web 2.0 or before. Almost all Web 2.0 Web sites use XML as a method of delivering news using RSS to their users. Although this is a good way to use XML there are better ways. Instead of transporting news in XML what if you can transport the user data and authentication. Many sites such as Flickr and Blogger have an API that lets you to do this and, in fact, this is a good solution. Rather than getting FDS to retrieve data, we just encapsulate the data in an XML file that in turn is read by Flex and displayed. No Mystic, No FDS, just plain ColdFusion, XML, and Flex.

Why Use This Method over WSDLs, FDS, or Mystic?
There are different ways of getting data from a database and bringing it into your front-end like Web Services (WSDL). However, not a lot of developers who are starting off know how to create a WSDL or they don't have the time to learn how. Using ColdFusion-generated XML basically means creating a query and outputting it through some XML and cfloops. Any ColdFusion developer who is starting off can quickly harness this power and create applications in record time. After all, developing applications that are in demand is a race. Using this method is not restricted to Flex applications, you can create an application in virtually any modern programming language without modifying a single line of back-end ColdFusion code. How? Well, because XML is read, as I said, by any modern programming language, all you have to do is "hook up" the XML to the front-end via an HTTP service call. The application we're going to build in this article makes use of the HTTP service call rather than a Web Service call, and gets all the data back from the server and then the user can manipulate the data.

Another great reason to use this type of programming method is because you can "open" the back-end files or give the links to developers who are masters in their own field who can then develop third-party front-ends using your back-end. This can extend the reach of your site and deliver your data to more people, and will entice developers into creating mashups, where they take your data and using another API (as this is called) mash them up to create one heck of an application. An example would be if your application was a user-based contact manager, and after opening the API to developers, they could take the data and mash it into Google maps, where when you click on the contact it will show where the house is based on the ZIP code.

Time to Build Your Own Application
This isn't your boring old computer science class where all you did was learn theory and learn and learn. As a result instead of telling you more about this type of programming, why not just dive in and learn on the way. The Flex 2 application we're going to build will be an RSS manager, which will have user authentication and a place to keep and read all your favorite RSS feeds. (See Figure 1 for the final application.)

What we're going to create is a bunch of objects that will interact with the Flex application via an HTTP service call and then interact with the database via a cfquery. It will be a learning experience. You'll learn the basics of a Flex application and HTTP services. Also since we're not building a sophisticated application, we're not going to have Flex do the authentication. We'll leave that to ColdFusion simply because it's too hard and will take a lot of time otherwise. What this means is that even if the username/password combination is wrong, Flex will let the user pass through to the next step but there will be no data in the data grid.

It's possible to let Flex do the authentication, but this is just a proof-of-concept application, not a "real-world" one. What I hope is that you learn a little more about this method and then you can build on it however you want.

Getting the Tools
Since this is for the individual developer who wants to make the most out of a small budget, we'll be using tools that are completely free. The first thing you should do is go and download ColdFusion, which you should already have anyway. Next you'll want to downlaod the Eclipse platform along with CFECLIPSE (all the links are at the end of this article), which is a good ColdFusion IDE for coding, not designing. Seeing as how we're going to use ColdFusion just for coding CFECLIPSE is the way to go.

Next you'll want to download the Flex Builder and read up on the compiling instructions since this will be your tool to compile Flex applictions into Swfs that can be run on virtually any server. Yes, there is the free version of Flex 2 called the Flex 2 SDK However, Flex Builder 2 is more enchancing and will make coding a whole lot easier. I recommend that you download Flex Builder 2. In addition you'll also want to download a database technology such as MySQL or Oracle and create a DSN in the ColdFusion Administrator.

Architecting the Database
After that it's good practice to lay out your database first and create all the required tables. This way you can build your Flex 2 application and the ColdFusion code relying on the database rather than making guesses on the tables you'll create. So create a new DSN in the CF Admin named global since all the example code uses this DSN. There will be two tables in this simple application that we're going to create. The first will be a user table that will hold all our user data. It will also add the values Faisal, Faisal (user, pass) and the values Abid, Abid (user, pass). If you want, you can add more, but this application is just a concept application. If you're using MySQL as a database then here's the code:

CREATE TABLE 'CFDJ_users' (
    'member_ID' int(11) NOT NULL auto_increment,
    'Username' varchar(255) NOT NULL,
    'Password' varchar(255) NOT NULL,
    PRIMARY KEY ('member_ID')
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

INSERT INTO 'CFDJ_users' VALUES (1, 'Faisal', 'Faisal');
INSERT INTO 'CFDJ_users' VALUES (2, 'Abid', 'Abid');

Then you'll want to create your RSS table. In this table the user will post a link for an RSS feed and a name to go with it, so the user can come back days later and click on the link and get the feed delivered instantly. You're going to need just four fields for this: an RSS ID field that will be your primary, a username field, an RSS link field, and last an RSS name field. If you did this in MySQL here is the code:

CREATE TABLE 'CFDJ_RSS' (
'Rss_ID' INT NOT NULL AUTO_INCREMENT ,
'Username' VARCHAR( 255 ) NOT NULL ,
'Rss_Name' VARCHAR( 255 ) NOT NULL ,
'Rss_Link' VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( 'Rss_ID' )
);


More Stories By Faisal Abid

Faisal Abid is a third-year student at West Hill CI and loves Flex, ColdFusion, and rich Internet applications. He is also the founder and owner of G-uniX Technologies (www.G-uniX.com), an RIA software development consultancy based in Toronto that specializes in Flex 2 and ColdFusion applications. He has a blog at blog.G-uniX.com that he updates bi-weekly with G-uniX news, Flex tutorials, ColdFusion tutorials, and Spry tutorials.

Comments (1) 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
shawn gibson 02/21/07 06:42:51 AM EST

Trying to get this running but I get the following errors in Flex: The reference to entity "Pword" must end with the ';' delimiter.

...any idea what that means? I comment it out, and the same error appears for all the HTTPService lines. Shawn

@ThingsExpo Stories
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo 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 ...
In his keynote at 19th Cloud Expo, Sheng Liang, co-founder and CEO of Rancher Labs, discussed the technological advances and new business opportunities created by the rapid adoption of containers. With the success of Amazon Web Services (AWS) and various open source technologies used to build private clouds, cloud computing has become an essential component of IT strategy. However, users continue to face challenges in implementing clouds, as older technologies evolve and newer ones like Docker c...
DXWorldEXPO LLC announced today that ICC-USA, a computer systems integrator and server manufacturing company focused on developing products and product appliances, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City. ICC is a computer systems integrator and server manufacturing company focused on developing products and product appliances to meet a wide range of ...
Business professionals no longer wonder if they'll migrate to the cloud; it's now a matter of when. The cloud environment has proved to be a major force in transitioning to an agile business model that enables quick decisions and fast implementation that solidify customer relationships. And when the cloud is combined with the power of cognitive computing, it drives innovation and transformation that achieves astounding competitive advantage.
Cloud-enabled transformation has evolved from cost saving measure to business innovation strategy -- one that combines the cloud with cognitive capabilities to drive market disruption. Learn how you can achieve the insight and agility you need to gain a competitive advantage. Industry-acclaimed CTO and cloud expert, Shankar Kalyana presents. Only the most exceptional IBMers are appointed with the rare distinction of IBM Fellow, the highest technical honor in the company. Shankar has also receive...
Michael Maximilien, better known as max or Dr. Max, is a computer scientist with IBM. At IBM Research Triangle Park, he was a principal engineer for the worldwide industry point-of-sale standard: JavaPOS. At IBM Research, some highlights include pioneering research on semantic Web services, mashups, and cloud computing, and platform-as-a-service. He joined the IBM Cloud Labs in 2014 and works closely with Pivotal Inc., to help make the Cloud Found the best PaaS.
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
DXWorldEXPO LLC announced today that All in Mobile, a mobile app development company from Poland, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. All In Mobile is a mobile app development company from Poland. Since 2014, they maintain passion for developing mobile applications for enterprises and startups worldwide.
Headquartered in Plainsboro, NJ, Synametrics Technologies has provided IT professionals and computer systems developers since 1997. Based on the success of their initial product offerings (WinSQL and DeltaCopy), the company continues to create and hone innovative products that help its customers get more from their computer applications, databases and infrastructure. To date, over one million users around the world have chosen Synametrics solutions to help power their accelerated business or per...
We are seeing a major migration of enterprises applications to the cloud. As cloud and business use of real time applications accelerate, legacy networks are no longer able to architecturally support cloud adoption and deliver the performance and security required by highly distributed enterprises. These outdated solutions have become more costly and complicated to implement, install, manage, and maintain.SD-WAN offers unlimited capabilities for accessing the benefits of the cloud and Internet. ...
Founded in 2000, Chetu Inc. is a global provider of customized software development solutions and IT staff augmentation services for software technology providers. By providing clients with unparalleled niche technology expertise and industry experience, Chetu has become the premiere long-term, back-end software development partner for start-ups, SMBs, and Fortune 500 companies. Chetu is headquartered in Plantation, Florida, with thirteen offices throughout the U.S. and abroad.
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...
I think DevOps is now a rambunctious teenager - it's starting to get a mind of its own, wanting to get its own things but it still needs some adult supervision," explained Thomas Hooker, VP of marketing at CollabNet, in this SYS-CON.tv interview at DevOps Summit at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"MobiDev is a software development company and we do complex, custom software development for everybody from entrepreneurs to large enterprises," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Major trends and emerging technologies – from virtual reality and IoT, to Big Data and algorithms – are helping organizations innovate in the digital era. However, to create real business value, IT must think beyond the ‘what’ of digital transformation to the ‘how’ to harness emerging trends, innovation and disruption. Architecture is the key that underpins and ties all these efforts together. In the digital age, it’s important to invest in architecture, extend the enterprise footprint to the cl...
Data is the fuel that drives the machine learning algorithmic engines and ultimately provides the business value. In his session at Cloud Expo, Ed Featherston, a director and senior enterprise architect at Collaborative Consulting, discussed the key considerations around quality, volume, timeliness, and pedigree that must be dealt with in order to properly fuel that engine.
Two weeks ago (November 3-5), I attended the Cloud Expo Silicon Valley as a speaker, where I presented on the security and privacy due diligence requirements for cloud solutions. Cloud security is a topical issue for every CIO, CISO, and technology buyer. Decision-makers are always looking for insights on how to mitigate the security risks of implementing and using cloud solutions. Based on the presentation topics covered at the conference, as well as the general discussions heard between sessio...
IoT is rapidly becoming mainstream as more and more investments are made into the platforms and technology. As this movement continues to expand and gain momentum it creates a massive wall of noise that can be difficult to sift through. Unfortunately, this inevitably makes IoT less approachable for people to get started with and can hamper efforts to integrate this key technology into your own portfolio. There are so many connected products already in place today with many hundreds more on the h...
No hype cycles or predictions of zillions of things here. IoT is big. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, Associate Partner at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He discussed the evaluation of communication standards and IoT messaging protocols, data analytics considerations, edge-to-cloud tec...