Home > Archive Post, ColdFusion > Webservices with CFC and Flex Cairngorm delegates

Webservices with CFC and Flex Cairngorm delegates

Hi there,

Have continued working on Flex recently and have been looking into making an image upload/download application that adheres to the Cairngorm framework. Read up this article which gives an excellent overview of the framework : Cairngorm framework

One particular problem I overcome today was to do with invoking a WebService which calls a cfc method on my own local machine. I was getting a lot of errors when connecting the most annoying of which was error #2032 which gave me a HTTP stream error. Funny thing was I didn’t really believe this error and kinda knew my WebService was actually connecting with my CFC. I ended up going through my CFC function and completely stripping out the code where errors could have occurred and found that it was an error in my CFC that was giving me this error!!

My delegate is called by a command :

public function execute(event:CairngormEvent) : void
{    //Go to the image delegate and get the images. Add them to the model
     var delegate : ImageDelegate = new ImageDelegate(this);
     delegate.getImages(event.data);
}

The image delegate goes off and calls the web service:

public class ImageDelegate implements IResponder
{
private var responder : IResponder;
private var service : Object;

public function ImageDelegate(responder:IResponder)
{    this.service = ServiceLocator.getInstance().getWebService("getImages");
      this.responder = responder;
}

public function getImages(data:CairngormEvent):void
{
     this.service.getAssetFiles(data);

}

Here is my WebService that uses parameters into a CFC.





"jpg,png,gif"




Very simple but took about an hour to get right! I’m calling a getAssetFiles method in assetManager on my local machine using wsdl. The function takes in an assetTypeRequired parameter.

Categories: Archive Post, ColdFusion Tags:
  1. No comments yet.
  1. No trackbacks yet.