View Full Version : capture connection error with remoting
uramis
12-07-2007, 08:26 PM
Hi
Im not sure if this has been asked/answered before...
Im trying to do something that sounds really simple:
I have an app which uses remoting. If I lost connection with the server, or even manually change de URL of the gateway, I get this error: Error opening URL "http://www.site.com/remoting/gateway.php".
Is there a way to capture this error, and thus have the app response to that (example: you lost conection with the server!)
Thanks!
acolyte
12-08-2007, 12:49 PM
Hi uramis ,
what i would suggest you is to take a look at the >> mx.rpc.RelayResponder;
pendingCall.responder = new RelayResponder(this, "onResult", "onFault");
and then only define the onResult and the onFault FUnction like this :
private function onFault(fe : FaultEvent) : Void {
var f : Fault = fe.fault;
dispatchEvent({type:AMFPHPService.SERVICE_FAULT, target:this, data:f});
/*************************************/
trace("faultcode : "+f.faultcode);
trace("faultstring : "+f.faultstring);
trace("detail : "+f.detail);
trace("description : "+f.description);
trace("type : "+f.type);
/*************************************/
}
private function onResult(re : ResultEvent) : Void {
var obj : Object = re.result;
dispatchEvent({type:AMFPHPService.SERVICE_RESULT, target:this, data:obj});
}
hope this helps
uramis
12-08-2007, 01:05 PM
Hi Acolyte
thanks for the reply.
Actually, I was doing that, but the "fault event" didn't trigger. I searched, and found a blog where they address the same problem modifying the Connection and Service Class. The problem is that the Service class asumes that the AMF gateway is allways present and also the internet connection. If you misstype the gateway url, or unplug internet, you don't get any errors.
In some of the posts in the article, a guy named Ezequiel shows a way to solve this without modifying any classes; thats the way I'm gonna follow, but didn't do it yet... starting now! heh (saturday morning, 10pm :()
by the way, are you the guy that actually "stole" the signature from me, and told me? (a loooong time ago)
edit:
forgot the url of the blog
http://caleb.org/blog/?p=24
acolyte
12-08-2007, 01:40 PM
Hi Acolyte
thanks for the reply.
Actually, I was doing that, but the "fault event" didn't trigger. I searched, and found a blog where they address the same problem modifying the Connection and Service Class. The problem is that the Service class asumes that the AMF gateway is allways present and also the internet connection. If you misstype the gateway url, or unplug internet, you don't get any errors.
In some of the posts in the article, a guy named Ezequiel shows a way to solve this without modifying any classes; thats the way I'm gonna follow, but didn't do it yet... starting now! heh (saturday morning, 10pm :()
by the way, are you the guy that actually "stole" the signature from me, and told me? (a loooong time ago)
edit:
forgot the url of the blog
http://caleb.org/blog/?p=24
why should i steel your signature ?
for me using RelayResponder works just fine .
If you want to have another result you have to send another request aswell
I think there was a time here in the as.org forum where everybody used this signature who not spoke native english so i used it aswell - it seemed to be fun so i joined
you are the Dude who stole it from the French Guy ? :) just kidding
uramis
12-08-2007, 02:24 PM
I am! really! and I might say I may be the first Thief :D:D at least, I actually stole it from some french guy, around 3 or 4 years ago :)
About the real topic, I have it working now, and im running with a work to deliver... Its fine for me now. :)
byes!
acolyte
12-10-2007, 12:06 AM
wow
:)
i found him
haha thats as.org cult :)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.