According to the Hessian 1.0.2 spec, method overloading is supported by
mangling the method name using the number of arguments or argument
types.  They both appear to be supported fine in the server, but
HessianProxy doesn't properly support mangling using argument types.

As a result, if you have two methods in your Service API with the same
name, the first takes a String param, and the other an int, the call
using String will usually fail. 

I fixed this by copying the 2 private methods mangleName and mangleClass
from AbstractSkeleton to HessianProxy.  In the invoke method, call
"methodName = mangleName(method, false);" instead of "methodName =
methodName + "__" + args.length;".  

Interestingly, if you put the int method first in your Service API, and
String second, it will succeed without my modification.  The constructor
of AbstractSkeleton iterates though the methodList, but in a case where
2 methods have the same name mangled signature, it does not check if the
key exists in the hash, which results in overwriting with the last
mangled signature.  So if your String method comes last, Java will cast
the int to a String automatically, preventing an exception.

_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to