2 litpc litpc 于 2016.04.14 10:34 提问

FLEX中webservice交互问题

import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.soap.WebService;

protected function getWebService():void
{
    var ws :mx.rpc.soap.WebService = new mx.rpc.soap.WebService();
    ws.wsdl= "http://localhost:8080/MyAxis/services/AxisService?wsdl";
    ws.addEventListener(ResultEvent.RESULT,resultFunction);//增加返回结果的监听
    ws.getOperation("sum").send("1","2");
    ws.loadWSDL();
}

private function resultFunction(event:ResultEvent){
    var s:int = event.result as int;
    Alert.show(s.toString(),"返回结果");
}

http://localhost:8080/MyAxis/services/AxisService?wsdl 这个是通的
为什么
ws.addEventListener(ResultEvent.RESULT,resultFunction);
这个监听中resultFunction这个方法不进去,
求高手解答。

1个回答

xyrmgzt
xyrmgzt   2016.10.08 01:51

x.rpc.events.ResultEvent;
import mx.rpc.soap.WebService;
protected function getWebService():void
{
var ws :mx.rpc.soap.WebService = new mx.rpc.soap.WebService();
ws.wsdl= "http://localhost:8080/MyAxis/services/AxisService?wsdl";
ws.addEventListener(ResultEvent.RESULT,resultFunction);//增加返回结果的监听
ws.getOperation("sum").send("1","2");
ws.loadWSDL();
}

private function resultFunction(event:ResultEvent){
var s:int = event.result as int;
Alert.show(s.toString(),"返回结果");
}

http://localhost:8080/MyAxis/services/AxisService?wsdl 这个是通的
为什么

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!