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: http://learn.adobe.com/wiki/display/Flex/Part+II.+Exchanging+Data) 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, ASP.net, 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:
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!
Not promoting ColdFusion.... can you believe the nerve of those guys?
Thanks for pointing it out. I am sure they'll fix it quickly.
DW
I updated that page and a few others. Please let me know if you see any others.
Randy Nielsen
Flex Documentation Manager
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.
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?