Corrections To Flex Exchanging Data With ColdFusion Backend Posted on Adobe's Flex Developer Center

I was recently working my way through a Flex tutorial on exchanging data with a backend ( see: provided by Adobe's Flex Developer's Center. The example in Adobe's tutorial uses the Flex HTTPService to consume XML produced by ColdFusion (there is also backend code for Java,, and PHP provided). Unfortunately, there are some mistakes in the ColdFusion backend code that prevented me from getting the example using ColdFusion on the backend to work. I posted a comment about the problem to the page and pointed readers to this blog entry.

See: /flex/flexcfhttpservice/FlexCFHttpService.html for a working example from the above tutorial. You can right click on the application and get the source code with the corrections noted below.

Corrections to the example code:

1. In file FlexCFHttpService.mxml, the HTTPService tag uses the method="post" attribute. Given how the ColdFusion code is structured, the method value should be "get" since the CF code is structured to receive the parameter values as URL variables.

2. In file XMLHttpService.cfm, there is a missing 'a' for argumentCollection=...

3. In file XMLHttpService.cfm, just before outputting the #userXML# you should add the following:

<cfcontent reset ="yes" type="text/xml; charset=UTF-8">

The cfcontent tag with the reset = "yes" attribute discards any output that may have leaked out to the browser. This is important since there should not be any output prior to the ?xml... tag. The type attribute of the cfcontent tag specifies that the returned content is XML.

Once I made the above changes the example worked fine with the ColdFusion backend code.

Mini-RANT! In the first part of the above example's explanation on the Adobe site, the author specifies the following under the heading "what you will learn."

Submit user-supplied parameters to PHP, Java or ASP.NET HTTPService call.
Handle returned plain text or XML data from a PHP, Java or ASP.NET HTTPService call.

Notice that ColdFusion is NOT mentioned. However if you dig through the subsequent pages for this tutorial, the ColdFusion backend code is provided. Come on Adobe, promote your own superior backend technology!

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
You get 'em Bruce.

Not promoting ColdFusion.... can you believe the nerve of those guys?

Thanks for pointing it out. I am sure they'll fix it quickly.

# Posted By Dan Wilson | 11/21/07 5:37 PM
Hi Bruce,
I updated that page and a few others. Please let me know if you see any others.

Randy Nielsen
Flex Documentation Manager
# Posted By Randy Nielsen | 11/27/07 3:06 PM
thanks for this entry
# Posted By Jeneratorler | 3/27/08 6:38 AM
I am a contractor working for the Army and have been writting CF for over 10 years for these guys. I am diligently trying to get my skills up to speed with this technology. We have a Platinum Maintenance plan and I am hammering Adobe with this very thing. I also got the exact same code and the only one that worked was the PHP example. This is still an open ticket. I will make the necessary code changes and if it works like I believe it will I will be just a little angry about it.
The Tech, which I will NOT say his name said it was a security issue with my local install of IIS 5.5. That sounded a little fishy considering that I have not had any issue with anything else that I have developed.

Wish me luck and I am certain that this will look good.
# Posted By Gene | 4/8/08 8:52 AM
Hi Gene,
I just tried the CF and JSP apps in the zip files downloaded from the Flex 3 Getting Started Experience and all of them worked. Can you please give me a little more detail?
# Posted By Randy Nielsen | 4/10/08 9:37 AM
BlogCFC was created by Raymond Camden. This blog is running version Contact Blog Owner