This content has been marked as final. Show 8 replies
No, as far as I know it is not possible. It gets a bit tricky when you need to get the results of call A before you do function b. You need to do this with events instead of synchronous calls. I believe this is related to how the browser work as well.
What JKohn99 says is true - the calls are asynchronous. They have to be. You are making a call over a network and you have no guarantee when the result will come back, if at all. If you need to chain calls, have the result handler of the first call invoke the next call and so on.
As far as I know the HTTPXMLRequest method can make synchronous or asynchronous calls. So it should be possible in flex unless its been specifically designed not to do this.
All it really means is that the flash application must wait until the callback is called before proceeding. It should be possibe to wrap this somehow?
I have a work around for now.
peterent - no offense, but your suggestion is a hack. All we need is a timeout value. This should be supported natively in Flex, but its not. If anyone has some code that implements a synchronous Web Service call in Flex, please post it here. TY.
You can use XMLHttpRequest with FABridge - the Flex/Ajax bridge.
Originally posted by: Sean Hughes
peterent - no offense, but your suggestion is a hack. All we need is a timeout value.
In support of the flash player's design I'm going to have to disagree with you here. It is completely normal in any multi threaded environment to make all functionality non blocking by default. Blocking by design can be implemented with semaphores, and is not a hack. To implement simply create a flag such as 'hold:bool' init it to false when your application starts. Set it to true just before the web services send() method is called. In the result handler you set it back to false.
In this way you have complete control over what should be blocked and what should not be blocked, by simply testing the 'hold' semaphore. In this way the GUI itself, and all non dependent functionality stays alive. A timeout value would arbitrarily block all functionality for a fixed amount of time if the request was never filled. Although a semaphore could be used to do this as well, it has far more flexibility, and users have notoriously shorter timeout values than developers.
Just wanted to say thanks Perterent and mxc4 for the solution. What I was trying to say with my previous "hack" comment was that there should be a way to support synchronous calls and many programmers do prefer to make synchronous calls to services if they can. At the time I wasn't aware of the FABridge at all, so I thought there was no solution other than to have to write a ton of async web service code.
Since then, I've used and extended the FABridge framework and have written a number of Flex web service classes that facilitate making synchronous web service calls, including timeouts, etc. So thanks.
I see that the FABridge is included in the LiveCycle Data Services ES, is the FABridge Framework free?
Is there a way to just download the FABridge framework that i am missing?
I would love to be able to call web services synchronously without having to buy a license for LiveCycle Data Services.