12,162
社区成员
发帖
与我相关
我的任务
分享
var ws:URLRequest = new URLRequest("webservice路径,例如http://192.168.0.200:1008/aa/a.asmx/b");
aa为部署项目名, a.asmx为调用的webservice,b为调用的方法
ws.method = URLRequestMethod.POST;
ws.requestHeaders.push(new URLRequestHeader("Content-Type", "application/json;utf-8"));
ws.data =JSON.encode(paras); paras为参数,此前先引用json序列化的文件
var wsLoader:URLLoader = new URLLoader(ws);
wsLoader.addEventListener(Event.COMPLETE,
function(e:Event):void{
successCallback(JSON.decode(e.target.data));
}
);
wsLoader.addEventListener(IOErrorEvent.IO_ERROR,
function(e:IOErrorEvent):void{
errorCallBack(e.text)
});