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包中已經包含了。