Recent Changes - Search:



Related Projects

Powered by PmWiki



HessianPHP allows consuming and publishing web services using the Hessian binary protocol, originally Developer by Caucho in the Java language.

The goal of HessianPHP is to provide interoperability between PHP and other web platforms. Hessian uses HTTP POST requests to communicate between client and server.

Formal specifications for the Hessian protocol are available here and the user guide for the Java implementation here. and it is also included in the documentation of the excellent Java server Resin, also from Caucho.

Besides the reference implementation, there exist clients for C++, C# and Python. So far, services created with HessianPHP have been successfully tested against Java, C # and Python clients.

Design and development

The design of HessianPHP is heavily based on, a client Python implementation of Hessian, because of similarities between the two languages.

HessianPHP was designed to be as non-intrusive as possible and to keep dependencies to the minimum by following simple design patterns.

Development took place in a Windows XP/AMD 64 box and I really want to test in Linux and other architectures.

This library was tested using this configurations:

  • Apache 1.3.24 + PHP 4.4.1 as module
  • Apache 2.0.55 + PHP 4.3.8 as module
  • IIS 5.1 + PHP 5.1.1 as module (php5isapi.dll)

Interoperability tests

  • Java: JDK 1.5
    • Resin 3.0.16 + hessian 3.0.8
    • Tomcat 5.5.12 + hessian 3.0.13

  • .NET: Framework v1.1
    • IIS + ASP.NET + HessianCSharp 1.2

Inner working

The library's core is a set of two classes: HessianParser and HessianWriter. They are in charge of serialization and deserialization of native PHP types into Hessian types using reflection. They implement the protocol.

The HessianClient class acts a as proxy between the executing script and a remote Hessian service, remote calls are performed by making local calls to the proxy object that implements the PHP magic method __call(), defined in the overload extension. The real calls are performed in a class called HessianProxy, which holds information about the remote endpoint.

In order to establish communication, descendents of the class HttpConnection are used. The default class, SocketHttpConnection opens a socket to the remote server, performs an HTTP POST call to a url with the request embedded in the main body, retrieves the reply and returns the content and headers to be processed.

The HessianService class acts as a wrapper around a common PHP object, making it's public methods available remotely as a web service. HessianService utilizes PHP built-in stream mechanism (php://input, php://output) for both reading and writing to the connection.

There is also an auxiliary class called ByteUtils that handles representation of numbers as sequences of bytes.

The global configuration class is simply called Hessian, which consists in static methods that are used to set different options in the behavior of the library. Note that this class is likely to be deprecated in future versions in favor of a more dynamic configuration.

The new filter mechanism is located in the Filters.php file and it consists in three clases: FilterChain, that implements a chain of responsibility pattern; InterceptingFilter which is the base class for all filters and FilterContainer that is the base class of filter clients. You can also find several example filters in this class

Edit - History - Print - Recent Changes - Search
Page last modified on January 01, 2006, at 06:37 AM

PmWiki can't process your request

Cannot acquire lockfile

We are sorry for any inconvenience.