I have a function in my application that calls various http services (PHP running on apache - WAMP)
For some unknown reason, sometimes the first HTTP request fails, and its always the first. My function is as follows;
public function sendAllHttpRequests():void
The HTTP requests are using a mixture of queries to an SQL database and the Google Analytics API. Does anyone have an idea why this might be happening? Or is there another method I could use that would ensure all data is loaded correctly?
PLEASE HELP! Thanks
Ok I think I have fixed it, simply created a fault handler and called the HTTP service again, effectively creating its own loop.
I think flex / actionscript has some serious procedural issues
i've had several problems with HTTPServices in the past where they are for no reason refusing to act normally if i automate their sending.
The only solutions i've so far come up with to this bizarre behaviour are;
1: sending the requests off manually, be it button press or whatever. (Annoying)
2: using the setTimeout function to delay them to ensure they are the only thing occuring at one time. (Very messy and poor code)
3: wrapping the send request in a try&catch and as you said, on failure simply just doing the request again. (Shouldn't be necessary)