读书人

各位高人spring远程调用服务下使用回

发布时间: 2013-01-08 14:02:14 作者: rapoo

各位高人,spring远程调用服务上使用回调啊?
最近在使用spring集成的httpinvoker和hessian做项目,这两个远程调用方案支持注册远程回调机制不?
我使用Java RMI貌似可以,httpinvoker和hessian老是配不通啊,郁闷,求高手解决。谢谢!大体的例子是这样的
服务端:
定义回调接口
interface ILoginCallback {
void onLogin(String userName);
}

定义服务接口(用于远程服务调用)
interface IRemoteService {
boolean registerLoginNotify(ILoginCallback callback);
}

客户端:
实现回调接口(向远程服务注册)
class MyLoginCallback implements ILoginCallback {
void onLogin(String userName) {
LOG("用户: '" + userName + "'登陆");
}
}

客户端调用过程
MyLoginCallback callback = new MyLoginCallback();
IRemoteService remoteService = getRemoteService();------------通过spring获取该远程接口对象
remoteService.registerLoginNotify(callback); ------------运行时客户端提示"HTTP 500";服务端提示无法找到
MyLoginCallback对象
[解决办法]
比较关注这个问题

读书人网 >网络协议

热点推荐