RE: Error handling in Flash Remoting for AS 2.0

"Davies, Grant M." <[email protected]> Tue, 21 Mar 2006 14:58:09 -0500
Newsgroups gmane.comp.java.openamf.user
Message-ID <BEF55D977D60F94B9768E5C2AA398546199385A8@gaatlitexch09s.nscorp.ad.nscorp.com>
I wrote some handlers for the arp framework that provide that type of
functionality, like if the server is unreachable, I also have  a custom time
out...


The basics of gracefully handling failure is here :

http://theresidentalien.typepad.com/ginormous/2005/09/how_to_catch_er.html

And then the arp stuff I did is here which has timeouts :

http://theresidentalien.typepad.com/ginormous/2005/10/extending_arp.html

Cheers.
Grant 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Todd Hivnor
Sent: Tuesday, March 21, 2006 2:43 PM
To: [email protected]
Subject: [Openamf-user] Error handling in Flash Remoting for AS 2.0

I have been migrating from AS1.0 to AS2.0, and have been having troubles
with the new Flash Remoting. It seems to do a very poor job of error
reporting ... even worse than the error reporting in the old AS1.0 version
of Flash Remoting. I'm wondering if anyone knows of any tricks on how to get
notification if the remote server is down.

If the remote server is not reachable, I don't get any error at all. The
RelayResponder never calls my error handler. I've started from the sample
Remoting code, straight from the Macromedia docs. The source code is below.
I did update the library to include the "RemotingClasses" 
component, and the code works when I am use a valid URL. But, if I stop my
'localhost' server, or use the Macromedia server (which is now defunct), the
RelayResponder never calls my error handler.

Note that if the server is totally unreachable, I do see "Error opening
URL..." in the trace window. If the server is reachable but returns HTML,
like the Macromedia server is doing, I get nothing. Adding a logger is no
help, as no log statements are generated when trying to connect to the
unreachable server.

In AS1.0, I used to define _global.System.onStatus  and
NetConnection.onStatus. One of them would get called if there was a basic
connection error. Perhaps there is something similar for the new AS2.0 Flash
Remoting?

I'd really love to get to the bottom of this. Thanks in advance for any
clues - Todd


--------BEGIN AS CODE----
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.rpc.RelayResponder;

mx.remoting.debug.NetDebug.initialize();

var url : String;

//url = "http://localhost:8080/InsightXP-r999/AdvancedGateway4";
url = "http://examples.macromedia.com/flashservices/gateway";

var myService:Service = new Service(
    url, null,"petmarket.api.catalogservice",  null, null); // connect 
to remote service

trace("Connecting ...");

var pc:PendingCall = myService.getCatagories({locale:"en_US"}); // call 
service method
pc.responder = new RelayResponder(this, "getData_Result", "getData_Fault");

function getData_Result( re:ResultEvent ):Void { // receive result
    trace( "getData_Result: got the response" );
}
function getData_Fault( fe:FaultEvent ):Void { // receive fault
    trace( "getData_Fault: "  + fe.fault.description);
}
--------END AS CODE----




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Openamf-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openamf-user


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642