1. General Introduction
Spring currently provides integration of remoting technologies such as Httpinvoker, Hessian, burlap, and so on.
Spring masks the differences in these implementation technologies by simply developing a simple Java object (Plain old Java Objects,pojo) and then writing the configuration file in the format of the spring specification, improving efficiency, and smooth switching between several modes of invocation. You only need to change the configuration file, and you do not need to change the specific code.
Comparative introduction
| name |
Technology |
language |
| HTTP Invoker |
Transferring data based on Java serialization |
Java only supported |
| Hessian |
Data transmission based on binary stream |
A cross language with fewer bytes and better performance |
| Burlap |
Transferring data based on XML |
Cross-language, data redundancy, XML format Description good |
2. Client Configuration
<bean id= "Productservicehessian" class= "Org.springframework.remoting.caucho.HessianProxyFactoryBean" >
<property name= "serviceurl" value= "Http://127.0.0.1:8300/productService.servicehessian"/> <property
Name= "Serviceinterface" value= "Com.xxxxx.biz.service.ProductService"/>
</bean>
<bean id= " Productserviceburlap "class=" Org.springframework.remoting.caucho.BurlapProxyFactoryBean ">
<property Name= "serviceurl" value= "Http://127.0.0.1:8300/productService.serviceburlap"/> <property name=
" Serviceinterface "value=" Com.xxxxx.service.ProductService "/>
</bean>
3. Service-side configuration
<bean id= "Productservice" class= "Com.xxxxx.service.impl.ProductServiceImpl" ></bean>
<bean Name = "/productservice.servicehessian" class= "Org.springframework.remoting.caucho.HessianServiceExporter" >
<property name= "service" ref= "Productservice"/> <property name= "Serviceinterface"
Com.xxxxx.service.ProductService "/>
</bean>
<bean name="/productservice.serviceburlap "class = "Org.springframework.remoting.caucho.BurlapServiceExporter" >
<property name= "service" ref= " Productservice "/>
<property name=
serviceinterface" value= "Com.xxxxx.service.ProductService"/> </bean>
4. Unit Test
Detailed introduction See: http://blog.csdn.net/lsblsb/article/details/39930503
5. Other
Minor problems encountered during the process:
Resolve hessianprotocolexception:expected string at 0x6d:http://blog.csdn.net/lsblsb/article/details/39994461
About Spring Httpinvoker calls are detailed in the following: http://blog.csdn.net/lsblsb/article/details/39930503
Reference: http://www.iteye.com/topic/417767
Java comparison of several remote service invocation protocols: http://www.360doc.com/content/12/0220/13/2795334_188038946.shtml