axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milinda Pathirage" <milinda.pathir...@gmail.com>
Subject Re: axis2c - generated skeleton files using WSDL2C for array of structure having a RESET function. how to use it?
Date Wed, 28 Mar 2007 04:30:00 GMT
Hi,
Consider a echo example which echo incoming array of integers like this:

Request Structure:
struct axis2_echoInts
{
     axis2_qname_t* qname;
     axis2_array_list_t* attrib_input;
};

Response Structure:
struct axis2_echoIntsResponse
{

     axis2_qname_t* qname;
     axis2_array_list_t* attrib_echoIntsReturn;
};

Business Logic Implementation:
axis2_echoIntsResponse_t* axis2_skel_Benchmark_echoInts (const axis2_env_t
*env  ,
                                                         axis2_echoInts_t*
echoInts )
{
    /* TODO fill this with the necessary business logic */
    axis2_echoIntsResponse_t *response = NULL;
    axis2_array_list_t *input = NULL;

    response = axis2_echoIntsResponse_create(env);

    input = AXIS2_ECHOINTS_GET_INPUT(echoInts, env);
    AXIS2_ECHOINTSRESPONSE_SET_ECHOINTSRETURN(response, env, input);
    AXIS2_ECHOINTS_RESET_INPUT(echoInts, env);
    return response;
}

Code that select correct operation inside service skeleton's invoke
function:
if ( AXIS2_STRCMP(op_name, "echoInts") == 0 )
{

                    input_val11_1 =
                        axis2_echoInts_create( env);
                        AXIS2_ECHOINTS_DESERIALIZE(input_val11_1, env,
content_node );

                    ret_val11 =  axis2_skel_Benchmark_echoInts(env,
                                                input_val11_1 );
                    if ( NULL == ret_val11 )
                    {
                        AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL
returnted from the business logic from echoInts "
                                        " %d :: %s",
env->error->error_number,

AXIS2_ERROR_GET_MESSAGE(env->error));
                        return axis2_svc_skel_Benchmark_on_fault(
svc_skeleton, env, NULL);
                    }
                    ret_node =
                               AXIS2_ECHOINTSRESPONSE_SERIALIZE(ret_val11,
env, NULL, AXIS2_FALSE);
                               AXIS2_ECHOINTSRESPONSE_FREE(ret_val11, env);
                               AXIS2_ECHOINTS_FREE(input_val11_1, env);

                    return ret_node;
}

In the service skeleton's invoke function we get payload(axiom_node) of the
incoming request as parameter. After that we check which operation we have
to execute.

After selecting correct operation we desirialize the incoming payload to
echoInts structure and give it as a parameter to the
axis2_skel_Benchmark_echoInts
function.
input_val11_1 = axis2_echoInts_create( env);
                        AXIS2_ECHOINTS_DESERIALIZE(input_val11_1, env,
content_node );
ret_val11 =  axis2_skel_Benchmark_echoInts(env,
                                                input_val11_1 );

Inside this function we extract the data inside structure and assign it to
the response structure.
input = AXIS2_ECHOINTS_GET_INPUT(echoInts, env);
    AXIS2_ECHOINTSRESPONSE_SET_ECHOINTSRETURN(response, env, input);

after that we reset the echoInts structure.
AXIS2_ECHOINTS_RESET_INPUT(echoInts, env);

This reseting done because inside invoke function we free the two structures
created after serving for the request. Inside the logic of free function we
free all the elements inside array lists. In this free process, problem
occurs when we trying to free bot h structures . Because we share same
elements between two structures using pointers. Therefore we have to remove
one pointer from pointing to same array lists. After that no double freeing
occur, because we remove the reference to that memory location from one
structure. Please go through code inside free logics, then you will be able
to understand the situation. This reseting mechanism does not require if we
don't assign the same attributes to the response structure.

Thanks
Milinda

On 3/27/07, Prem <Vijayalakshmi.Venkadaswamy@cognizant.com> wrote:
>
>
> Hi,
>
> generated skeleton files using WSDL2C for array structures.
> Request and response generated files for the unbounded structure data type
> has a RESET function. how to use it?
>
> any help who have used the Structure array will be helpful.
>
> -Viji.
> --
> View this message in context:
> http://www.nabble.com/axis2c---generated-skeleton-files-using-WSDL2C-for-array-of-structure-having-a-RESET-function.-how-to-use-it--tf3471795.html#a9688599
> Sent from the Axis - C++ - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>


-- 
milinda@wso2.com
WSO2, Inc: http://www.wso2.com "Oxygenating the Web Service Platform"
http://www.milindalakmal.wordpress.com

Mime
View raw message