当前位置: 代码迷 >> Web前端 >> 上次记得
  详细解决方案

上次记得

热度:102   发布时间:2012-11-21 08:23:26.0
下次记得
//webservice 异步通信
		public static function  asyncInvoke(WSURL:String,callBackFun:Function,token:Object,operationName:String,...args):void
		{  
			//var w:String = WSURL + "&ran="+Math.random();//添加随机数解决缓冲问题
			var ws:WebService=new WebService();
			ws.wsdl = WSURL;  
			//ws.endpointURI= WSURL;这个加上webservice请求只发送一次
	    	ws.loadWSDL();	
	    	var operation:Operation=ws.getOperation(operationName) as Operation;
	    	operation.arguments=args;
	    	if(callBackFun!=null)
	    	{
				var async:AsyncToken=operation.send();
				async.addResponder(new AsyncResponder(callBackFun,defaultFaultFun,token));
	    	}
			function defaultFaultFun(result:Object,_token:Object=null):void
		   	{	   		 
		   		SiteContainer.dispatchEvent(new AppEvent(AppEvent.APP_ERROR, false, false, result.toString()));	
		   	} 
			 
		}
  相关解决方案