Archive for September, 2009

Workaround to Flex SDK 3.4 Bug 22333 :: HTTPService Responders Are Called Twice…Here’s a Fix!

This one kicked my team’s ass for a couple of hours so I’m hoping it’ll help somone else…so we updated our Flex SDKs to 3.4 and all of a sudden all of our Delegates’ result handlers were getting called twice. We thought it was due to our service orchestration object (we have a base object that allows us to make sequential Cairngorm service calls) and somehow we were calling the services 2x, but nope…wasn’t it. Seemed our AbstractDelegate that sets up the responders for all of our service calls like so had the issue:

public function executeHTTPService(requestDTO:AbstractRequestDTO=null):void
{
	logger.debug("executeHTTPService");

	var token:AsyncToken;
	var responder:mx.rpc.Responder;

	// create a responder for the service
	responder = new mx.rpc.Responder(result, fault); // WTF mate?

	// execute the service
	token = this.service.send(requestDTO);
	token.addResponder(responder); // why yall busted up now???
}

Apparently, SDK 3.4 reintroduces an old defect that causes this implementation of setting up the responder with the async token to call the result handler twice…bummer, eh? So what to do…well, a simple workaround until they fix this is to do the following:

this.service.addEventListener(ResultEvent.RESULT, result);
this.service.addEventListener(FaultEvent.FAULT, fault);

Just create your handlers with good-ole fashioned event handlers…DONE.

Get more info on the defect here.

Post to Twitter Tweet This Post

, , , , ,

3 Comments