As my recently blog entries have explained, I’m working on a few tests related to Flex, Flash Data Services and the Flex Messaging event gateway. Yesterday I was able to successfully send a message from a Flex client to ColdFusion, but I was completely unable to send a message from ColdFusion back to the Flex client.
After much pain and suffering and Googling I tried something a little crazy. I didn’t find any documentation telling me to do this, but I copied the entire sample messaging configuration from the config samples over the messaging configuration I had been hacking.
To clarify, I copied C:fds2resourcesconfigmessaging-config.xml over C:fds2jrun4serversdefaultsamplesWEB-INFflexmessaging-config.xml.
I had been hacking randomly at the messaging-config.xml and I must have done something wrong, though I have no idea what. Because, once the new messaging-config.xml was in place FDS restarted and, much to my amazement, I was able to send messages both ways!
Woo Hoo!
Now I need to figure out why Flex wants me to build my applications under the FDS server itself.
On top of that, I need to figure out how Flex knows what to connect to from the client. In the same I’ve been working with there are the following few lines of code which seem to setup all of the messaging infrastructure:
public var pro:mx.messaging.Producer; public var con:mx.messaging.Consumer; public function initApp():void { pro = new mx.messaging.Producer(); pro.destination = "ColdFusionGateway" consumer.subscribe(); }
This is quite nice, but I can only assume the client has the localhost hard coded into it somewhere. If not, then I have no clue how it works.
More as I learn more!
Comments on: "I Got FDS Working!" (3)
The trick is in the Destination that you set within the Flex App. When I was first getting into remoting, I noticed some pecular notation within the services-config.xml file that was distro-ed with ColdFusion…
false
(this particular example is from FDS, but the CF one is close)
Notice under in the endpoint uri tag, it has the {servername}, etc. If you rip that out and replace it with whatever destination you really want, that is how you do it.
Flex Builder (and the SDK) read this file when you compile and code it into the application. This means you can modify a copy for your “production” compile and make it different from your “test” compiles. A lot is possible with ANT in this regard.
LikeLike
Apparently, I can’t copy code with this blog software, so I’ll try again :
false
LikeLike
Doug – thanks for blogging about your experience. I’ve thought about exploring FDS, but your difficulties and the lack of good documentation/examples with code and config files means that I will wait on this technology. I’ve got enough to keep me busy and frustrated.
LikeLike