
针对非Boot环境使用hessian远程调用
下面是一般spring项目的处理方式
1、配置对应的service实现类
<beans:bean id="wfEventChange" class="com.eon.dms.core.api.oa.rpc.WfEventChangeService" />
2、暴露远程服务
<beans:bean name="/hessian" class="org.springframework.remoting.caucho.HessianServiceExporter">
<beans:property name="service" ref="wfEventChange" />
<beans:property name="serviceInterface" value="com.eon.dms.core.api.oa.rpc.IwfEventChange" />
</beans:bean >
3、在服务端实现接口 例如OaApiServiceItf
编写service,实现这个接口
4、客户端
需要服务端的接口,最好做一个公共module来处理
客户端调用服务端
HessianProxyFactory factory = new HessianProxyFactory();
IwfEventChange basic = (IwfEventChange)factory.create(IwfEventChange.class, url);
网友评论