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
SYS-CON Events announced today that Technologic Systems Inc., an embedded systems solutions company, will exhibit at SYS-CON's @ThingsExpo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Technologic Systems is an embedded systems company with headquarters in Fountain Hills, Arizona. They have been in business for 32 years, helping more than 8,000 OEM customers and building over a hundred COTS products that have never been discontinued. Technologic Systems’ pr...
SYS-CON Events announced today that Auditwerx 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. Auditwerx specializes in SOC 1, SOC 2, and SOC 3 attestation services throughout the U.S. and Canada. As a division of Carr, Riggs & Ingram (CRI), one of the top 20 largest CPA firms nationally, you can expect the resources, skills, and experience of a much larger firm combined with the accessibility and attent...
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of 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, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From ...
SYS-CON Events announced today that HTBase 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. HTBase (Gartner 2016 Cool Vendor) delivers a Composable IT infrastructure solution architected for agility and increased efficiency. It turns compute, storage, and fabric into fluid pools of resources that are easily composed and re-composed to meet each application’s needs. With HTBase, companies can quickly prov...
SYS-CON Events announced today that Loom Systems 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. Founded in 2015, Loom Systems delivers an advanced AI solution to predict and prevent problems in the digital business. Loom stands alone in the industry as an AI analysis platform requiring no prior math knowledge from operators, leveraging the existing staff to succeed in the digital era. With offices in S...
Buzzword alert: Microservices and IoT at a DevOps conference? What could possibly go wrong? In this Power Panel at DevOps Summit, moderated by Jason Bloomberg, the leading expert on architecting agility for the enterprise and president of Intellyx, panelists peeled away the buzz and discuss the important architectural principles behind implementing IoT solutions for the enterprise. As remote IoT devices and sensors become increasingly intelligent, they become part of our distributed cloud enviro...
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 ...
SYS-CON Events announced today that Infranics 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. Since 2000, Infranics has developed SysMaster Suite, which is required for the stable and efficient management of ICT infrastructure. The ICT management solution developed and provided by Infranics continues to add intelligence to the ICT infrastructure through the IMC (Infra Management Cycle) based on mathemat...
SYS-CON Events announced today that Interoute, owner-operator of one of Europe's largest networks and a global cloud services platform, has been named “Bronze Sponsor” of SYS-CON's 20th Cloud Expo, which will take place on June 6-8, 2017 at the Javits Center in New York, New York. Interoute is the owner-operator of one of Europe's largest networks and a global cloud services platform which encompasses 12 data centers, 14 virtual data centers and 31 colocation centers, with connections to 195 add...
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of 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. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and management into a ...
In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), will provide an overview of various initiatives to certifiy the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldw...
In his General Session at 16th Cloud Expo, David Shacochis, host of The Hybrid IT Files podcast and Vice President at CenturyLink, investigated three key trends of the “gigabit economy" though the story of a Fortune 500 communications company in transformation. Narrating how multi-modal hybrid IT, service automation, and agile delivery all intersect, he will cover the role of storytelling and empathy in achieving strategic alignment between the enterprise and its information technology.
Microservices are a very exciting architectural approach that many organizations are looking to as a way to accelerate innovation. Microservices promise to allow teams to move away from monolithic "ball of mud" systems, but the reality is that, in the vast majority of organizations, different projects and technologies will continue to be developed at different speeds. How to handle the dependencies between these disparate systems with different iteration cycles? Consider the "canoncial problem" ...
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...
Keeping pace with advancements in software delivery processes and tooling is taxing even for the most proficient organizations. Point tools, platforms, open source and the increasing adoption of private and public cloud services requires strong engineering rigor - all in the face of developer demands to use the tools of choice. As Agile has settled in as a mainstream practice, now DevOps has emerged as the next wave to improve software delivery speed and output. To make DevOps work, organization...
My team embarked on building a data lake for our sales and marketing data to better understand customer journeys. This required building a hybrid data pipeline to connect our cloud CRM with the new Hadoop Data Lake. One challenge is that IT was not in a position to provide support until we proved value and marketing did not have the experience, so we embarked on the journey ourselves within the product marketing team for our line of business within Progress. In his session at @BigDataExpo, Sum...
Web Real-Time Communication APIs have quickly revolutionized what browsers are capable of. In addition to video and audio streams, we can now bi-directionally send arbitrary data over WebRTC's PeerConnection Data Channels. With the advent of Progressive Web Apps and new hardware APIs such as WebBluetooh and WebUSB, we can finally enable users to stitch together the Internet of Things directly from their browsers while communicating privately and securely in a decentralized way.
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.
What sort of WebRTC based applications can we expect to see over the next year and beyond? One way to predict development trends is to see what sorts of applications startups are building. In his session at @ThingsExpo, Arin Sime, founder of WebRTC.ventures, will discuss the current and likely future trends in WebRTC application development based on real requests for custom applications from real customers, as well as other public sources of information,
In his General Session at 17th Cloud Expo, Bruce Swann, Senior Product Marketing Manager for Adobe Campaign, explored the key ingredients of cross-channel marketing in a digital world. Learn how the Adobe Marketing Cloud can help marketers embrace opportunities for personalized, relevant and real-time customer engagement across offline (direct mail, point of sale, call center) and digital (email, website, SMS, mobile apps, social networks, connected objects).