Skip to content

Flex Builder, Remote Object and Coldfusion

June 27, 2012

What a nightmare.

I inherited a flex generated project a couple weeks ago and have been trying to set up the project in my local development environment since.  Today, I finally got flexbuilder to remote to ColdFusion.  A quick recap of the work involved.

1 – download the source code from SVN.  had to find my SVN credentials and remember how to checkout content to my local system.

2 – get MSSQL installed.  I had to remove SQL 2000, and install 2005.  Not too bad, although on my laptop, I could not get MSSQL 2005 to install the client software to save my life.

3 – Get the MSSQL2005 generated .bak file to import into my newly installed MSSQL 2005.  It took some work, I had trouble getting it to import, kept complaining about a different version of the generating software.

4 – Downloading ColdFusion.  I had removed my old version of CF about a year prior.  I downloaded and set up a local standalone version of ColdFusion 10.

5 – Created a DSN in ColdFusion to point to my new DB I had just restored from the .bak file from the code repository.  Figuring out that I did not have to specify a username or password, since I used windows authentication when installing CF.  This was a little confusing.

6 – Discovering that I still had a copy of FlexBuilder 3 on my tower.  Then determining that I could still use it for this project.  Discovered that Flash Builder has since deprecated FlexBuilder 3.  I applied for a free developer serial #, so I could download a copy of Flash Builder.  I did this when I was convinced I would never get the two working (flex and CF).

7 – Setting up  a flex project.  This was very confusing for me and turned out to be what caused most of my remoting frustration and problems.  Creating a new flex project with all its nuances is not trivial.  You have to know where to place the source code, output folders, webroots, etc.   If you get all that right to begin with, its less taxing.  If you don’t, which I did not, then you end up guessing where the problem is and doing things that once you solve the real problem prevent the correction from working.  I did this.

8 – Interpreting flex generated remoting error messages.  The nature of remoting is not trivial.  It allows Flex to call the DB, like an AJAX style.  The request is asynchronous, not the traditional old school HTTP request.  When this does not work, its a little harrowing, difficult to track down the exact problem.  As a result, you start doing things like moving files and messing with the flex connection files that live in the webroot\WEB-INF\flex folder.  Specifically, you start to tweak the services-config.xml and remote-services.XML configuration files, unnecessarily.

9 – In order to trouble shoot problems, you must know a little MXML and ActionScript code.  You actually need to know more than a little.  Flex is case sensitive, unlike PHP or CF.  More like JavaScript.

10 – Understanding that when flex code is finally void of syntax errors, it compiles into a .swf file, a flash movie.  A partner HTML file is also generated and is used by FlexBuilder to house the results of the build.  When I got my DB, DSN name, project set up and was able to compile the source code, I was very happy.  That was only half way.  It was then, after compilation, that I discovered the problem with the remoting.

11 – It was about this time that I started looking for ColdFusion generated errors.  I knew the problem was not with CF, but with the setup possibly of CF.  I spend a lot of time in the CFIDE looking at things like application error logs, Server Mappings (since things (components) could not find each other).  I asked to see settings of the the CFIDE in production.  That was another thing that could have been a problem.  The production version of CF was 8, I was working on 10.  Version 8 was not available for download at Adobe.

12 – Why won’t the remoting work?  The project I was working on has a bit too it, so I eventually created a small simple project, borrowing one from the Adobe flex site, compiled it and tested its remoting.  It did not work either.  Eventually I realized the cfc that I was trying to remote to needed to be positioned relative from the web server root, not the project root.   Once I moved the cfc from the project path and into the webroot, the remoting worked.

12 – Finally, once I removed a value from the Project Properties – Flex Server – Content Root area, I had placed a value their while trying to solve problem, I was able to get my application to connect.

That was A LOT of work to get this set up.  I knew it would be, which is why initially, when the project was assigned, I asked if a copy of the application and DB could be made on the respective DB and App servers.  I got shot down by the holder of the goods saying “you must recreate in your local environment”.  I knew he was right.  Oye I thought, this is going to be a lot of work, and it was.

Advertisements

From → Flex, MSSQL, Railo - CFML

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: