Pixelbox

Welcome to Pixelbox. Friday the 10 of October 2008

Skip to content >>

Not so helpful

I have recently been looking at some action script and have found the support on the web and through Adobe a little limited.. Perhaps this is coming from open web languages which have a tonn of online support and examples, but have a look at this explination of a webservice....


import mx.rpc.soap.WebService;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
private var ws:WebService;                          

public function useWebService(intArg:int, strArg:String):void {
ws = new WebService();
ws.destination = "wsDest";
ws.echoArgs.addEventListener("result", echoResultHandler);
ws.addEventListener("fault", faultHandler);
ws.loadWSDL();
ws.echoArgs(intArg, strArg);
}              

public function echoResultHandler(event:ResultEvent):void {
var retStr:String = event.result.echoStr;
var retInt:int = event.result.echoInt;
//do something
}
public function faultHandler(event:FaultEvent):void {
//deal with event.fault.faultString, etc.
}         

Firstly there it's a useless example as it does nothing, there is no way to test it and check it is working, the values to the variables are even less verbose than the variables themselves. For example ws.destination = "wsDest"; what the hell is meant to go here, it takes no URLs claiming Unknown destination. Any ideas?

4 comments

Why not leave your own!

  1. Don't eat yellow snow.
  2. It turns out you dont need the ws.destination = "wsDest"; line at all, still no idea what it would be used for though.
  3. that is daft and way more complex than: import mx.services.*; var W:WebService = new WebService("http://path/to/service.php?wsdl"); var C:PendingCall = W.methodName("your", "args", "here"); C.onResult = function (r) { trace("RESULT : "+r); for (var i in this) { trace(i+" :: "+this[i]); } }; C.onFault = function (f) { trace("ERROR : "+f); for (var i in this) { trace(i+" :: "+this[i]); } };
  4. Thanks Greg, although the use of verbose variable names must have been excused on your example ;) Seems like the more I use AS the more of get used to the way things work and where to look for help, although examples seem harder to come by :(

Add your own comment