Thursday, September 02, 2010    
Home My Books Blog ColdFusion About Me Back    

Calendar
<< Sep 2010 >>
S M T W T F S
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    

Search

Categories
 • Acrobat (5) [RSS]
 • Adobe (97) [RSS]
 • AdobeMAX06 (45) [RSS]
 • AdobeMAX07 (59) [RSS]
 • AdobeMAX08 (66) [RSS]
 • AdobeMAX09 (39) [RSS]
 • AdobeMAX10 (11) [RSS]
 • AIR (236) [RSS]
 • Appearances (200) [RSS]
 • Books (81) [RSS]
 • CFEclipse (15) [RSS]
 • ColdFusion (1418) [RSS]
 • ColdFusion Builder (9) [RSS]
 • Data Services (36) [RSS]
 • Fish Tank (5) [RSS]
 • Flash (259) [RSS]
 • Flex (516) [RSS]
 • Home Automation (5) [RSS]
 • Jobs (120) [RSS]
 • JRun (14) [RSS]
 • Labs (47) [RSS]
 • LiveCycle (35) [RSS]
 • MAX (242) [RSS]
 • Mobile (144) [RSS]
 • Regular Expressions (18) [RSS]
 • RIA (21) [RSS]
 • SQL (42) [RSS]
 • Stuff (544) [RSS]
 • Tips (CF Studio) (80) [RSS]
 • Tips (CF) (795) [RSS]
 • Tips (Dreamweaver) (91) [RSS]
 • Tips (Flex Builder) (2) [RSS]
 • Using CF (164) [RSS]

Other BLOGs
 • Charlie Arehart
 • Lee Brimelow
 • Ray Camden
 • Christophe Coenraets
 • Sean Corfield
 • Mihai Corlan
 • Cornel Creanga
 • Mark Doherty
 • John Dowdell
 • Danny Dura
 • Enrique Duvos
 • Steven Erat
 • Kevin Hoyt
 • Serge Jespers
 • Adam Lehman
 • Duane Nickull
 • Miti Pricope
 • Andrew Shorten
 • Ryan Stewart
 • James Ward
 • Greg Wilson
 • Full As A Goog

RSS Feeds
 • Feed
 • Subscribe

Join my mailing list and find out about new books and other topics of interest.

Thoughts, ideas, tips, musings, and pontifications (not necessarily in that order) by Ben Forta ...
NOTE: This is my personal blog, and the opinions and statements voiced here are my own.

Viewing By Entry / Main
March 19, 2004

Understanding the ColdFusion Flex Relationship

I've just been involved in a long thread with an individual who wanted to better understand the relationship between ColdFusion and Flex. Apparently, this is still a source of much confusion as I was asked similar questions at a user group earlier this week. So, I went back through the entire thread and distilled the relevant portions into the following, I hope this helps.

First of all, Flex is a server product that allows developers to generate Flash client-side SWF files on-the-fly by writing plain text source code files with tags in them. There are, therefore, similarities between ColdFusion and Flex:

* Like ColdFusion, Flex is a Java application deployed on top of J2EE servers. (A .NET version of Flex is planned for some future date).

* Like ColdFusion, applications are created as plain text files, and are placed on a server where there are compiled and processed on demand.

* Like ColdFusion .cfm files, Flex .mxml files are primarily tag based (although the language used is MXML instead of CFML).

As I said, there are similarities, and thus the confusion. But, there is also a major difference between ColdFusion and Flex. ColdFusion is an application development platform, it provides language elements and features for everything from programmatic flow control to database integration to Internet protocol support to UI generation to SOAP and XML processing and a whole lot more too. Flex, on the other hand, does not do any of this. Flex has one primary objective, and is laser focused on achieving it. Flex is all about the presentation layer, it is a presentation server and only concentrates on generating presentation front-ends and user interfaces.

This distinction is important. If you need database access from within a Flex application (and most will) then you will need a back-end to provide that access. If you need to generate e-mail messages you will need a back-end that knows SMTP. And if you need to access Internet protocols, implement business logic processing, handle user authentication and authorization, and more, you will need a back-end to do all that work.

This is not limitation of Flex, this implementation is deliberate and by design. As a Flex developer you are free to use the standard back-ends that work for you, including the back-ends you have already invested in. Flex simply provides you with a whole new way to create front-end applications, leveraging whatever investment you have already made (or will make) in back-end systems and technologies.

How does Flex talk to these back-ends? SOAP, straight HTTP calls, invoking Java objects, there are several options available to you. And what back-ends are supported? Basically, anything that can respond to SOAP calls, HTTP requests, and Java object execution. In other words, just about anything. And that includes ColdFusion. All versions of ColdFusion, any editions on any platform, can be used as back-ends for Flex applications. (Although ColdFusion MX is far better suited to be a Flex back-end than are prior versions, due to the Java underpinnings and the integrated SOAP support).

So, now that the differences between ColdFusion and Flex are clear, as is the understanding that these servers do not overlap and are in fact complimentary, what exactly is the technical relationship between them? There are two answers to this question, and they are quite different:

1) As already stated, Flex can leverage ColdFusion as a back-end, ideally via SOAP calls to ColdFusion Components. Any ColdFusion code exposed as a Web Service can be used by Flex, and very easily too. Flex understands ColdFusion data types, include queries, so, for example, a Flex DataGrid can be populated by a CFC method that returns a query without needing to massage the returned data at all. In this form of integration Flex and ColdFusion need not be installed on the same J2EE server, in fact, they need not even be installed on the same physical box. Flex can talk to any ColdFusion server anywhere (subject to security restrictions and settings). When a user requests a Flex page (a .mxml URL, not a .cfm URL) a Flash application is returned (by Flex, not by ColdFusion) and executes within the Flash player. That application then makes calls to ColdFusion for data and processing (probably using SOAP or Flash Remoting). From ColdFusion's perspective the flow and integration is no different from that of traditional Flash SWFs created using the Flash IDE.

2) It is also possible for ColdFusion pages (.cfm files) to render client-side SWFs dynamically (in much the same way as ColdFusion usually renders client-side HTML). How? Via JSP tags. CFML code can invoke JSP tags (which must first be imported into ColdFusion using the tag), this is a core ColdFusion feature independent of Flex. What makes it relevant to this discussions is that Flex comes with a JSP tag interface, allowing Flex tags to be used from within ColdFusion (and JSP) pages directly. In this form of integration Flex and ColdFusion must be deployed and running on the same server (the same J2EE server instance, that is), and so this does require ColdFusion Enterprise installed on top of a J2EE server (and not the standalone installation configuration). Using this interface users would not request .mxml URLs directly, they would request .cfm files as they usually would. The ColdFusion generated output would contain Flex generated SWF (which in turn could make calls back to ColdFusion if needed).

There are advantages to each integration option, and the decision as to which to use will (and should) likely be driven by application needs more than anything else.

But having said that, both options are viable, and both allow the creation of well designed n-tier applications, with Flex at the presentation tier, and ColdFusion at the business and logic tier.

Comments
# Posted By Bryan F. Hogan | 3/19/04 12:22 PM
Bryan, you would just configure the web server to pass .cfm / .cfc requests to a ColdFusion server and .mxml requests to a Flex server. Those could be on separate servers, or on the same server or however you wanted things configured. Does that answer your question?
# Posted By seancorfield | 3/19/04 1:42 PM
How different are the goals of Microsoft's XAML and Macromedia's Flex?
# Posted By Roman | 3/19/04 2:16 PM
Roman, read this thread in Jesse Ezell's blog, especially Dave Mendels' comment:
http://weblogs.asp.net/jezell/archive/2003/11/17/3...
# Posted By Ben Forta | 3/19/04 2:24 PM
hi there... would u please let me know how can I run MXML file on my own machine?! or where can I DL it's SDK? or whatever? I just wanna try it by myself. tnx
# Posted By cubny | 3/19/04 2:42 PM
Cubny, it's in Beta at MM and it is not available to the public yet.

Sean, yes that does answer my question. I realized how to do it after I posted.
# Posted By Bryan F. Hogan | 3/19/04 2:52 PM
It is still in beta. Details are at http://www.macromedia.com/software/flex/.
# Posted By Ben Forta | 3/19/04 3:10 PM
I understand why Flex is a presentation server and why MM it's deployment is on top of J2EE servers and why a .NET version is in the works.

Since Flex has been announced I have been wondering why MM is not more closely integrating it into ColdFusion? I understand that Flex and CF can communicate via SOAP but I would hope that tighter integration is planned for future versions of CF. I also wonder why MM created a new scripting language in MXML rather than leveraging the already existing and robust CFML?

# Posted By Ray | 3/19/04 4:01 PM
I couldn't have said it better myself Ray!! +100
# Posted By Bryan F. Hogan | 3/19/04 4:50 PM
ok tnx... but i cant see your mxml pages that u linked in your blog... ;)
# Posted By cubny | 3/19/04 5:17 PM
Ray (and Bryan),

At MAX in Salt Lake City we demod a prototype of very tight CF/Flex integration as a sneak look at Blackstone. We've not talked about Blackstone much since then, but we will start doing so shortly, and then we'll also discuss CF/Flex integration beyond what I described here.

As for the language, and why CFML was not used, the basic reason is that CFML does not have the tags that Flex needed. Aside from loop and include type operations, most CFML tags have no MXML counterparts, and the majority of MXML tags are oriented around UI creation which is not really something CFML even does. That, and the fact that CFML is not a strongly typed XML language, and Flex really needed that.
# Posted By Ben Forta | 3/20/04 11:02 PM
Which project is Blackstone again? The next rev of CF?
# Posted By Hans | 3/24/04 10:34 PM
Hans, yes.
# Posted By Igor Ilyinsky | 3/25/04 3:13 PM
12 grand for Flex??? Is this right?! I could not believe the price! I will probably not work using Flex for while...
# Posted By Emanuel Costa | 3/30/04 9:58 AM
hi:)
i'm using coldfusin redsky [J2EE configuration], the "Web Server Configuration Tool" has successfully made a connector to Apache2 [apache_2.0.48-win32-x86-no_ssl.msi].
The .cfm pages under the web server work fine.
Then i installed the "Flex" followed the issur "Installing Flex on ColdFusion MX".
Now the Apache Http server could successfully return a single pure .mxml page any where under the web server's web flouder.
it seems working fine, but the "dashboard" sample application fails.it displays the error msg

the screen shot imge url is
screen shot1
http://fayea.com/flex2.gif
screen shot1
http://fayea.com/flex1.gif
And some other application displays
"HttpService Fault: Internal server error" or "Webservice Fault: Could not load WSDL"
i 've already edited "flex-config.xml" under the "JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\flex", added the "<url>http://{localserver}/*</url>" line to http-service-proxy ,web-service-proxy .
Could some one help ? How can i make apache works with flex on coldfusion?
thanks a lot
# Posted By vience | 4/6/04 5:43 AM
My question is more on what is the relationship between Flash MX and Flex? It sounds like Flex can do what Flash MX does and more, and easier. So is there any possibility that Flash will be replaced by Flex?

Johnny
# Posted By Johnny | 4/29/04 1:23 PM
Most examples that I have seen (including your great dashboard example at Macromedia.com) focus on leveraging CFC's in Flex via SOAP as a web service.

Could you point me to an example of calling CFC's in Flex via remoting? Thanks!
# Posted By Mike | 2/9/05 8:26 PM
Very good tutorial about making the CF - Flex connection. Very simple excercise pulls data as CF query via CFC and presents as Flex datagrid.

http://www.kylehayes.info/captivate/QueryToDatagri...
# Posted By will | 12/19/07 7:48 PM
Good Information appreciate u taking time to make things clear for the beginners with Coldfusion and Flex
# Posted By Chandan | 10/2/09 2:19 PM

  © Copyright 1997-2009 Ben Forta, All Rights Reserved