This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Macromedia Flash > November 2003 > Catching errors from WebServiceConnector





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Catching errors from WebServiceConnector
arkamax webforumsuser@macromedia.com

2003-11-30, 12:41 pm

Hello everybody,

I'm trying to set up a WebServiceConnector to execute a SOAP request. Basically everything is working fine, but I would like to provide some error handling in the application. For example, when network connection is not available, the application cannot c
onnect to the SOAP server, and NOTHING is shown to user - I see something like "Error opening URL <someurl>", but this is only visible to me in debug mode.

WebServiceConnector has only three events, but none of them looks suitable for error catching:

on(result) - fires only on successful requests - but not on errors.

on(status) - fires before executing the request, but not on errors.

on(sending) - the same.

So how could I detect the problem with WebServiceConnector and respond accordingly to the user?

Thank you very much.

Regards,
Artyom


chall3ng3r

2003-11-30, 12:42 pm

there is on more event,
onFault

here's a little example of using it.

ws = new WebService("wsdl");

callbackObj = myWebServiceObject.myMethodName(param_1);
callbackObj.onResult = function()
{
txtStatus.text = "Call successful";
}
callbackObj.onFault = function(obj)
{
txtStatus.text = "Error occured while requesting.";
}


if u don't updated the new flash docs, download them in mxp format. it has more documantation on webservices

u'll find all the usage in the updated help.


// chall3ng3r //


arkamax webforumsuser@macromedia.com

2003-11-30, 12:42 pm

Thank you for your suggestion - I tried it, but no luck. Although the following helped:

var statusFunction = function (stat) {
trace("Code: "+stat.code);
trace("Data.code: "+stat.data.faultcode);
trace("Data.string: "+stat.data.faultstring);

if (stat.code=='WebServiceFault') {
Alert.show("Cannot load data!");
}
};

_root.vendor.addEventListener("status", statusFunction);




chall3ng3r

2003-11-30, 12:42 pm

goood,

but as of MM documents, and i think the standard way of webservices implementaion, u should use as documented.


im currently working on a important proj, after that, i'm plaining to write some best practices form flash mx 2004/pro.


any way thing is working for u, thats u wanted :D


// chall3ng3r //


Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews