Jump to content

Axis2/C and HydraExpress

Axis2/C is a C based implementation of the Apache Soap engine, and builds on lessons learned from the Java version, Axis2/Java. It is written in C for platform portability, and has a pseudo object-oriented design approach1. This involves putting operations in the header files and the data in the source files. Also macros are used extensively to hide complexity.

Rogue Wave’s HydraExpress product, on the other hand, is written in native C++, and the code it generates from a WSDL file is also C++. This means that the C++ standard library with its implementations of strings and collection classes are available to the user. HydraExpress is also supported across a wide range of platforms including Windows, Linux and UNIX.

For C++ developers who wish to easily create and deploy Web services, the pseudo object-oriented design approach and C language implementation of Axis2/C can present challenges when starting development. The HydraExpress C++ approach may present a coding style that is more familiar.

The example below is a comparison of the code required to implement a simple “Hello World” service in both Axis2/C and HydraExpress.

Axis2/C


adb_helloResponse_t* axis2_skel_GreetingService_hello(const axutil_env_t *env,
                                                      adb_hello_t* hello)
{
    /* TODO fill this with the necessary business logic */
    adb_helloResponse_t *response;
    axis2_char_t *input_message;
    axis2_char_t *output_message;

    /* Extract the request */
    input_message = adb_hello_get_hellorequest(hello, env);

    /* Create a response message */
    output_message = ‘Hello from server’;

    /* Build the response adb */
    response = adb_helloResponse_create(env);
    if (response)
    {
        adb_helloResponse_set_return(response, env, output_message);
    }
    return response;
}

Hydra Express


std::string
GreetingPortTypeImp::hello(rwsf::CallInfo& callInfo,
                           const std::string& hellorequest_in)
{
    return std::string(’Hello from server ‘ + hellorequest_in);
}

References
1. http://wso2.org/library/252

Del.icio.us   |   Technorati   |   Digg   |   Slashdot

One Response to “Axis2/C and HydraExpress”

  1. dimuthu Says:

    Hi,
    With the Axis2/C WSDL2C unwrapped mode you will be having following function signature to handle the above schema.

    axis2_char_t *
    axis2_skel_GreetingService_hello(const axutil_env_t *env,
    adxis2_char_t* hellorequest)
    {
    return “Hello From the Server”;
    }

    Command to generate the code, (here -uw for unwrapping mode).
    WSDL2C.sh -uri your.wsdl -ss -uw -u

    Thanks
    Dimuthu
    http://dimuthu.org

Leave a Reply