Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

About

HessianD is an implementation of the Hessian Protocol (http://caucho.com/hessian), a binary webservice protocol, in the D programming language. Some of the high lights of this protocol are lightweight, self descriptor and a relatively complete set of data types including objects, maps and vectors.

In this regard this implementation tries to support most of the D language data types including user defined ones (classes and structs).

Project Status

The development of this project appears to have stalled with changeset 20 on 2007-05-31.

Download

Latest from trunk

Implementation details

HessianD implements both the server and the client part of the protocol model. Using some of the cool features of D, like meta programming, string mixins, tuples etc., the user of this implementation can enjoy some of the magic present in other implementation based on runtime reflection, only that this time it happens at compile time.

HessianD uses the Tango, Mango ant Meta libraries and supports the HTTP model. Hessian is pretty versatile and can be implemented over plain sockets, RS232 ...; a future release will offer an additional plain Socket implementation.

Examples

Client example

Lets say our Hessian server (D, Java, C++, C#, Ruby, PHP, Python etc.) defines an API interface like:

interface api
{
    char[] echo (char[] param);
 
}

We'll call this method like this:

import hessian.HttpProxy :
HttpProxy;
import tango.io.Stdout;

void main ()
{

    // create a Http proxy on the given Http endpoint so we can post our Hessian stream
    scope service = new HttpProxy(" http://localhost:5667/test/hessiantest");

    // create a proxy method that will do the Hessian serialization and deserialization
    auto echo = &service.proxy!(api.echo);
    
    // we'll perform the remote call and display the result
    Stdout ("Remote result: ") ( echo("Hello World!") ).newline.flush;

}

Server example

If we need to expose the "echo" function from the above interface as a remote service we'll need to code the server as:

import hessian.HttpServer:
Server;

// create an implementation for the interface
class impl : api
{
    // return the input string back to the client
    char[] echo( char[] param)
    {
        return param;
    }

}

void main()
{
    // create a Http server on the given port
    auto server = new Server(5667);
    // attach a context with the Http endpoint and the class implementing the method
    auto context = server.addContext!(impl)("/test/hessiantest");
    // bind the method to the context created
    context.bind!(impl.echo);
    // and finally start listenning to Http Post requests
    server.start;
}

For more examples please browse to hessian/tests modules in the source code.

License

HessianD is licensed under the BSD license.

Copyright (c) 2007, Radu Daniel Racariu

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation

and/or other materials provided with the distribution.

  • Neither the name of the Radu Daniel Racariu nor the names of its contributors may be used to endorse or promote products derived from this software

without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Forum

http://www.dsource.org/forums/viewforum.php?f=140