Spring的Hessian,Burlap,HttpInvoker远程调用

Hessian,Burlap,HttpInvoker三种远程调用都是基于http协议的,相比RMI它们都可以穿过防火墙。

Hessian使用二进制消息,可读性差,可移植到其它非JAVA语言。

Burlap使用xml消息,可读性好,可移植到其它支持xml的语言。

HttpInvoker即可以解决RMI不能解决的防火墙的问题,也可以解决Hessian,Burlap不能解决的复杂数据模型的问题。

Hessian:

客户端:
 http://yunpan.cn/cLs7dCH9KbgBM  访问密码 2838
服务端:
 http://yunpan.cn/cLs7FR6IRfFiK  访问密码 6c72

注意点:

客户端跑在windows下中eclipse中的tomcat服务器中,服务端跑在linux下的weblogic中,weblogic配置的JNDI数据源,连接linux中的DB2数据库

你在WebLogic里面配的JNDI是什么,就是什么,不要加前缀,这个和Tomcat里面加java:comp/env不同

数据源不能用weblogic连接用dbinst1

实体要实现序列化接口

加aopalliance-1.0.jar  hessian-4.0.7.jar两个jar包


Burlap,HttpInvoker

客户端:
   http://yunpan.cn/cLfEskyrv2Scd  访问密码 2534
服务端:
   http://yunpan.cn/cLfEACT2rZ2Ud  访问密码 0fd2

注意点:

   Demo中和Hessian的不同之处在于training-servlet.xml配置文件中的
  
  <!-- Hessian远程调用测试 
  <bean id="/getStudentById.service" class="org.springframework.remoting.caucho.HessianServiceExporter">-->
  <!-- Burlap远程调用测试
  <bean id="/getStudentById.service" class="org.springframework.remoting.caucho.BurlapServiceExporter">-->
   <!-- HttpInvoker远程调用测试-->
  <bean id="/getStudentById.service" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">

  <!-- <bean id="studentDao" class="org.springframework.remoting.caucho.HessianProxyFactoryBean"> 使用Hessian来远调用-->
  <!-- <bean id="studentDao" class="org.springframework.remoting.caucho.BurlapProxyFactoryBean"> 使用Burlap来远调用 -->
  <bean id="studentDao" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"><!-- 使用HttpInvoker来远调用 -->

    只要切换一下服务端的Exporter和客户端的ProxyFactoryBean就行。不需要再引入Burlap的jar包,Hessian包中已经包含了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章