You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Prem <Vi...@cognizant.com> on 2007/03/27 10:51:54 UTC

axis2c - generated skeleton files using WSDL2C for array of structure having a RESET function. how to use it?

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


Re: [Axis2] axis2c - generated skeleton files using WSDL2C for array of structure having a RESET function. how to use it?

Posted by Prem <Vi...@cognizant.com>.
Thanks Milind,

NOw I have compiled all the the services, put the dll & lib's in  service
folder in AXIS2C
and trying to test it using the java client giving the error as  'Failed in
creating DLL  '
"in detail the error message is in below "  help me to solve the poblem.

1. I am just  calling a web service with single input in 
2.  it talks with some com dll and 
3. returns the result and then setting this response in webservices return.

"     
xP)rsion="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header></soapenv:Header><soapenv:Body><soapenv:Fault><faultcode>env:Receiver</faultcode><faultstring>Failed
in creating
DLL</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope> "

the response is not properly tagged .






Milinda Pathirage wrote:
> 
> 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 <Vi...@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
> 
> 

-- 
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#a9711090
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


Re: axis2c - generated skeleton files using WSDL2C for array of structure having a RESET function. how to use it?

Posted by Milinda Pathirage <mi...@gmail.com>.
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 <Vi...@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