浏览 8450 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-01-09
请问各位老大,Flex与Hessian交互时,执行auth方法时 responder为什么总是先调用错误处理方法,然后再调用成功处理函数啊?
代码类似如下: (因为编辑器里不能插入Flex代码,故插入成java )
import mx.rpc.IResponder; import mx.rpc.Responder; import hessian.client.HessianService; import mx.rpc.AsyncToken; import mx.rpc.events.ResultEvent; import com.rdi.ncms.model.ModelLocator; public function auth(username:String,password:String):void{ var responder:IResponder = new Responder(loginResultHandler,loginFaultHandler); var service:HessianService = new HessianService("http://localhost:8080/ncms/UserService"); var token:AsyncToken = service.auth.send(username,password); token.addResponder(responder); } public function loginResultHandler(data:Object):void { var event : ResultEvent = data as ResultEvent; var theModle:ModelLocator = ModelLocator.getInstance(); if(event.result == true){ theModle.statusMessage = "登录成功!"; theModle.dispatchEvent(new Event(ModelLocator.LOGIN_OK)); }else{ theModle.statusMessage="用户名密码错误!"; theModle.dispatchEvent(new Event(ModelLocator.LOGIN_FAILED)); } } public function loginFaultHandler(info:Object):void{ var theModle:ModelLocator = ModelLocator.getInstance(); theModle.statusMessage="网络连接失败"; }
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2008-02-02
我也遇到了同样的问题。
错误是: faultCode:InvokeFailed faultString:'[MessagingError message='The MessageAgent's destination must be set to send messages.']' faultDetail:'Couldn't establish a connection to ''' 实在找不到为什么。 |
|
返回顶楼 | |
发表时间:2008-05-08
下载源代码 找到HessianOperation.as
找到 var token:AsyncToken = mx_internal::invoke(msg) 改为: var token:AsyncToken = new AsyncToken(msg); 就可以了 重新编译整个 swc. |
|
返回顶楼 | |