可去官網下載套件http://hessian.caucho.com/ 我公司是用 hessian-3.1.3.jar版
下面一個小例子:
<!-- 傳送Email service -->
<bean id="mailService" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
<property name="serviceUrl" value="${gwapi.mailService.url}" /> // 連結已被定義在conf內的.properties //取欲連接專案(對方)連線
<property name="serviceInterface" value="com.neweb.fb3pay.service.mail.IMailService" /> //指欲連接專案(對方)的相關interface
</bean>
Hessian : Hessian is a slim(條), binary(二進制) RPC protocol(協議)
The Hessian binary web service protocol makes web services usable without requiring a large framework
it is well-suited to sending binary data without any need to extend the protocol with attachments.
參考網址:http://www.javatpoint.com/spring-remoting-by-hessian-example
而當我們做好了B案的function要給A案去呼叫時,就要把B案的環境build.xml去編譯 >> 右鍵 >> run as >> ant build... >> buildB案service >> 然後在dist或哪找一下會出現.jar檔,再丟到A案lib即可,就可看到小型的B案架構在這.jar裡
當B案的service使用build後的jar檔匯入 A案後,我們就可以在A案呼叫mailService(bean所定義) 去呼叫mailService在B案鎖定意好的function來使用