Talk:CF Adapter
From Adobe Labs
Welcome to the CF Adapter for Flex 2!
For any Support Questions, bugs, or enhancment requests with the ColdFusion Adapter please make your post in the Macromedia Forums.
| Table of contents |
CF Adapter and MachII
Will we see a fix released for the cf adapater / machii issue anytime soon? It's been a couple of months since I last checked and still no fix. --Nathan Hunsaker
There appears to be an issue with installing the CF adapter and Machii. Normal apps work fine, but machii apps get involking errors. Once the hf701-61119.jar file is removed, Machii applications work again.
there are no issues that I'm aware of. Doe's MachII use the CFCProxy? Can you send me an example app to try? --nimer mnimer@macromedia.com
Mach II is pure, simple CF code and does not rely on any built-in CFMX magic. -- Sean Corfield
I havent been able to get the adaptor working yet but can confirm that all my Mach-ii seems to have broken. I will have more of a look into it soon
--Wayne McFetridge
couldn't get the adaptor working neither...but dito; all MachII-App didn't work until I removed hf701-61119.jar file. -- Daniel Schmid
CF Adapter and ModelGlue
The CFC adapter seems to break ModelGlue as well. It causes a returnType error in ModelGlue.Core.Controller. More info may be found at my blog.
Yep, can confirm this as well! My guess it's something with creating objects/instantiating CFC's --cf_dutch 09:34, 28 Nov 2005 (PST)-
Missing Instructions
I was excited to get the adapter working when I downloaded it, but It's hard to get it going when entire steps in the instructions are missing. Step 4 under the title "To use the CFC resource in your Flex Builder 2 project, you do the following:" does not have the example code that it alludes to.
I think you are talking about this step
>You can then call a CFC method, for example, the following uses the Click event when a button is pressed:
Basically you just need to call the id of the remote object, and the method in your CFC. <mx:Button click="my_CFC.getSomeData(arg1, arg2);">
[renaun] Any Instructions of using CF Adapter with a J2EE War installation? I installed a CF MX 7.0.1 WAR. I installed the jar and xml files per the instructions. When I change the web.xml and restart it throws an error on startup.
Adapter Slightly not adapting
I have tried this a couple of times and couldn't get it going. IS there some code example to use this? If so can we put it up.
Yes, we need some code examples. I can not get this to work.
Sample will be posted with the next version of the adapater (v2), hopefully later today. ---nimer
I think this mxml will help people
The example given by MM is kinda funky, this one shows two seperate methods and the proper imports that are needed to make it work. Feel free to edit, if I am doing something wrong here. I appologize for my lack of formatting i'm a newbie on this wiki. If someone can educate me, i'll repost.
- drisgill
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*">
<mx:RemoteObject id="my_CFC" destination="TestFunction" showBusyCursor="true">
<mx:method name="cfc_function1" result="cfc_function1_result(event)"/>
<mx:method name="cfc_function2" result="cfc_function2_result(event)"/>
</mx:RemoteObject>
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;
private function cfc_function1_result(event:Event){
mx.controls.Alert.show(ObjectUtil.toString(ResultEvent(event).result));
}
private function cfc_function2_result(event:Event){
mx.controls.Alert.show(ObjectUtil.toString(ResultEvent(event).result));
}
]]>
</mx:Script>
<mx:Button label="Get 1st Method" click="my_CFC.cfc_function1('param1','param2');"/>
<mx:Button label="Get 2nd Method" click="my_CFC.cfc_function2('param1','param2');"/>
</mx:Application>
Enhancement Request for CF_Adapter
It would be great that Flex Builder could connect to the local/remote server with RDS like Dreamweaver does.
We could have a CFC panel with all available cfcs that we could convert into destinations. A dialog could ask for some properties what CF would use to update the XML destination files.
Also for compilation, connection to those services would be great to be accessed remotly to avoid having a duplicated file localy.
[mike] When we release the RDS panel for CFEClipse you can use that in Flex Builder too. However, we haven't done anything with a CFC panel, yet - great enhancement idea, I'll log it.
thanks, ---nimer
This is definitely needed. I strongly agree!
Mark
configuration problems
hi
i'm trying to use the cf_adapter but can't get it work. followed the mm instructions.
i put amf.cfc into the cfide folder in wwwroot.
so the config in the sample should look like this
<destination id="amf_test">
<channels>
<channel ref="my-cfamf"/>
</channels>
<properties>
<source>CFIDE.amf</source>
<lowercase-keys>true</lowercase-keys>
</properties>
</destination>
my first question: what is the channel tag good for? and is my config correct?
in the .mxml i use this code for the remoteobject
<mx:RemoteObject id="my_CFC" destination="amf_test" showBusyCursor="false"> <mx:method name="getString" result="cfc_function1_result(event)"/> </mx:RemoteObject>
and on the button <mx:Button label="Get 1st Method" click="my_CFC.getString();"/>
am i doing something wrong?
thanks
[Mike] That looks correct? Are you running with the built in web server on port 80, or a different configuration? To answer two questions at once, the channel attribute is a reference to another part of the flex-services.xml file (which tells the swf and the server where to listen for requests).
open up your flex-services.xml and make sure the endpoint (are you using a j2ee context root?) and port are correct in this line: endpoint uri="/flex2gateway/" port="8500" class="flex.messaging.endpoints.AMFEndpoint"/
email me if you are still having problems, ---nimer
How do you call a remote cfc?
How should we call the CFC from the flex application, if the Coldfusion MX 7 server is not running on the same machine? Do we need to install the flex framework on the remote server or is the adapter sufficient? This situation is likely to occur as a lot of people are using a development machine and then load the project onto a remote server (at least me...) How can I test my CFC without installing Coldfusion MX developper version on my development machine, or Flex framework on the remote server? And I clearly don't want to do the latter with an alpha version.
Cannot get the remoting to work at all. Set up coldfusion local server as indicate in mm files. I know the cfc is not the problem because I can use it as a web service in Flex 2, and it returns the values.
I think the problem has to do with specifying the cf server. If there is no URL associated with the remote object call, how does flash know to connect to the local server, or any other server? As another poster stated, there has to be some way to tell flex what server to connect to.
[Mike]
There is a URL associated with it, it's defined in the flex-services.xml. Your mxml links to a "destination", the destination is linked to a "channel" and the channel has an "endpoint" defined. It's the endpoint that defines the server URL.
By default the endpoint url is relative "/flex2gateway/" which is assuming that you are serving the swf from the CF server, not from a different server. I believe you can change this to be a full path (don't forget to set the port right too) "http://yourdomain.com/flex2gateway/"
One other thing, your local copy of Flex Builder and the CF server both need access to the "\WEB-INF\flex\flex-services.xml" file. If you can map a drive to your CF server, great. However if you can't, you can point your CF Server at a local copy of the flex-services.xml file - just make sure it's the same as the copy on the server.
hth, ---nimer
How to put into production
OK, I got it to work for a very simple CFC using my local testing server. I still dont understand how this would work if I wanted to load it onto a production server (just for testing). For sake of argument, I installed the adapter and configured my production server.
If I compile the file locally, then upload the swf to my production server, won' t the swf still be looking for the remote cfc on my local machine?
[Mike]
Right now, you'll need to recompile the swf, one last time, and point it at the flex-services.xml on your production box (or a local copy of it). And then deploy that .swf.
[PBJ] I have tried this and found that it still looks for the local ( Developer PC ) for the CFC. I have proven this by stopping the coldfusion server on local box then open url on production coldfusion server. Can someone give us more information on this. Mike's very confusing and short responce leaves much to be desired.
Securing CFC methods from CF Adapter & Remoting 3
[James] I noticed that the access attribute in cfc cffunction tags doesn't affect Remoting 3 like it did Remoting MX. I've tried all the previous settings (public, private, package, remote) and everything but private allows remoting to access methods.
Is ColdFusion being updated to meet this change?
[Mike]
Yes, that is a bug.
Thanks!
---nimer
[James] Thanks!
On this same subject of security, will there be a way to secure CFC's for remoting only through the flashgateway and restrict url/ wsdl/ webservice/ flash IDE access?
Currently, there are 'hacks' to determine if the request originated through the flashgateway but locally created swf's can still get around these.
[Mike] There are no plans for this right now. But it is a good enhancement request, I'll add it to the bugtracker.
Support forums?
It mentions forums at the top of this, any idea where?
Also having problems getting the new samples to work,:
Couldn't establish a connection to 'Usermanager_userCollection'
Is the current error I get which I guess is not connecting to the cfc. Any particular bits I should be looking at to solve this initial hurdle?
[mike] Make sure you have the compiler argument set correctly in your Flex Builder project.
[doug] The compiler argument is OK I think;
--services=D:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\flex\flex-services.xml
I do get a compiler error though: 2 java.lang.RuntimeException: org/apache/xpath/CachedXPathAPI usermanager
And I have no clue where to start looking for this one.
[Mike] Are you running eclipse against Java 1.5? There is a known 1.5 bug, you need to run it with 1.4 ---nimer
[doug] that fixed it, i was running jre 1.5 thanks
[Adrian] This Forum Thread has instructions for changing the Java VM for eclipse. In my case, however, this didn't fix the problem.
New Project .cfc File Location
I have successfully setup the adapter and was able to modify/compile/test the available demos without trouble (well clearly a little trouble, but I persevered.). I then decided to move onto creating my own Swift window that interacted with ColdFusion and ran into some trouble about where I located my .cfc files. I had run the demos out of my ColdFusion root as instructed and the .cfc files were located for example:
C:\CFusionMX7\wwwroot\CFIDE\samples\cfdatatypes\DataSamples.cfc
And the corresponding code was added to the coldfusionsamples.xml as instructed. And everything worked great.
When I created my own application I wanted to use:
C:\CFusionMX7\wwwroot\mytestsite\mytest.cfc
And I put the corresponding xml in the coldfusionsamples.xml file like I had for the provided examples modifying the <source> for the new path:
<destination id="mytest">
<channels>
<channel ref="my-cfamf"/>
</channels>
<properties>
<source>mytestsite.mytest</source>
<lowercase-keys>true</lowercase-keys>
</properties>
</destination>
And it doesn't work. Upon further testing here is a quick summary:
1. The error thrown was simply a Swift looking grey window popped up saying “Error” with an OK button. No missing file error, or any explanation.
2. I was able to place my own .cfc files anywhere along the path used for the example applications with the corresponding changes in coldfusionsamples.xml:
C:\CFusionMX7\wwwroot\CFIDE\samples\cfdatatypes\DataSamples.cfc
And the programs interacted perfectly with ColdFusion. Even if I just put the .cfc in the wwwroot and properly modified the <source> in the xml. But if I strayed from the path it didn’t work.
So moving on to my questions. Why might this be? I’ve looked through coldfusionsamples.xml and flex-services.xml and nothing jumped out to explain this. I guess I’m looking for a little more detail surrounding how the adapter really works and what restrictions are on where .cfc files can go. Is coldfusionsamples.xml only set up for the provided examples and not for new projects? How do I create a new project and the proper xml locator files? Clearly I’d like to create a new ColdFusion application project in the development web root C:\CFusionMX7\wwwroot\mysite\ and also put some Flex in it and edit, develop, and text ColdFusion, Flex, and html from the same location.
Apologies if I’m too verbose, missing something stupid, etc. Any help would be appreciated.
-Dave
[Mike] Everything sounds like it's setup correctly. but... A few things to try, let me know if any of them fix it. 1) is your CFC file name lowercase too (the same case as what you defined in your coldfusionsamples.xml) 2) is there a IIS virtual directory pointing at "mytestsite", if so, remove it. But the way you have it set up it looks like a regular folder.
if neither of these work, email me directly please. --nimer
Loading onto production server
I have a Windows 2003 box running IIS. On this box I have CFMX7 with updater installed and have loaded all of the adapter files. I am running several virtual servers on this box, all configured with CFMX7. One of the virtual servers points to a directory E:\testing as its root folder. I assume that I need to load and configure the Web\inf files for each virtual server, correct?
So, in the example above, when I compile the swf, I have to add E:\testing\WEB-INF\flex\flex-services.xml to the compiler arguments. Obviously, it will not compile on my local machine with this setting. How do I handle this? Or am I configuring this production server al wrong??
[Mike] Yes, but you want to put the WEB-INF/flex/flexservices.xml file under your coldfusion web root, not the web server webroot. yes there is a difference. If you look in the cfusion folder where CF is installed. There is a wwwroot folder, which already has a WEB-INF folder there. You want to add flex-services.xml under this folder. And yes you need to do it for each installed version of ColdFusion. hth, ---nimer
What exactly is in the CF Adapter?
The documentation is pretty short on what the CF Adapter actually does. I understand that it handles some strong-typing/case-sensitivity issues, since ActionScript 3 is strongly-typed and case-sensitive. I also have in my notes from Max that it integrates with CFLogin. But there is nothing in the documentation here that says what the adapter does-- just a few code samples.
So assuming that I install it correctly and get it working, what does it actually do?
[Bill] Well, in short, the CF Adapter provides the connection between flex2 applications and your web application server, making it fast and easy to create Rich Internet Applications.
Are you familiar with what CF allows you to do? http://www.macromedia.com/software/coldfusion/
With these combined technologies you would be able to build rich front end UIs in Flex builder that have access to any of the features that CF exposes, like, mail, reporting, databases. And the AMF protocal is significantly faster then web services so there are performance benifits. You could even build interfaces to SMS text-messaging, instant messaging clients, and other Internet protocols to reach customers in new, exciting ways.
Couldn't establish the connection with...
Hi, I have a problem with samples files that I trying to test :
All the configuration seems like good, but when I'm testing the cfdatatypes examples (c:\inetpub\wwwroot\CFIDE\sample\cfdatatypes), the Flex project launch but when I tried to click on "string" button or another button I have this error message : Couldn't establish a connection to 'DataSamples'.
And I have always the same message also with the other example FlexMail.
Configuration : COLD on localserver + IIS on port 80 on flex-services.xml, I try the two port configuration 80 or 8500, but same problem.
In fact the application doesn't seem to be connect with the CFC like ??
Some Help. Neo
I had this same issue when trying to use Firefox as the default browser. Try changing the default browser to IE or opening the file in Firefox with the "http" protocol instead of the "file" protocol. You can also change a setting in the project options to get Firefox to use http instead of file, but I forget what it is. -- Mike Rankin
I'm having this problem too. I tried it on 3! different boxes.... and no luck. Got all the settings as they should. I use the multi server config. I tried it on a 7.0.1 version fully patched, a 7.0.1 updated version (no hotfixes after 7.0.1) and on a clean 7.0.1 install (latest version of CF from the download section)... without any luck. I had the 50% of the samples running with connector 0.2 but that also doesn't work anymore. --cf_dutch 09:40, 28 Nov 2005 (PST)
(Michael van Leest)
CF Adapter and Linux
Are there instructions for installing the CF Adapter in a Linux environment? I don't have a wwwroot or a WEB-INF folder to work with.
Where should these go in a linux environment?
-Mike
I'm in the same boat. Every piece of documentation and sample code I see is either:
a) aimed at local development b) written for windows boxes
Mike - Depending on how you setup CF MX, your WEB-INF folder will either be in your webroot (/var/www/html for Fedora for example) or in the coldfusionmx install dir (/opt/coldfusionmx/wwwroot/). If you are running Coldfusion as its own server, and not on top of Apache, you'll find it in the latter location.
MXML not parsing
Hi ya all
Have installed the CF Adapter into my CF/JRUN instance. However when I hit any MXML file - I get the xml dump. My CF is not parsing MXML?
Any ideas on how to check?
João Fernandes 16:02, 15 Nov 2005 (PST)
Your CF won't parse any MXML since that's a Flex Server job. In Flex Builder 2 you compile your mxml files and deploy the generated swf into your server.
CF Flex Deployment Test Not Working
I’m trying to test a CF and Flex deployment and I’m having the following problem. When I access the flex application from a remote computer over the web the flex part works great, but any calls the application needs to make to Coldfusion simply don’t run. No errors throw, simply nothing happens. However, the application has no trouble accessing ColdFusion when it’s being tested on the hosting computer. A couple thoughts:
1. Do I need to change some settings in IIS? ColdFusion and Flex hosting are each working fine on their own, just not in combination.
2. Do I need to do something different when I move the files from the CF wwwroot to the IIS wwwroot? It works fine in the IIS root when testing on the hosting computer, but not from a remote connection.
3. Do I need to open ports in the firewall? I tried opening port 8500, but this didn’t work. How does the remote computer viewing the flex communicate with ColdFusion, port 80?
4. I’m not using JRun (or any other App server), but as I interpret it, I don’t need to use an App server for Flex 2.0? My tests hosting Flex 2.0 without one seem to work, but obviously my test hosting Flex and ColdFusion isn’t working properly yet.
5. From what I’ve read I don’t need to place any of the Flex ColdFusion Adapter files in the IIS wwwroot, all of that remains in the CF wwwroot? Do I place need to place anything in the IIS wwwroot besides the html and swf files? I leave the cfc in the CF wwwroot where the WEB-INF\flex\coldfusionsmaples.xml points to it?
I’m sorry if any of these questions seem silly. I’m kind of new to a lot of this and I’m sure I’m just missing some small detail.
-Dave
How to handle a query result set coming back from a CFC?
Can anyone share the syntax required to use the result set of a CFC (return type = Query) as the data provider for a ui component, such as a list component?
Thanks,
BobK
Maybe this will help, when I return a CF Query and want to put it into a graph I use the following action script in the return event handler:
var queryResult:ArrayCollection = ResultEvent(event).result;
var subList:ArrayList = ArrayList(queryResult.list);
var graphArray:Array = Array(subList.source);
graphArray can then be used as the input array for a Flex graph or other objects. You can also select out other parts of the CF Query result using simlar syntax.
-Dave 12/5/2005
Can you give complete code snipet? -RJH
Compiler Arguments errors
I am getting an error when I add the services argument to the Flex compiler.
The error is: java.lang.RuntimeException: The string "--" is not permitted within comments.
I get this in any project that I add a services argument to. the argument that I am using is the default services=C:\CFusionMX7\wwwroot\WEB-INF\flex\flex-services.xml
Any suggestions?
Make sure you are not using cf style comments in the xml file. That's usually the way I trigger that. --AnoPres 18:11, 25 Jan 2006 (PST)
Modifying web.xml may cause big hosting issues
Is the requirement to edit the web.xml file going to go away in future releases of Flex? It seems to me that this could present a huge hurdle in any hosting environment. I can't imagine an isp allowing one of their customers to modify files in the CF installation. How would they handle multiple domains on a single box (shared hosting)?
It seems like the modifications to the web.xml file are going to be pretty formulaic. Is it possible that this could be auto-generated in much the same way that cf classes are created?
--AnoPres 19:07, 3 Jan 2006 (PST)
