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.

19 responses to “Understanding the ColdFusion Flex Relationship”

  1. Bryan F. Hogan Avatar
    Bryan F. Hogan
  2. seancorfield Avatar

    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?

  3. Roman Avatar

    How different are the goals of Microsoft’s XAML and Macromedia’s Flex?

  4. Ben Forta Avatar
    Ben Forta

    Roman, read this thread in Jesse Ezell’s blog, especially Dave Mendels’ comment:

  5. cubny Avatar

    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

  6. Bryan F. Hogan Avatar
    Bryan F. Hogan

    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.

  7. Ben Forta Avatar
    Ben Forta

    It is still in beta. Details are at

  8. Ray Avatar

    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?

  9. Bryan F. Hogan Avatar
    Bryan F. Hogan

    I couldn’t have said it better myself Ray!! +100

  10. cubny Avatar

    ok tnx… but i cant see your mxml pages that u linked in your blog… 😉

  11. Ben Forta Avatar
    Ben Forta

    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.

  12. Hans Avatar

    Which project is Blackstone again? The next rev of CF?

  13. Igor Ilyinsky Avatar
    Igor Ilyinsky

    Hans, yes.

  14. Emanuel Costa Avatar
    Emanuel Costa

    12 grand for Flex??? Is this right?! I could not believe the price! I will probably not work using Flex for while…

  15. vience Avatar

    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 displays the error msg
    the screen shot imge url is
    screen shot1
    screen shot1
    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 "JRun4serverscfusioncfusion-earcfusion-warWEB-INFflex", 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

  16. Johnny Avatar

    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?

  17. Mike Avatar

    Most examples that I have seen (including your great dashboard example at 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!

  18. will Avatar

    Very good tutorial about making the CF – Flex connection. Very simple excercise pulls data as CF query via CFC and presents as Flex datagrid.

  19. Chandan Avatar

    Good Information appreciate u taking time to make things clear for the beginners with Coldfusion and Flex

Leave a Reply