When working with the Java Hessian Webservice library (resin-hessian-4.0.7.jar) I encountered the following problem:
Calling the method:
public List<EventView> listRecent(String node, int limit);
via the webservice works fine. Another very similar method on the same service fails with an exception:
public List<EventView> listRecent(int limit);
WARN [btpool0-1] 2010-12-22 21:08:16,441 log: Nested in org.springframework.web.util.NestedServletException: Hessian skeleton invocation failed; nested exception is com.caucho.hessian.io.HessianProtocolException: listRecent: expected int at 0x7a (z):
com.caucho.hessian.io.HessianProtocolException: listRecent: expected int at 0x7a (z)
at com.caucho.hessian.io.HessianInput.error(HessianInput.java:1695)
at com.caucho.hessian.io.HessianInput.expect(HessianInput.java:1681)
at com.caucho.hessian.io.HessianInput.readInt(HessianInput.java:538)
at com.caucho.hessian.io.BasicDeserializer.readObject(BasicDeserializer.java:169)
I exported the webservice via the Spring HessianServiceExporter (org.springframework.remoting.caucho.HessianServiceExporter, Spring 3.0.5). See documentation.
Calling the webservice works very simple:
HessianProxyFactory factory = new HessianProxyFactory();
EventService eventService = (EventService) factory.create(EventService.class, urlString);
I found out, that the problem is related to the version of the Hessian Protocol thats beeing used. Telling the HessianProxyFactory to use version 2 of the protocol resolves the problem:
HessianProxyFactory factory = new HessianProxyFactory();
factory.setHessian2Request(true);
factory.setHessian2Reply(true);
Hope this information can help anyone else with the same problem, took me some time searching to find out.