FAQ»Remote Methods

Remote Methods

I want to invoke a method called “getFoo” in a remote service but HessianPHP returns a fault telling me that the method does not exists. I am sure it exists, what's wrong?

As in PHP 4.3.x, all method name metadata (get_class_methods(), __call(), overload extension) is internally lower-cased so if you call a camel cased remote method name, like “getFoo”, the call will result into a no such method fault because PHP will interpret the method name as “getfoo”. This is especially bad when calling Java services where many method names are camel cased. Sad but true.

To counterfeit this, use remoteMethod($url,$methodName) in the Hessian configuration class to tell HessianPHP how to call the method with the right name before executing the call, like this:

Hessian::remoteMethod($url,'getFoo');
$value = $proxy->getFoo(); 

PHP 5 doesn't seem to be affected by this behavior.