Powered by PmWiki
There are several options you can configure in HessianPHP clients using the static methods of the Hessian class.
General client configuration
Some old functions like setURLOption() and setCredentials() were removed in favor of a more general way to configure cients. Just like PHP5's SOAP library, you can pass an associative array to the constructor of the client object to set several different options. Available options are:
For example, if you want to call a service protected with basic security and set a timeout of 10 seconds for the connection:
$options = array('username' => 'myuser', 'password' => 'mypass', 'timeout'=>10); $client = new HessianClient($url,$options);
Mapping the name of a remote method
$options = array( 'methods' => 'method1,method2' );
This is often necessary to do in php4 for the name of local dynamically called methods are always converted to lower case and the names in remote services are usually camel cased (Java and C# for example). So if you know that a remote method is camel cased, you need to tell HessianPHP it's real name before you execute the call, like this:
This is not needed in php5.
Mapping of remote types to local php classes
Objects and hashtables that come from a remote service are deserialized into an associative array by default, but you can specify that certain types are deserialized into local php objects of an specific type, for example:
To deserialize the remote type 'hessiantest.User' that comes from a Java Service into a custom User class:
This classes need to have a default 0 argument constructor (the default for php), what's called bean-style class in Java.
Now you can select how HessianPHP will react when an error is detected. When a trappable error occurs (or a fault), you can always check the returned value of the error() method that returns a HessianError object if there is an error or false otherwise.
There are four constants that can be passed to the errorReporting() function:
For example Hessian::errorReporting(HESSIAN_TRIGGER_ERROR);.
This last two options are usefull when you have defined a custom error handler routine with set_error_handler().
Cannot acquire lockfile
We are sorry for any inconvenience.