我正在尝试通过 actionscript 连接到 Web 服务,但出现错误:
TypeError:错误 #1009:无法访问空对象引用的属性或方法。在 wsdlMain()
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
//webservices wsdl
import mx.rpc.soap.*;
import mx.core.*;
import mx.rpc.events.*;
public class wsdlMain extends MovieClip
{
public var myWebService:WebService;
public var rutaWebService:String;
public var element:Operation;
public function wsdlMain()
{
myWebService.addEventListener("LOAD", loadDone);
cargarWSDL();
}
public function cargarWSDL (){
var myWebService = new WebService();
myWebService.loadWSDL("http://localhost:8080/myTurn/servlet/sequencegenerator?wsdl");
}
public function loadDone(evt:LoadEvent)
{
trace ("holaaaa222");
element = Operation(myWebService.getOperation("Execute"));
element.addEventListener("fault", wsError);
element.addEventListener("result", wsResult);
element.send(1);
}
public function wsError(evt:FaultEvent)
{
trace ("chau");
}
public function wsResult(evt:ResultEvent)
{
trace ("hola");
var xml:XML = XML(evt.result);
trace(xml.toXMLString());
}
}
}
任何方向将不胜感激!!!