Flex 4 & ColdFusion 9 Remoting Recap
It’s been a couple of years since I worked with ColdFusion and Flex together, but I remember I always like the combination and chose it for my new little Xuland social networking project I’ve been working on (see previous posts).
I had to remember how the whole Flex-ColdFusion remoting setup would work again and I had to overcome a couple of hurdles. I thought I’d share the experience as it would have helped me get up to speed quickly.
Here’s a quick recap of setting up your Flex application to remote to ColdFusion:
- Install ColdFusion (I installed mine to the default C:\ColdFusion9 directory)
- In FlexBuilder, create a new Flex project
- While creating the project, select an Application server type of “ColdFusion” and check the “Use remote object access service” with the “ColdFusion Flash Remoting” option selected.
.
- On the next screen, in my case I’m using a Standalone installation and had to uncheck the “Use default location for local ColdFusion server”. Of course, the root folder was C:\ColdFusion9. I clicked Validate Configuration which validated that the root folder existed.
.
- I happen to use ColdFusion primarily for access to a MySQL datasource, so I had to setup the datasource in the ColdFusion admin first (this information should be readily available anywhere)
- Once the datasource was setup, I first created a value-object (VO) in ColdFusion to represent the object (in this case, a User) I wanted to pass back to the Flex application
.
UserVO.cfc:
1 2 3 4 5
<cfcomponent output="false" alias="com.xyz.coldfusion.vo.UserVO"> <cfproperty name="userID" type="numeric"/> <cfproperty name="username" type="string"/> <cfproperty name="password" type="string"/> </cfcomponent>
- After the VO, I created a data-access object (DAO) to query the datasource for a user and return a UserVO to the calling Flex application
.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<cfcomponent output="yes"> <cffunction name="getUserByID" access="remote" returntype="com.xyz.coldfusion.vo.UserVO"> <cfargument name="userID" type="numeric" required="yes"> <cfquery name="getUser" datasource="xuland"> SELECT * FROM tblUsers WHERE userID = '#userID#' </cfquery> <cfreturn getUser> </cffunction> </cfcomponent>
- Back in the Flex project, I setup my RemoteObject tag to point towards the ColdFusion DAO component I created in the last step:
.1 2 3 4 5 6 7 8 9 10 11
<!-- Remote Services --> <mx:RemoteObject id="userService" destination="ColdFusion" source="com.xyz.coldfusion.dao.UserDAO" showBusyCursor="true"> <mx:method name="getUserByID" result="resultHandler(event)" fault="faultHandler(event)"/> </mx:RemoteObject>
- Create your result and fault handlers (here we just display an Alert)
.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<fx:Script> <![CDATA[ import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; private function resultHandler( event : ResultEvent ) : void { Alert.show( event.result.toString() ); } private function faultHandler( event : FaultEvent ) : void { Alert.show( event.fault.faultString ); } ]]> </fx:Script>
- Finally create a button or method to call the service:
.1
<mx:Button click="userService.getUserByID( 1 )"/>
Much of this logic may be abstracted off into controllers, delegates, commands or other framework-specific components but this is a fairly simple example of installing, configuring and executing a remote object service call from Flex to ColdFusion.
Really appreciate you sharing this blog article. Keep writing.
Hi, I desire to subscribe for this blog to obtain hottest updates, therefore where can i do it please help out.
DASHCOM websites are springing up all over the world.
Just just because a link is on Piratebay does not mean that the users
are getting, and hence, the flawed data. The vulnerability has apparently been fixed
since interview with Russo occurred, and usernames are again safe and
secure.
One of the very most lucrative businesses women will go into is the creation of
accessories. s no secret that illegal file sharing continues to be rampant in several countries, like
the US, however, it will not be government interference that eventually leads on the
end with the age of illegal downloads. The free Lyrics Search
app can be obtained at the Android Market.
I’ve been surfing on-line more than 3 hours
these days, but I never discovered any attention-grabbing article
like yours. It is pretty value sufficient for me.
In my view, if all web owners and bloggers made just right content material
as you did, the internet will be a lot more helpful than ever before.
It’s amazing to pay a visit this site and reading the views of all friends regarding this article, while I am also eager of getting familiarity.
In the restaurant, we can create a little more,
and we do serve more people,” he said. They seemed desparate, and though I didn’t like boarding I said Ok. These types of books also provide accounts of the author’s achievement and also flaws that you can avoid and use to your advantage. The profitability of wind farms will therefore be higher if their production schedule coincides with these periods. Careful on-line research will turn up a multitude of opportunities for the ambitious virtual real estate wholesaler. Due to its compact size, contractors use it in close working conditions. If you want to invest in a piece of commercial real estate, think about the kind of tax breaks and benefits you might receive. The scope of these inspections is to document the condition of the property in both a written and photographic format before and after the tenant has occupied the premises. The intention is that your home will gain in value over time and that equity in your home will build as you age. They had called him, and I don’t know what they said, but somehow they had convinced him, not that I was dangerous along with my dogs, but that they were the culprits.
Of course, they can spider their own Google+ site, but
it has yet to reach universal adoption. Times have
definitely changed from when we used to peruse through
a newspaper to find an apartment. It is better not to ignore Word – Press
SEO training as it is very much necessary to be successful online.
With that said, there is still a good chance that an offer will be accepted
if you truly cannot afford to pay your back taxes. Accounting software will automate your
transactions, which helps eliminate a chance for error caused
due to manual data-entry mistakes. Many taxpayers choose to contact TAS because they
are dealing with a tax debt.
For latest news you have to pay a quick visit the web and on the web
I found this web site as a best website for most up-to-date updates.
Quality articles or reviews is the secret to attract the viewers to visit the web page, that’s what this website is providing.
They want to know about the sites you want to visit, your emails, your
interests, your location and so on. Same method as above only you post
music, download software called “supermp3download” (find it on torrent sites) and download music that other medication is searching for, should you
be familiar with google alert you might set up an email alert when someone searches for music.
However, the new measures won’t terminate internet use following
your ‘three strike’ deal other countries have.
A fascinating discussion is definitely worth comment. There’s no doubt
that that you need to write more about this subject,
it may not be a taboo matter but usually folks don’t discuss these issues.
To the next! Cheers!!
You have noted very interesting details ! ps decent web site. He that will not sail till all dangers are over must never put to sea. by Thomas Fuller.
Wow! Thank you! I constantly needed to write on my website something like that. Can I include a fragment of your post to my site?
up with everything fresh you have to post. Would you list of the complete urls of
You could certainly see your expertise within the work you write. The arena hopes for more passionate writers like you who are not afraid to say how they believe. At all times go after your heart.
If you ever want to take some of the load off, I ad love to write some content for your blog in exchange for
This actually answered my own problem, thank an individual!
wow, awesome article post.Really thank you!
Im no professional, but I believe you just crafted an excellent point. You obviously know what youre talking about, and I can actually get behind that. Thanks for being so upfront and so truthful.
information a lot. I was seeking this particular info
LET’S GET IN TOUCH </a
Yes, Sovereignity
Israel is a Middle Eastern country that declared
independence in 1948. Israel is a representative democracy
with developed political institutions and socio-economic