首页 > 其他 > 详细

Hessian协议测试远程服务方法

时间:2019-10-28 21:24:04      阅读:72      评论:0      收藏:0      [点我收藏+]

在开发中使用Hessian协议本地junit测试可使用

com.caucho.hessian.client.HessianProxyFactory

中方法实现注册的server接口

在dao中定义方法test

1     @Override
2     public void test1() {
3         System.out.println("测试1");
4     }

在remote.xml中定义接口

1     <bean name="/ysbsLogCommonService" class="org.springframework.remoting.caucho.HessianServiceExporter">
2         <property name="service" ref="ysbsLogCommonBoImpl"/>
3         <property name="serviceInterface" value="heb.ysbs.bo.ILogCommonBo"/>
4     </bean>

在 junit中使用HessianProxyFactory工具类

1     String url="http://localhost:8080/——————/remoting/ysbsLogCommonService";
2     HessianProxyFactory hessianProxyFactory = new HessianProxyFactory();
3     
4     //@Test
5     public void test() throws MalformedURLException {
6         ILogCommonBo  proxy = (ILogCommonBo) hessianProxyFactory.create(ILogCommonBo.class, url);
7         proxy.test1();
8 
9     }

运行,console中打印 结果 测试1

Hessian协议测试远程服务方法

原文:https://www.cnblogs.com/Isolate/p/11755335.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!