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 Carl Lefrançois <ca...@gmail.com> on 2008/03/11 20:12:27 UTC

possible bug in WSDL2C-generated code

Hi all,

After much debugging I have found why an access violation is being caused in
my WSDL2C-generated code.

While processing the following document: (http : // removed due to problems
with my emails being flagged as spam)

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <BrokerInformationResponse xmlns:xsi="
www.w3.org/2001/XMLSchema-instance"
            xmlns="
www.axa.ca/BrokerInformationService/1.0/BrokerInformationResponse"
            xmlns:xsd="www.w3.org/2001/XMLSchema"
            xmlns:soap="schemas.xmlsoap.org/soap/envelope/">
            <TrackingNumber>UNKNOWN</TrackingNumber>
            <Status>
                <Status xmlns="">ERROR</Status>
                <Detail xmlns="">
                    <Code>ERROR</Code>
                    <Description>Could not unbind Request from
XML!</Description>
                </Detail>
            </Status>
        </BrokerInformationResponse>
    </soapenv:Body>
</soapenv:Envelope>


During construction of the node tree representing this document, an om_text
data element is created to hold the text "ERROR" in the first Status
element.  This om_text element is then assigned to the data_element member
of the axiom_node_t representing the first Status element on the following
line:

(line 603 of axiom\src\om\om_text.c:)
    axiom_node_set_data_element((*node), env, om_text);

The node_type element of this node is correctly set to 8 (AXIOM_TEXT).

however during deserialization in the WSDL2C generated code, the same data
element is read into an axiom_element_t * defined as:
axiom_element_t *current_element = NULL;

in the following line:
current_element = axiom_node_get_data_element( current_node, env);


followed by a call which attempts to read the string value of
(axiom_element_t *)current_element->ns->prefix:
qname = axiom_element_get_qname( current_element, env, current_node);

which causes an access violation.

I would like to help with debugging the WSDL2C tool but my time on this
project doesn't allow it at the moment.  If the information above isn't
detailed enough I'll gladly clarify so the problem can be fixed.

Carl

Re: possible bug in WSDL2C-generated code

Posted by Senaka Fernando <se...@wso2.com>.
Hi all,

Oh! sorry I didn't notice that. I simply was under the impression that the
allocated string size lead to a buffer overrun.

Dimuthu, thanks for noticing that.

Regards,
Senaka

> Hi,
>
> The problem is due to double freeing the end_input_str. I fixed it in the
> svn,
>
>                            axutil_stream_write(stream, env,
> start_input_str, start_input_str_len);
>                            AXIS2_FREE(env->allocator,end_input_str);
> //// This should be corrected to
> AXIS2_FREE(env->allocator,start_input_str);
>
>
>                            text_value_2_temp =
> axutil_xml_quote_string(env, text_value_2, AXIS2_TRUE);
>                            if (text_value_2_temp)
>                            {
>                                axutil_stream_write(stream, env,
> text_value_2_temp, axutil_strlen(text_value_2_temp));
>                                AXIS2_FREE(env->allocator,
> text_value_2_temp);
>                            }
>                            else
>                            {
>                                axutil_stream_write(stream, env,
> text_value_2, axutil_strlen(text_value_2));
>
>                            }
>
>                            axutil_stream_write(stream, env,
> end_input_str, end_input_str_len);
> ######                AXIS2_FREE(env->allocator,end_input_str);
>
>
>
> Thanks
> Dimuthu
>
>
> On Wed, Mar 12, 2008 at 10:27 PM, Senaka Fernando <se...@wso2.com> wrote:
>> Hi Carl,
>>
>>  Try this,
>>
>>  Replace: end_input_str =
>>
>> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>>                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
>>  axutil_strlen("RequestParameters")));
>>
>>  With: end_input_str =
>>
>> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>>                                  (5 + ADB_DEFAULT_DIGIT_LIMIT * 2 +
>>  axutil_strlen("RequestParameters")));
>>
>>  Regards,
>>  Senaka
>>
>>
>>
>>  > Hi Dimuthu,
>>  >
>>  > You are correct, I was mistakenly using the jars in the Axis2 1.3
>> instead
>>  > of
>>  > the nightly snapshot zip.
>>  >
>>  > with the new code, I get a "debug assertion failed" error.
>>  > (        _ASSERTE(_CrtIsValidHeapPointer(pUserData));      from
>> DBGHEAP.C)
>>  >
>>  > Is there some change needed in construction of the request parameters
>> with
>>  > the new version of the ADB stubs?
>>  >
>>  >
>>  > Carl
>>  >
>>  >
>>  > The generated file is:
>>  > (###### is added to line causing the problem)
>>  >
>>  >
>>  >         /**
>>  >          * adb_BrokerInformationRequestType.c
>>  >          *
>>  >          * This file was auto-generated from WSDL
>>  >          * by the Apache Axis2/C version: SNAPSHOT  Built on : Mar
>> 10,
>>  > 2008
>>  > (08:35:52 GMT+00:00)
>>  >          */
>>  >
>>  >         #include "adb_BrokerInformationRequestType.h"
>>  >
>>  >                 /*
>>  >                  * This type was generated from the piece of schema
>> that
>>  > had
>>  >                  * name = BrokerInformationRequestType
>>  >                  * Namespace URI =
>>  > http://www.axa.ca/BrokerInformationService/1.0/types/BrokerInformationRequestTypes
>>  >                  * Namespace Prefix = ns2
>>  >                  */
>>  >
>>  >
>>  >
>>  >         struct adb_BrokerInformationRequestType
>>  >         {
>>  >             adb_ParametersType_t* property_RequestParameters;
>>  >
>>  >
>>  >                 axis2_bool_t is_valid_RequestParameters;
>>  >
>>  >
>>  >             axis2_char_t* property_PortfolioNumber;
>>  >
>>  >
>>  >                 axis2_bool_t is_valid_PortfolioNumber;
>>  >
>>  >
>>  >
>>  >         };
>>  >
>>  >
>>  >        /************************* Private Function prototypes
>>  > ********************************/
>>  >
>>  >
>>  >                 axis2_status_t AXIS2_CALL
>>  >                 adb_BrokerInformationRequestType_set_RequestParameters_nil(
>>  >                         adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                         const axutil_env_t *env);
>>  >
>>  >
>>  >                 axis2_status_t AXIS2_CALL
>>  >                 adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
>>  >                         adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                         const axutil_env_t *env);
>>  >
>>  >
>>  >
>>  >        /************************* Function Implmentations
>>  > ********************************/
>>  >         adb_BrokerInformationRequestType_t* AXIS2_CALL
>>  >         adb_BrokerInformationRequestType_create(
>>  >             const axutil_env_t *env)
>>  >         {
>>  >             adb_BrokerInformationRequestType_t
>>  > *_BrokerInformationRequestType = NULL;
>>  >
>>  >             AXIS2_ENV_CHECK(env, NULL);
>>  >
>>  >             _BrokerInformationRequestType =
>>  > (adb_BrokerInformationRequestType_t *) AXIS2_MALLOC(env->
>>  >                 allocator,
>> sizeof(adb_BrokerInformationRequestType_t));
>>  >
>>  >             if(NULL == _BrokerInformationRequestType)
>>  >             {
>>  >                 AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
>>  > AXIS2_FAILURE);
>>  >                 return NULL;
>>  >             }
>>  >
>>  >             memset(_BrokerInformationRequestType, 0,
>>  > sizeof(adb_BrokerInformationRequestType_t));
>>  >
>>  >             _BrokerInformationRequestType->property_RequestParameters
>>  =
>>  > NULL;
>>  >                   _BrokerInformationRequestType->is_valid_RequestParameters
>>  > = AXIS2_FALSE;
>>  >             _BrokerInformationRequestType->property_PortfolioNumber
>> =
>>  > NULL;
>>  >                   _BrokerInformationRequestType->is_valid_PortfolioNumber
>>  > =
>>  > AXIS2_FALSE;
>>  >
>>  >
>>  >             return _BrokerInformationRequestType;
>>  >         }
>>  >
>>  >         axis2_status_t AXIS2_CALL
>>  >         adb_BrokerInformationRequestType_free (
>>  >                 adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                 const axutil_env_t *env)
>>  >         {
>>  >
>>  >
>>  >             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>>  >             AXIS2_PARAM_CHECK(env->error,
>> _BrokerInformationRequestType,
>>  > AXIS2_FAILURE);
>>  >
>>  >
>>  > adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
>>  > env);
>>  >
>>  > adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
>>  > env);
>>  >
>>  >
>>  >             if(_BrokerInformationRequestType)
>>  >             {
>>  >                 AXIS2_FREE(env->allocator,
>> _BrokerInformationRequestType);
>>  >                 _BrokerInformationRequestType = NULL;
>>  >             }
>>  >             return AXIS2_SUCCESS;
>>  >         }
>>  >
>>  >
>>  >
>>  >
>>  >         axis2_status_t AXIS2_CALL
>>  >         adb_BrokerInformationRequestType_deserialize(
>>  >                 adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                 const axutil_env_t *env,
>>  >                 axiom_node_t **dp_parent,
>>  >                 axis2_bool_t *dp_is_early_node_valid,
>>  >                 axis2_bool_t dont_care_minoccurs)
>>  >         {
>>  >           axiom_node_t *parent = *dp_parent;
>>  >
>>  >           axis2_status_t status = AXIS2_SUCCESS;
>>  >
>>  >               void *element = NULL;
>>  >
>>  >              axis2_char_t* text_value = NULL;
>>  >              axutil_qname_t *qname = NULL;
>>  >
>>  >             axutil_qname_t *element_qname = NULL;
>>  >
>>  >                axiom_node_t *first_node = NULL;
>>  >                axis2_bool_t is_early_node_valid = AXIS2_TRUE;
>>  >                axiom_node_t *current_node = NULL;
>>  >                axiom_element_t *current_element = NULL;
>>  >
>>  >             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>>  >             AXIS2_PARAM_CHECK(env->error,
>> _BrokerInformationRequestType,
>>  > AXIS2_FAILURE);
>>  >
>>  >
>>  >
>>  >               while(parent && axiom_node_get_node_type(parent, env)
>> !=
>>  > AXIOM_ELEMENT)
>>  >               {
>>  >                   parent = axiom_node_get_next_sibling(parent, env);
>>  >               }
>>  >               if (NULL == parent)
>>  >               {
>>  >                 /* This should be checked before everything */
>>  >                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>>  >                             "Failed in building adb object for
>>  > BrokerInformationRequestType : "
>>  >                             "NULL elemenet can not be passed to
>>  > deserialize");
>>  >                 return AXIS2_FAILURE;
>>  >               }
>>  >
>>  >
>>  >                       first_node = axiom_node_get_first_child(parent,
>>  > env);
>>  >
>>  >
>>  >
>>  >
>>  >                      /*
>>  >                       * building RequestParameters element
>>  >                       */
>>  >
>>  >
>>  >
>>  >                                    current_node = first_node;
>>  >                                    is_early_node_valid = AXIS2_FALSE;
>>  >
>>  >
>>  >                                     while(current_node &&
>>  > axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
>>  >                                     {
>>  >                                         current_node =
>>  > axiom_node_get_next_sibling(current_node, env);
>>  >                                     }
>>  >                                     if(current_node != NULL)
>>  >                                     {
>>  >                                         current_element =
>> (axiom_element_t
>>  > *)axiom_node_get_data_element(current_node, env);
>>  >                                         qname =
>>  > axiom_element_get_qname(current_element, env, current_node);
>>  >                                     }
>>  >
>>  >                                  element_qname =
>> axutil_qname_create(env,
>>  > "RequestParameters", NULL, NULL);
>>  >
>>  >
>>  >                            if (adb_ParametersType_is_particle() ||
>>  >                                 (current_node   && current_element &&
>>  > (axutil_qname_equals(element_qname, env, qname) ||
>>  > !axutil_strcmp("RequestParameters",
>>  > axiom_element_get_localname(current_element, env)))))
>>  >                            {
>>  >                               if( current_node   && current_element
>> &&
>>  > (axutil_qname_equals(element_qname, env, qname) ||
>>  > !axutil_strcmp("RequestParameters",
>>  > axiom_element_get_localname(current_element, env))))
>>  >                               {
>>  >                                 is_early_node_valid = AXIS2_TRUE;
>>  >                               }
>>  >
>>  >
>>  >                                       element =
>>  > (void*)adb_ParametersType_create(env);
>>  >
>>  >                                       status =
>>  > adb_ParametersType_deserialize((adb_ParametersType_t*)element,
>>  >
>>  > env, &current_node, &is_early_node_valid, AXIS2_FALSE);
>>  >                                       if(AXIS2_FAILURE == status)
>>  >                                       {
>>  >                                           AXIS2_LOG_ERROR(env->log,
>>  > AXIS2_LOG_SI, "failed in building adb object for element
>>  > RequestParameters");
>>  >                                       }
>>  >                                       else
>>  >                                       {
>>  >                                           status =
>>  > adb_BrokerInformationRequestType_set_RequestParameters(_BrokerInformationRequestType,
>>  > env,
>>  >
>>  > (adb_ParametersType_t*)element);
>>  >                                       }
>>  >
>>  >                                  if(AXIS2_FAILURE ==  status)
>>  >                                  {
>>  >                                      AXIS2_LOG_ERROR(env->log,
>>  > AXIS2_LOG_SI,
>>  > "failed in setting the value for RequestParameters ");
>>  >                                      if(element_qname)
>>  >                                      {
>>  >                                          axutil_qname_free(element_qname,
>>  > env);
>>  >                                      }
>>  >                                      return AXIS2_FAILURE;
>>  >                                  }
>>  >                               }
>>  >
>>  >                               else if(!dont_care_minoccurs)
>>  >                               {
>>  >                                   if(element_qname)
>>  >                                   {
>>  >                                       axutil_qname_free(element_qname,
>>  > env);
>>  >                                   }
>>  >                                   /* this is not a nillable element*/
>>  >                                   AXIS2_LOG_ERROR(env->log,
>> AXIS2_LOG_SI,
>>  > "non nillable or minOuccrs != 0 element RequestParameters missing");
>>  >                                   return AXIS2_FAILURE;
>>  >                               }
>>  >
>>  >                   if(element_qname)
>>  >                   {
>>  >                      axutil_qname_free(element_qname, env);
>>  >                      element_qname = NULL;
>>  >                   }
>>  >
>>  >
>>  >
>>  >                      /*
>>  >                       * building PortfolioNumber element
>>  >                       */
>>  >
>>  >
>>  >
>>  >                                     /*
>>  >                                      * because elements are ordered
>> this
>>  > works fine
>>  >                                      */
>>  >
>>  >
>>  >                                    if(current_node != NULL &&
>>  > is_early_node_valid)
>>  >                                    {
>>  >                                        current_node =
>>  > axiom_node_get_next_sibling(current_node, env);
>>  >
>>  >
>>  >                                         while(current_node &&
>>  > axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
>>  >                                         {
>>  >                                             current_node =
>>  > axiom_node_get_next_sibling(current_node, env);
>>  >                                         }
>>  >                                         if(current_node != NULL)
>>  >                                         {
>>  >                                             current_element =
>>  > (axiom_element_t *)axiom_node_get_data_element(current_node, env);
>>  >                                             qname =
>>  > axiom_element_get_qname(current_element, env, current_node);
>>  >                                         }
>>  >
>>  >                                    }
>>  >                                    is_early_node_valid = AXIS2_FALSE;
>>  >
>>  >                                  element_qname =
>> axutil_qname_create(env,
>>  > "PortfolioNumber", NULL, NULL);
>>  >
>>  >
>>  >                            if (
>>  >                                 (current_node   && current_element &&
>>  > (axutil_qname_equals(element_qname, env, qname) ||
>>  > !axutil_strcmp("PortfolioNumber",
>>  > axiom_element_get_localname(current_element, env)))))
>>  >                            {
>>  >                               if( current_node   && current_element
>> &&
>>  > (axutil_qname_equals(element_qname, env, qname) ||
>>  > !axutil_strcmp("PortfolioNumber",
>>  > axiom_element_get_localname(current_element, env))))
>>  >                               {
>>  >                                 is_early_node_valid = AXIS2_TRUE;
>>  >                               }
>>  >
>>  >
>>  >                                       text_value =
>>  > axiom_element_get_text(current_element, env, current_node);
>>  >                                       if(text_value != NULL)
>>  >                                       {
>>  >                                             status =
>>  > adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
>>  > env,
>>  >                                                                text_value);
>>  >                                       }
>>  >
>>  >                                       else
>>  >                                       {
>>  >                                             /*
>>  >                                              * axis2_qname_t *qname =
>>  > NULL;
>>  >                                              * axiom_attribute_t
>>  > *the_attri
>>  > = NULL;
>>  >                                              *
>>  >                                              * qname =
>>  > axutil_qname_create(env, "nil",
>>  > "http://www.w3.org/2001/XMLSchema-instance",
>>  > "xsi");
>>  >                                              * the_attri =
>>  > axiom_element_get_attribute(current_element, env, qname);
>>  >                                              */
>>  >                                             /* currently thereis a
>> bug in
>>  > the axiom_element_get_attribute, so we have to go to this bad method
>> */
>>  >
>>  >                                             axiom_attribute_t
>> *the_attri =
>>  > NULL;
>>  >                                             axis2_char_t *attrib_text
>> =
>>  > NULL;
>>  >                                             axutil_hash_t
>> *attribute_hash
>>  > =
>>  > NULL;
>>  >
>>  >                                             attribute_hash =
>>  > axiom_element_get_all_attributes(current_element, env);
>>  >
>>  >                                             attrib_text = NULL;
>>  >                                             if(attribute_hash)
>>  >                                             {
>>  >                                                  axutil_hash_index_t
>> *hi;
>>  >                                                  void *val;
>>  >                                                  const void *key;
>>  >
>>  >                                                  for (hi =
>>  > axutil_hash_first(attribute_hash, env); hi; hi =
>> axutil_hash_next(env,
>>  > hi))
>>  >                                                  {
>>  >                                                      axutil_hash_this(hi,
>>  > &key, NULL, &val);
>>  >
>>  >
>>  > if(strstr((axis2_char_t*)key,
>>  > "nil|http://www.w3.org/2001/XMLSchema-instance"))
>>  >                                                      {
>>  >                                                          the_attri =
>>  > (axiom_attribute_t*)val;
>>  >                                                          break;
>>  >                                                      }
>>  >                                                  }
>>  >                                             }
>>  >
>>  >                                             if(the_attri)
>>  >                                             {
>>  >                                                 attrib_text =
>>  > axiom_attribute_get_value(the_attri, env);
>>  >                                             }
>>  >                                             else
>>  >                                             {
>>  >                                                 /* this is hoping
>> that
>>  > attribute is stored in "http://www.w3.org/2001/XMLSchema-instance",
>> this
>>  > happnes when name is in default namespace */
>>  >                                                 attrib_text =
>>  > axiom_element_get_attribute_value_by_name(current_element, env,
>> "nil");
>>  >                                             }
>>  >
>>  >                                             if(attrib_text && 0 ==
>>  > axutil_strcmp(attrib_text, "1"))
>>  >                                             {
>>  >                                                 AXIS2_LOG_ERROR(env->log,
>>  > AXIS2_LOG_SI, "NULL value is set to a non nillable element
>>  > PortfolioNumber");
>>  >                                                 status =
>> AXIS2_FAILURE;
>>  >                                             }
>>  >                                             else
>>  >                                             {
>>  >                                                 /* after all, we
>> found
>>  > this
>>  > is a empty string */
>>  >                                                 status =
>>  > adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
>>  > env,
>>  >                                                                    "");
>>  >                                             }
>>  >                                       }
>>  >
>>  >                                  if(AXIS2_FAILURE ==  status)
>>  >                                  {
>>  >                                      AXIS2_LOG_ERROR(env->log,
>>  > AXIS2_LOG_SI,
>>  > "failed in setting the value for PortfolioNumber ");
>>  >                                      if(element_qname)
>>  >                                      {
>>  >                                          axutil_qname_free(element_qname,
>>  > env);
>>  >                                      }
>>  >                                      return AXIS2_FAILURE;
>>  >                                  }
>>  >                               }
>>  >
>>  >                               else if(!dont_care_minoccurs)
>>  >                               {
>>  >                                   if(element_qname)
>>  >                                   {
>>  >                                       axutil_qname_free(element_qname,
>>  > env);
>>  >                                   }
>>  >                                   /* this is not a nillable element*/
>>  >                                   AXIS2_LOG_ERROR(env->log,
>> AXIS2_LOG_SI,
>>  > "non nillable or minOuccrs != 0 element PortfolioNumber missing");
>>  >                                   return AXIS2_FAILURE;
>>  >                               }
>>  >
>>  >                   if(element_qname)
>>  >                   {
>>  >                      axutil_qname_free(element_qname, env);
>>  >                      element_qname = NULL;
>>  >                   }
>>  >
>>  >           return status;
>>  >        }
>>  >
>>  >           axis2_bool_t AXIS2_CALL
>>  >           adb_BrokerInformationRequestType_is_particle()
>>  >           {
>>  >
>>  >                  return AXIS2_FALSE;
>>  >
>>  >           }
>>  >
>>  >
>>  >           void AXIS2_CALL
>>  >           adb_BrokerInformationRequestType_declare_parent_namespaces(
>>  >                     adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                     const axutil_env_t *env, axiom_element_t
>>  > *parent_element,
>>  >                     axutil_hash_t *namespaces, int *next_ns_index)
>>  >           {
>>  >
>>  >                   /* Here this is an empty function, Nothing to
>> declare */
>>  >
>>  >           }
>>  >
>>  >
>>  >
>>  >         axiom_node_t* AXIS2_CALL
>>  >         adb_BrokerInformationRequestType_serialize(
>>  >                 adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                 const axutil_env_t *env, axiom_node_t *parent,
>>  > axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t
>>  > *namespaces, int *next_ns_index)
>>  >         {
>>  >
>>  >
>>  >              axis2_char_t *string_to_stream;
>>  >
>>  >
>>  >          axiom_node_t *current_node = NULL;
>>  >          int tag_closed = 0;
>>  >
>>  >
>>  >
>>  >                 axiom_namespace_t *ns1 = NULL;
>>  >
>>  >                 axis2_char_t *qname_uri = NULL;
>>  >                 axis2_char_t *qname_prefix = NULL;
>>  >                 axis2_char_t *p_prefix = NULL;
>>  >                 axis2_bool_t ns_already_defined;
>>  >
>>  >                     axis2_char_t text_value_1[64];
>>  >
>>  >                     axis2_char_t *text_value_2;
>>  >                     axis2_char_t *text_value_2_temp;
>>  >
>>  >                axis2_char_t *start_input_str = NULL;
>>  >                axis2_char_t *end_input_str = NULL;
>>  >                unsigned int start_input_str_len = 0;
>>  >                unsigned int end_input_str_len = 0;
>>  >
>>  >
>>  >                axiom_data_source_t *data_source = NULL;
>>  >                axutil_stream_t *stream = NULL;
>>  >
>>  >
>>  >
>>  >             AXIS2_ENV_CHECK(env, NULL);
>>  >             AXIS2_PARAM_CHECK(env->error,
>> _BrokerInformationRequestType,
>>  > NULL);
>>  >
>>  >
>>  >                     current_node = parent;
>>  >                     data_source = (axiom_data_source_t
>>  > *)axiom_node_get_data_element(current_node, env);
>>  >                     if (!data_source)
>>  >                         return NULL;
>>  >                     stream =
>> axiom_data_source_get_stream(data_source,
>>  > env);
>>  > /* assume parent is of type data source */
>>  >                     if (!stream)
>>  >                         return NULL;
>>  >
>>  >             if(!parent_tag_closed)
>>  >             {
>>  >
>>  >               string_to_stream = ">";
>>  >               axutil_stream_write(stream, env, string_to_stream,
>>  > axutil_strlen(string_to_stream));
>>  >               tag_closed = 1;
>>  >
>>  >             }
>>  >
>>  >                        p_prefix = NULL;
>>  >
>>  >
>>  >                    if
>>  > (!_BrokerInformationRequestType->is_valid_RequestParameters)
>>  >                    {
>>  >
>>  >
>>  >                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>> "Nil
>>  > value found in non-nillable property RequestParameters");
>>  >                             return NULL;
>>  >
>>  >                    }
>>  >                    else
>>  >                    {
>>  >                      start_input_str =
>>  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>>  >                                  (4 + axutil_strlen(p_prefix) +
>>  >                                   axutil_strlen("RequestParameters")
>> +
>>  >                                   ADB_DEFAULT_DIGIT_LIMIT* 2));
>>  >
>>  >                      end_input_str =
>>  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>>  >                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
>>  > axutil_strlen("RequestParameters")));
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >                      /*
>>  >                       * parsing RequestParameters element
>>  >                       */
>>  >
>>  >
>>  >
>>  >                             sprintf(start_input_str,
>>  > "<%s%sRequestParameters",
>>  >                                  p_prefix?p_prefix:"",
>>  >                                  (p_prefix && axutil_strcmp(p_prefix,
>>  > ""))?":":"");
>>  >
>>  >                         start_input_str_len =
>>  > axutil_strlen(start_input_str);
>>  >                         sprintf(end_input_str,
>> "</%s%sRequestParameters>",
>>  >                                  p_prefix?p_prefix:"",
>>  >                                  (p_prefix && axutil_strcmp(p_prefix,
>>  > ""))?":":"");
>>  >                         end_input_str_len =
>> axutil_strlen(end_input_str);
>>  >
>>  >                             if(!adb_ParametersType_is_particle())
>>  >                             {
>>  >                                 axutil_stream_write(stream, env,
>>  > start_input_str, start_input_str_len);
>>  >                                 AXIS2_FREE(env->allocator,start_input_str);
>>  >                             }
>>  >
>>  >
>>  > adb_ParametersType_serialize(_BrokerInformationRequestType->property_RequestParameters,
>>  >
>>  >
>>  > env, current_node, parent_element,
>>  >
>>  > adb_ParametersType_is_particle() || AXIS2_FALSE, namespaces,
>>  > next_ns_index);
>>  >
>>  >                             if(!adb_ParametersType_is_particle())
>>  >                             {
>>  >                                 axutil_stream_write(stream, env,
>>  > end_input_str, end_input_str_len);
>>  >                                 AXIS2_FREE(env->allocator,end_input_str);
>>  >                             }
>>  >
>>  >                  }
>>  >
>>  >
>>  >                        p_prefix = NULL;
>>  >
>>  >
>>  >                    if
>>  > (!_BrokerInformationRequestType->is_valid_PortfolioNumber)
>>  >                    {
>>  >
>>  >
>>  >                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>> "Nil
>>  > value found in non-nillable property PortfolioNumber");
>>  >                             return NULL;
>>  >
>>  >                    }
>>  >                    else
>>  >                    {
>>  >                      start_input_str =
>>  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>>  >                                  (4 + axutil_strlen(p_prefix) +
>>  >                                   axutil_strlen("PortfolioNumber") +
>>  >                                   ADB_DEFAULT_DIGIT_LIMIT* 2));
>>  >
>>  >                      end_input_str =
>>  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>>  >                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
>>  > axutil_strlen("PortfolioNumber")));
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >                      /*
>>  >                       * parsing PortfolioNumber element
>>  >                       */
>>  >
>>  >
>>  >
>>  >                             sprintf(start_input_str,
>>  > "<%s%sPortfolioNumber>",
>>  >                                  p_prefix?p_prefix:"",
>>  >                                  (p_prefix && axutil_strcmp(p_prefix,
>>  > ""))?":":"");
>>  >
>>  >                         start_input_str_len =
>>  > axutil_strlen(start_input_str);
>>  >                         sprintf(end_input_str,
>> "</%s%sPortfolioNumber>",
>>  >                                  p_prefix?p_prefix:"",
>>  >                                  (p_prefix && axutil_strcmp(p_prefix,
>>  > ""))?":":"");
>>  >                         end_input_str_len =
>> axutil_strlen(end_input_str);
>>  >
>>  >                            text_value_2 =
>>  > _BrokerInformationRequestType->property_PortfolioNumber;
>>  >
>>  >                            axutil_stream_write(stream, env,
>>  > start_input_str,
>>  > start_input_str_len);
>>  >                            AXIS2_FREE(env->allocator,end_input_str);
>>  >
>>  >
>>  >                            text_value_2_temp =
>>  > axutil_xml_quote_string(env,
>>  > text_value_2, AXIS2_TRUE);
>>  >                            if (text_value_2_temp)
>>  >                            {
>>  >                                axutil_stream_write(stream, env,
>>  > text_value_2_temp, axutil_strlen(text_value_2_temp));
>>  >                                AXIS2_FREE(env->allocator,
>>  > text_value_2_temp);
>>  >                            }
>>  >                            else
>>  >                            {
>>  >                                axutil_stream_write(stream, env,
>>  > text_value_2, axutil_strlen(text_value_2));
>>  >                            }
>>  >
>>  >                            axutil_stream_write(stream, env,
>> end_input_str,
>>  > end_input_str_len);
>>  > ######                AXIS2_FREE(env->allocator,end_input_str);
>>  >
>>  >                  }
>>  >
>>  >
>>  >
>>  >             return parent;
>>  >         }
>>  >
>>  >
>>  >
>>  >
>>  >             /**
>>  >              * getter for RequestParameters.
>>  >              */
>>  >             adb_ParametersType_t* AXIS2_CALL
>>  >             adb_BrokerInformationRequestType_get_RequestParameters(
>>  >                     adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                     const axutil_env_t *env)
>>  >              {
>>  >
>>  >                     AXIS2_ENV_CHECK(env, NULL);
>>  >                     AXIS2_PARAM_CHECK(env->error,
>>  > _BrokerInformationRequestType, NULL);
>>  >
>>  >
>>  >                 return
>>  > _BrokerInformationRequestType->property_RequestParameters;
>>  >              }
>>  >
>>  >             /**
>>  >              * setter for RequestParameters
>>  >              */
>>  >             axis2_status_t AXIS2_CALL
>>  >             adb_BrokerInformationRequestType_set_RequestParameters(
>>  >                     adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                     const axutil_env_t *env,
>>  >                     adb_ParametersType_t*  arg_RequestParameters)
>>  >              {
>>  >
>>  >
>>  >                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>>  >                 AXIS2_PARAM_CHECK(env->error,
>>  > _BrokerInformationRequestType,
>>  > AXIS2_FAILURE);
>>  >
>>  >                 if(_BrokerInformationRequestType->is_valid_RequestParameters
>>  > &&
>>  >                         arg_RequestParameters ==
>>  > _BrokerInformationRequestType->property_RequestParameters)
>>  >                 {
>>  >
>>  >                     return AXIS2_SUCCESS;
>>  >                 }
>>  >
>>  >
>>  >                   if(NULL == arg_RequestParameters)
>>  >                   {
>>  >                       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>>  > "RequestParameters is being set to NULL, but it is not a nullable
>>  > element");
>>  >                       return AXIS2_FAILURE;
>>  >                   }
>>  >
>>  > adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
>>  > env);
>>  >
>>  >
>>  >                 if(NULL == arg_RequestParameters)
>>  >                 {
>>  >                     /* We are already done */
>>  >                     return AXIS2_SUCCESS;
>>  >                 }
>>  >                 _BrokerInformationRequestType->property_RequestParameters
>>  > =
>>  > arg_RequestParameters;
>>  >
>>  > _BrokerInformationRequestType->is_valid_RequestParameters =
>> AXIS2_TRUE;
>>  >
>>  >                 return AXIS2_SUCCESS;
>>  >              }
>>  >
>>  >
>>  >
>>  >            /**
>>  >             * resetter for RequestParameters
>>  >             */
>>  >            axis2_status_t AXIS2_CALL
>>  >            adb_BrokerInformationRequestType_reset_RequestParameters(
>>  >                    adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                    const axutil_env_t *env)
>>  >            {
>>  >                int i = 0;
>>  >                int count = 0;
>>  >                void *element = NULL;
>>
>> >
>>  >                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>>  >                AXIS2_PARAM_CHECK(env->error,
>>  > _BrokerInformationRequestType,
>>  > AXIS2_FAILURE);
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >                 if(_BrokerInformationRequestType->property_RequestParameters
>>  > != NULL)
>>  >                 {
>>  >
>>  >
>>  >
>>  > adb_ParametersType_free(_BrokerInformationRequestType->property_RequestParameters,
>>  > env);
>>
>> >
>>  > _BrokerInformationRequestType->property_RequestParameters = NULL;
>>  >                 }
>>  >
>>  >
>>  >
>>  >                 _BrokerInformationRequestType->is_valid_RequestParameters
>>  > =
>>  > AXIS2_FALSE;
>>  >                return AXIS2_SUCCESS;
>>  >            }
>>  >
>>  >            /**
>>  >             * Check whether RequestParameters is nill
>>  >             */
>>
>> >            axis2_bool_t AXIS2_CALL
>>  >            adb_BrokerInformationRequestType_is_RequestParameters_nil(
>>
>> >                    adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                    const axutil_env_t *env)
>>  >            {
>>  >                AXIS2_ENV_CHECK(env, AXIS2_TRUE);
>>
>> >                AXIS2_PARAM_CHECK(env->error,
>>  > _BrokerInformationRequestType,
>>  > AXIS2_TRUE);
>>  >
>>  >                return
>>  > !_BrokerInformationRequestType->is_valid_RequestParameters;
>>  >            }
>>  >
>>  >            /**
>>  >             * Set RequestParameters to nill (currently the same as
>> reset)
>>
>> >             */
>>  >            axis2_status_t AXIS2_CALL
>>  >            adb_BrokerInformationRequestType_set_RequestParameters_nil(
>>  >                    adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                    const axutil_env_t *env)
>>  >            {
>>  >                return
>>
>> > adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
>>  > env);
>>  >            }
>>  >
>>  >
>>  >
>>  >             /**
>>  >              * getter for PortfolioNumber.
>>  >              */
>>  >             axis2_char_t* AXIS2_CALL
>>  >             adb_BrokerInformationRequestType_get_PortfolioNumber(
>>
>> >                     adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                     const axutil_env_t *env)
>>  >              {
>>  >
>>  >                     AXIS2_ENV_CHECK(env, NULL);
>>  >                     AXIS2_PARAM_CHECK(env->error,
>>  > _BrokerInformationRequestType, NULL);
>>  >
>>  >
>>  >                 return
>>  > _BrokerInformationRequestType->property_PortfolioNumber;
>>  >              }
>>  >
>>  >             /**
>>  >              * setter for PortfolioNumber
>>  >              */
>>
>> >             axis2_status_t AXIS2_CALL
>>  >             adb_BrokerInformationRequestType_set_PortfolioNumber(
>>  >                     adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                     const axutil_env_t *env,
>>  >                     const axis2_char_t*  arg_PortfolioNumber)
>>
>> >              {
>>  >
>>  >
>>  >                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>>  >                 AXIS2_PARAM_CHECK(env->error,
>>  > _BrokerInformationRequestType,
>>  > AXIS2_FAILURE);
>>  >
>>  >                 if(_BrokerInformationRequestType->is_valid_PortfolioNumber
>>  > &&
>>  >                         arg_PortfolioNumber ==
>>  > _BrokerInformationRequestType->property_PortfolioNumber)
>>  >                 {
>>  >
>>  >                     return AXIS2_SUCCESS;
>>  >                 }
>>  >
>>  >
>>  >                   if(NULL == arg_PortfolioNumber)
>>
>> >                   {
>>  >                       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>>  > "PortfolioNumber is being set to NULL, but it is not a nullable
>> element");
>>  >                       return AXIS2_FAILURE;
>>  >                   }
>>  >
>>  > adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
>>  > env);
>>  >
>>  >
>>  >                 if(NULL == arg_PortfolioNumber)
>>
>> >                 {
>>  >                     /* We are already done */
>>  >                     return AXIS2_SUCCESS;
>>  >                 }
>>  >                 _BrokerInformationRequestType->property_PortfolioNumber
>> =
>>  > (axis2_char_t *)axutil_strdup(env, arg_PortfolioNumber);
>>  >                         if(NULL ==
>>  > _BrokerInformationRequestType->property_PortfolioNumber)
>>  >                         {
>>  >                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>> "Error
>>  > allocating memeory for PortfolioNumber");
>>  >                             return AXIS2_FAILURE;
>>  >                         }
>>  >
>>  > _BrokerInformationRequestType->is_valid_PortfolioNumber = AXIS2_TRUE;
>>  >
>>  >                 return AXIS2_SUCCESS;
>>  >              }
>>  >
>>  >
>>  >
>>  >            /**
>>  >             * resetter for PortfolioNumber
>>
>> >             */
>>  >            axis2_status_t AXIS2_CALL
>>  >            adb_BrokerInformationRequestType_reset_PortfolioNumber(
>>
>> >                    adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                    const axutil_env_t *env)
>>  >            {
>>  >                int i = 0;
>>  >                int count = 0;
>>  >                void *element = NULL;
>>
>> >
>>  >                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>>  >                AXIS2_PARAM_CHECK(env->error,
>>  > _BrokerInformationRequestType,
>>  > AXIS2_FAILURE);
>>  >
>>  >
>>  >
>>  >
>>  >
>>  >                 if(_BrokerInformationRequestType->property_PortfolioNumber
>>  > != NULL)
>>  >                 {
>>  >
>>  >
>>  >                         AXIS2_FREE(env-> allocator,
>>  > _BrokerInformationRequestType->property_PortfolioNumber);
>>
>> >                      _BrokerInformationRequestType->property_PortfolioNumber
>>  > = NULL;
>>  >                 }
>>  >
>>  >
>>  >
>>  >                 _BrokerInformationRequestType->is_valid_PortfolioNumber
>> =
>>  > AXIS2_FALSE;
>>  >                return AXIS2_SUCCESS;
>>  >            }
>>  >
>>  >            /**
>>  >             * Check whether PortfolioNumber is nill
>>  >             */
>>
>> >            axis2_bool_t AXIS2_CALL
>>  >            adb_BrokerInformationRequestType_is_PortfolioNumber_nil(
>>
>> >                    adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                    const axutil_env_t *env)
>>  >            {
>>  >                AXIS2_ENV_CHECK(env, AXIS2_TRUE);
>>
>> >                AXIS2_PARAM_CHECK(env->error,
>>  > _BrokerInformationRequestType,
>>  > AXIS2_TRUE);
>>  >
>>  >                return
>>  > !_BrokerInformationRequestType->is_valid_PortfolioNumber;
>>  >            }
>>  >
>>  >            /**
>>  >             * Set PortfolioNumber to nill (currently the same as
>> reset)
>>  >             */
>>
>> >            axis2_status_t AXIS2_CALL
>>  >            adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
>>  >                    adb_BrokerInformationRequestType_t*
>>  > _BrokerInformationRequestType,
>>  >                    const axutil_env_t *env)
>>  >            {
>>  >                return
>>
>> > adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
>>  > env);
>>  >            }
>>  >
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
>>  For additional commands, e-mail: axis-c-user-help@ws.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: possible bug in WSDL2C-generated code

Posted by Carl Lefrançois <ca...@gmail.com>.
Hi all,

With this fix, the new WSDL2C generated code submits my request and parses
my response with no problems.

This completes the proof of concept I needed to back up my recommendation to
use Axis2/C.

Thanks again for your patience and help.  I'll make it a priority to check
that I have the latest versions!

Carl


2008/3/12, Dimuthu Gamage <di...@gmail.com>:
>
> Hi,
>
> The problem is due to double freeing the end_input_str. I fixed it in the
> svn,
>
>
>                            axutil_stream_write(stream, env,
> start_input_str, start_input_str_len);
>                            AXIS2_FREE(env->allocator,end_input_str);
>
> //// This should be corrected to
>
> AXIS2_FREE(env->allocator,start_input_str);
>
>
>
>                            text_value_2_temp =
> axutil_xml_quote_string(env, text_value_2, AXIS2_TRUE);
>                            if (text_value_2_temp)
>                            {
>                                axutil_stream_write(stream, env,
> text_value_2_temp, axutil_strlen(text_value_2_temp));
>                                AXIS2_FREE(env->allocator,
> text_value_2_temp);
>                            }
>                            else
>                            {
>                                axutil_stream_write(stream, env,
> text_value_2, axutil_strlen(text_value_2));
>
>                            }
>
>                            axutil_stream_write(stream, env,
> end_input_str, end_input_str_len);
> ######                AXIS2_FREE(env->allocator,end_input_str);
>
>
>
>
> Thanks
>
> Dimuthu
>
>
>
> On Wed, Mar 12, 2008 at 10:27 PM, Senaka Fernando <se...@wso2.com> wrote:
> > Hi Carl,
> >
> >  Try this,
> >
> >  Replace: end_input_str =
> >
> > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
> >                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
> >  axutil_strlen("RequestParameters")));
> >
> >  With: end_input_str =
> >
> > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
> >                                  (5 + ADB_DEFAULT_DIGIT_LIMIT * 2 +
> >  axutil_strlen("RequestParameters")));
> >
> >  Regards,
> >  Senaka
> >
> >
> >
> >  > Hi Dimuthu,
> >  >
> >  > You are correct, I was mistakenly using the jars in the Axis2 1.3instead
> >  > of
> >  > the nightly snapshot zip.
> >  >
> >  > with the new code, I get a "debug assertion failed" error.
> >  > (        _ASSERTE(_CrtIsValidHeapPointer(pUserData));      from
> DBGHEAP.C)
> >  >
> >  > Is there some change needed in construction of the request parameters
> with
> >  > the new version of the ADB stubs?
> >  >
> >  >
> >  > Carl
> >  >
> >  >
> >  > The generated file is:
> >  > (###### is added to line causing the problem)
> >  >
> >  >
> >  >         /**
> >  >          * adb_BrokerInformationRequestType.c
> >  >          *
> >  >          * This file was auto-generated from WSDL
> >  >          * by the Apache Axis2/C version: SNAPSHOT  Built on : Mar
> 10,
> >  > 2008
> >  > (08:35:52 GMT+00:00)
> >  >          */
> >  >
> >  >         #include "adb_BrokerInformationRequestType.h"
> >  >
> >  >                 /*
> >  >                  * This type was generated from the piece of schema
> that
> >  > had
> >  >                  * name = BrokerInformationRequestType
> >  >                  * Namespace URI =
> >  >
> http://www.axa.ca/BrokerInformationService/1.0/types/BrokerInformationRequestTypes
> >  >                  * Namespace Prefix = ns2
> >  >                  */
> >  >
> >  >
> >  >
> >  >         struct adb_BrokerInformationRequestType
> >  >         {
> >  >             adb_ParametersType_t* property_RequestParameters;
> >  >
> >  >
> >  >                 axis2_bool_t is_valid_RequestParameters;
> >  >
> >  >
> >  >             axis2_char_t* property_PortfolioNumber;
> >  >
> >  >
> >  >                 axis2_bool_t is_valid_PortfolioNumber;
> >  >
> >  >
> >  >
> >  >         };
> >  >
> >  >
> >  >        /************************* Private Function prototypes
> >  > ********************************/
> >  >
> >  >
> >  >                 axis2_status_t AXIS2_CALL
> >  >
> adb_BrokerInformationRequestType_set_RequestParameters_nil(
> >  >                         adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                         const axutil_env_t *env);
> >  >
> >  >
> >  >                 axis2_status_t AXIS2_CALL
> >  >
> adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
> >  >                         adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                         const axutil_env_t *env);
> >  >
> >  >
> >  >
> >  >        /************************* Function Implmentations
> >  > ********************************/
> >  >         adb_BrokerInformationRequestType_t* AXIS2_CALL
> >  >         adb_BrokerInformationRequestType_create(
> >  >             const axutil_env_t *env)
> >  >         {
> >  >             adb_BrokerInformationRequestType_t
> >  > *_BrokerInformationRequestType = NULL;
> >  >
> >  >             AXIS2_ENV_CHECK(env, NULL);
> >  >
> >  >             _BrokerInformationRequestType =
> >  > (adb_BrokerInformationRequestType_t *) AXIS2_MALLOC(env->
> >  >                 allocator,
> sizeof(adb_BrokerInformationRequestType_t));
> >  >
> >  >             if(NULL == _BrokerInformationRequestType)
> >  >             {
> >  >                 AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
> >  > AXIS2_FAILURE);
> >  >                 return NULL;
> >  >             }
> >  >
> >  >             memset(_BrokerInformationRequestType, 0,
> >  > sizeof(adb_BrokerInformationRequestType_t));
> >  >
> >  >
> _BrokerInformationRequestType->property_RequestParameters  =
> >  > NULL;
> >  >
> _BrokerInformationRequestType->is_valid_RequestParameters
> >  > = AXIS2_FALSE;
> >  >
> _BrokerInformationRequestType->property_PortfolioNumber  =
> >  > NULL;
> >  >
> _BrokerInformationRequestType->is_valid_PortfolioNumber
> >  > =
> >  > AXIS2_FALSE;
> >  >
> >  >
> >  >             return _BrokerInformationRequestType;
> >  >         }
> >  >
> >  >         axis2_status_t AXIS2_CALL
> >  >         adb_BrokerInformationRequestType_free (
> >  >                 adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                 const axutil_env_t *env)
> >  >         {
> >  >
> >  >
> >  >             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
> >  >             AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType,
> >  > AXIS2_FAILURE);
> >  >
> >  >
> >  >
> adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
> >  > env);
> >  >
> >  >
> adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
> >  > env);
> >  >
> >  >
> >  >             if(_BrokerInformationRequestType)
> >  >             {
> >  >                 AXIS2_FREE(env->allocator,
> _BrokerInformationRequestType);
> >  >                 _BrokerInformationRequestType = NULL;
> >  >             }
> >  >             return AXIS2_SUCCESS;
> >  >         }
> >  >
> >  >
> >  >
> >  >
> >  >         axis2_status_t AXIS2_CALL
> >  >         adb_BrokerInformationRequestType_deserialize(
> >  >                 adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                 const axutil_env_t *env,
> >  >                 axiom_node_t **dp_parent,
> >  >                 axis2_bool_t *dp_is_early_node_valid,
> >  >                 axis2_bool_t dont_care_minoccurs)
> >  >         {
> >  >           axiom_node_t *parent = *dp_parent;
> >  >
> >  >           axis2_status_t status = AXIS2_SUCCESS;
> >  >
> >  >               void *element = NULL;
> >  >
> >  >              axis2_char_t* text_value = NULL;
> >  >              axutil_qname_t *qname = NULL;
> >  >
> >  >             axutil_qname_t *element_qname = NULL;
> >  >
> >  >                axiom_node_t *first_node = NULL;
> >  >                axis2_bool_t is_early_node_valid = AXIS2_TRUE;
> >  >                axiom_node_t *current_node = NULL;
> >  >                axiom_element_t *current_element = NULL;
> >  >
> >  >             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
> >  >             AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType,
> >  > AXIS2_FAILURE);
> >  >
> >  >
> >  >
> >  >               while(parent && axiom_node_get_node_type(parent, env)
> !=
> >  > AXIOM_ELEMENT)
> >  >               {
> >  >                   parent = axiom_node_get_next_sibling(parent, env);
> >  >               }
> >  >               if (NULL == parent)
> >  >               {
> >  >                 /* This should be checked before everything */
> >  >                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> >  >                             "Failed in building adb object for
> >  > BrokerInformationRequestType : "
> >  >                             "NULL elemenet can not be passed to
> >  > deserialize");
> >  >                 return AXIS2_FAILURE;
> >  >               }
> >  >
> >  >
> >  >                       first_node = axiom_node_get_first_child(parent,
> >  > env);
> >  >
> >  >
> >  >
> >  >
> >  >                      /*
> >  >                       * building RequestParameters element
> >  >                       */
> >  >
> >  >
> >  >
> >  >                                    current_node = first_node;
> >  >                                    is_early_node_valid = AXIS2_FALSE;
> >  >
> >  >
> >  >                                     while(current_node &&
> >  > axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
> >  >                                     {
> >  >                                         current_node =
> >  > axiom_node_get_next_sibling(current_node, env);
> >  >                                     }
> >  >                                     if(current_node != NULL)
> >  >                                     {
> >  >                                         current_element =
> (axiom_element_t
> >  > *)axiom_node_get_data_element(current_node, env);
> >  >                                         qname =
> >  > axiom_element_get_qname(current_element, env, current_node);
> >  >                                     }
> >  >
> >  >                                  element_qname =
> axutil_qname_create(env,
> >  > "RequestParameters", NULL, NULL);
> >  >
> >  >
> >  >                            if (adb_ParametersType_is_particle() ||
> >  >                                 (current_node   && current_element &&
> >  > (axutil_qname_equals(element_qname, env, qname) ||
> >  > !axutil_strcmp("RequestParameters",
> >  > axiom_element_get_localname(current_element, env)))))
> >  >                            {
> >  >                               if( current_node   && current_element
> &&
> >  > (axutil_qname_equals(element_qname, env, qname) ||
> >  > !axutil_strcmp("RequestParameters",
> >  > axiom_element_get_localname(current_element, env))))
> >  >                               {
> >  >                                 is_early_node_valid = AXIS2_TRUE;
> >  >                               }
> >  >
> >  >
> >  >                                       element =
> >  > (void*)adb_ParametersType_create(env);
> >  >
> >  >                                       status =
> >  > adb_ParametersType_deserialize((adb_ParametersType_t*)element,
> >  >
> >  > env, &current_node, &is_early_node_valid, AXIS2_FALSE);
> >  >                                       if(AXIS2_FAILURE == status)
> >  >                                       {
> >  >                                           AXIS2_LOG_ERROR(env->log,
> >  > AXIS2_LOG_SI, "failed in building adb object for element
> >  > RequestParameters");
> >  >                                       }
> >  >                                       else
> >  >                                       {
> >  >                                           status =
> >  >
> adb_BrokerInformationRequestType_set_RequestParameters(_BrokerInformationRequestType,
> >  > env,
> >  >
> >  > (adb_ParametersType_t*)element);
> >  >                                       }
> >  >
> >  >                                  if(AXIS2_FAILURE ==  status)
> >  >                                  {
> >  >                                      AXIS2_LOG_ERROR(env->log,
> >  > AXIS2_LOG_SI,
> >  > "failed in setting the value for RequestParameters ");
> >  >                                      if(element_qname)
> >  >                                      {
>
> >  >                                          axutil_qname_free(element_qname,
> >  > env);
> >  >                                      }
> >  >                                      return AXIS2_FAILURE;
> >  >                                  }
> >  >                               }
> >  >
> >  >                               else if(!dont_care_minoccurs)
> >  >                               {
> >  >                                   if(element_qname)
> >  >                                   {
> >  >
> axutil_qname_free(element_qname,
> >  > env);
> >  >                                   }
> >  >                                   /* this is not a nillable element*/
> >  >                                   AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI,
> >  > "non nillable or minOuccrs != 0 element RequestParameters missing");
> >  >                                   return AXIS2_FAILURE;
> >  >                               }
> >  >
> >  >                   if(element_qname)
> >  >                   {
> >  >                      axutil_qname_free(element_qname, env);
> >  >                      element_qname = NULL;
> >  >                   }
> >  >
> >  >
> >  >
> >  >                      /*
> >  >                       * building PortfolioNumber element
> >  >                       */
> >  >
> >  >
> >  >
> >  >                                     /*
> >  >                                      * because elements are ordered
> this
> >  > works fine
> >  >                                      */
> >  >
> >  >
> >  >                                    if(current_node != NULL &&
> >  > is_early_node_valid)
> >  >                                    {
> >  >                                        current_node =
> >  > axiom_node_get_next_sibling(current_node, env);
> >  >
> >  >
> >  >                                         while(current_node &&
> >  > axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
> >  >                                         {
> >  >                                             current_node =
> >  > axiom_node_get_next_sibling(current_node, env);
> >  >                                         }
> >  >                                         if(current_node != NULL)
> >  >                                         {
> >  >                                             current_element =
> >  > (axiom_element_t *)axiom_node_get_data_element(current_node, env);
> >  >                                             qname =
> >  > axiom_element_get_qname(current_element, env, current_node);
> >  >                                         }
> >  >
> >  >                                    }
> >  >                                    is_early_node_valid = AXIS2_FALSE;
> >  >
> >  >                                  element_qname =
> axutil_qname_create(env,
> >  > "PortfolioNumber", NULL, NULL);
> >  >
> >  >
> >  >                            if (
> >  >                                 (current_node   && current_element &&
> >  > (axutil_qname_equals(element_qname, env, qname) ||
> >  > !axutil_strcmp("PortfolioNumber",
> >  > axiom_element_get_localname(current_element, env)))))
> >  >                            {
> >  >                               if( current_node   && current_element
> &&
> >  > (axutil_qname_equals(element_qname, env, qname) ||
> >  > !axutil_strcmp("PortfolioNumber",
> >  > axiom_element_get_localname(current_element, env))))
> >  >                               {
> >  >                                 is_early_node_valid = AXIS2_TRUE;
> >  >                               }
> >  >
> >  >
> >  >                                       text_value =
> >  > axiom_element_get_text(current_element, env, current_node);
> >  >                                       if(text_value != NULL)
> >  >                                       {
> >  >                                             status =
> >  >
> adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
> >  > env,
>
> >  >                                                                text_value);
> >  >                                       }
> >  >
> >  >                                       else
> >  >                                       {
> >  >                                             /*
> >  >                                              * axis2_qname_t *qname =
> >  > NULL;
> >  >                                              * axiom_attribute_t
> >  > *the_attri
> >  > = NULL;
> >  >                                              *
> >  >                                              * qname =
> >  > axutil_qname_create(env, "nil",
> >  > "http://www.w3.org/2001/XMLSchema-instance",
> >  > "xsi");
> >  >                                              * the_attri =
> >  > axiom_element_get_attribute(current_element, env, qname);
> >  >                                              */
> >  >                                             /* currently thereis a
> bug in
> >  > the axiom_element_get_attribute, so we have to go to this bad method
> */
> >  >
> >  >                                             axiom_attribute_t
> *the_attri =
> >  > NULL;
> >  >                                             axis2_char_t *attrib_text
> =
> >  > NULL;
> >  >                                             axutil_hash_t
> *attribute_hash
> >  > =
> >  > NULL;
> >  >
> >  >                                             attribute_hash =
> >  > axiom_element_get_all_attributes(current_element, env);
> >  >
> >  >                                             attrib_text = NULL;
> >  >                                             if(attribute_hash)
> >  >                                             {
> >  >                                                  axutil_hash_index_t
> *hi;
> >  >                                                  void *val;
> >  >                                                  const void *key;
> >  >
> >  >                                                  for (hi =
> >  > axutil_hash_first(attribute_hash, env); hi; hi =
> axutil_hash_next(env,
> >  > hi))
> >  >                                                  {
>
> >  >                                                      axutil_hash_this(hi,
> >  > &key, NULL, &val);
> >  >
> >  >
> >  > if(strstr((axis2_char_t*)key,
> >  > "nil|http://www.w3.org/2001/XMLSchema-instance"))
> >  >                                                      {
> >  >                                                          the_attri =
> >  > (axiom_attribute_t*)val;
> >  >                                                          break;
> >  >                                                      }
> >  >                                                  }
> >  >                                             }
> >  >
> >  >                                             if(the_attri)
> >  >                                             {
> >  >                                                 attrib_text =
> >  > axiom_attribute_get_value(the_attri, env);
> >  >                                             }
> >  >                                             else
> >  >                                             {
> >  >                                                 /* this is hoping
> that
> >  > attribute is stored in "http://www.w3.org/2001/XMLSchema-instance",
> this
> >  > happnes when name is in default namespace */
> >  >                                                 attrib_text =
> >  > axiom_element_get_attribute_value_by_name(current_element, env,
> "nil");
> >  >                                             }
> >  >
> >  >                                             if(attrib_text && 0 ==
> >  > axutil_strcmp(attrib_text, "1"))
> >  >                                             {
> >  >
> AXIS2_LOG_ERROR(env->log,
> >  > AXIS2_LOG_SI, "NULL value is set to a non nillable element
> >  > PortfolioNumber");
> >  >                                                 status =
> AXIS2_FAILURE;
> >  >                                             }
> >  >                                             else
> >  >                                             {
> >  >                                                 /* after all, we
> found
> >  > this
> >  > is a empty string */
> >  >                                                 status =
> >  >
> adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
> >  > env,
>
> >  >                                                                    "");
> >  >                                             }
> >  >                                       }
> >  >
> >  >                                  if(AXIS2_FAILURE ==  status)
> >  >                                  {
> >  >                                      AXIS2_LOG_ERROR(env->log,
> >  > AXIS2_LOG_SI,
> >  > "failed in setting the value for PortfolioNumber ");
> >  >                                      if(element_qname)
> >  >                                      {
>
> >  >                                          axutil_qname_free(element_qname,
> >  > env);
> >  >                                      }
> >  >                                      return AXIS2_FAILURE;
> >  >                                  }
> >  >                               }
> >  >
> >  >                               else if(!dont_care_minoccurs)
> >  >                               {
> >  >                                   if(element_qname)
> >  >                                   {
> >  >
> axutil_qname_free(element_qname,
> >  > env);
> >  >                                   }
> >  >                                   /* this is not a nillable element*/
> >  >                                   AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI,
> >  > "non nillable or minOuccrs != 0 element PortfolioNumber missing");
> >  >                                   return AXIS2_FAILURE;
> >  >                               }
> >  >
> >  >                   if(element_qname)
> >  >                   {
> >  >                      axutil_qname_free(element_qname, env);
> >  >                      element_qname = NULL;
> >  >                   }
> >  >
> >  >           return status;
> >  >        }
> >  >
> >  >           axis2_bool_t AXIS2_CALL
> >  >           adb_BrokerInformationRequestType_is_particle()
> >  >           {
> >  >
> >  >                  return AXIS2_FALSE;
> >  >
> >  >           }
> >  >
> >  >
> >  >           void AXIS2_CALL
> >  >           adb_BrokerInformationRequestType_declare_parent_namespaces(
> >  >                     adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                     const axutil_env_t *env, axiom_element_t
> >  > *parent_element,
> >  >                     axutil_hash_t *namespaces, int *next_ns_index)
> >  >           {
> >  >
> >  >                   /* Here this is an empty function, Nothing to
> declare */
> >  >
> >  >           }
> >  >
> >  >
> >  >
> >  >         axiom_node_t* AXIS2_CALL
> >  >         adb_BrokerInformationRequestType_serialize(
> >  >                 adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                 const axutil_env_t *env, axiom_node_t *parent,
> >  > axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t
> >  > *namespaces, int *next_ns_index)
> >  >         {
> >  >
> >  >
> >  >              axis2_char_t *string_to_stream;
> >  >
> >  >
> >  >          axiom_node_t *current_node = NULL;
> >  >          int tag_closed = 0;
> >  >
> >  >
> >  >
> >  >                 axiom_namespace_t *ns1 = NULL;
> >  >
> >  >                 axis2_char_t *qname_uri = NULL;
> >  >                 axis2_char_t *qname_prefix = NULL;
> >  >                 axis2_char_t *p_prefix = NULL;
> >  >                 axis2_bool_t ns_already_defined;
> >  >
> >  >                     axis2_char_t text_value_1[64];
> >  >
> >  >                     axis2_char_t *text_value_2;
> >  >                     axis2_char_t *text_value_2_temp;
> >  >
> >  >                axis2_char_t *start_input_str = NULL;
> >  >                axis2_char_t *end_input_str = NULL;
> >  >                unsigned int start_input_str_len = 0;
> >  >                unsigned int end_input_str_len = 0;
> >  >
> >  >
> >  >                axiom_data_source_t *data_source = NULL;
> >  >                axutil_stream_t *stream = NULL;
> >  >
> >  >
> >  >
> >  >             AXIS2_ENV_CHECK(env, NULL);
> >  >             AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType,
> >  > NULL);
> >  >
> >  >
> >  >                     current_node = parent;
> >  >                     data_source = (axiom_data_source_t
> >  > *)axiom_node_get_data_element(current_node, env);
> >  >                     if (!data_source)
> >  >                         return NULL;
> >  >                     stream =
> axiom_data_source_get_stream(data_source,
> >  > env);
> >  > /* assume parent is of type data source */
> >  >                     if (!stream)
> >  >                         return NULL;
> >  >
> >  >             if(!parent_tag_closed)
> >  >             {
> >  >
> >  >               string_to_stream = ">";
> >  >               axutil_stream_write(stream, env, string_to_stream,
> >  > axutil_strlen(string_to_stream));
> >  >               tag_closed = 1;
> >  >
> >  >             }
> >  >
> >  >                        p_prefix = NULL;
> >  >
> >  >
> >  >                    if
> >  > (!_BrokerInformationRequestType->is_valid_RequestParameters)
> >  >                    {
> >  >
> >  >
> >  >                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "Nil
> >  > value found in non-nillable property RequestParameters");
> >  >                             return NULL;
> >  >
> >  >                    }
> >  >                    else
> >  >                    {
> >  >                      start_input_str =
> >  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
> >  >                                  (4 + axutil_strlen(p_prefix) +
> >  >                                   axutil_strlen("RequestParameters")
> +
> >  >                                   ADB_DEFAULT_DIGIT_LIMIT* 2));
> >  >
> >  >                      end_input_str =
> >  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
> >  >                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
> >  > axutil_strlen("RequestParameters")));
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >                      /*
> >  >                       * parsing RequestParameters element
> >  >                       */
> >  >
> >  >
> >  >
> >  >                             sprintf(start_input_str,
> >  > "<%s%sRequestParameters",
> >  >                                  p_prefix?p_prefix:"",
> >  >                                  (p_prefix && axutil_strcmp(p_prefix,
> >  > ""))?":":"");
> >  >
> >  >                         start_input_str_len =
> >  > axutil_strlen(start_input_str);
> >  >                         sprintf(end_input_str,
> "</%s%sRequestParameters>",
> >  >                                  p_prefix?p_prefix:"",
> >  >                                  (p_prefix && axutil_strcmp(p_prefix,
> >  > ""))?":":"");
> >  >                         end_input_str_len =
> axutil_strlen(end_input_str);
> >  >
> >  >                             if(!adb_ParametersType_is_particle())
> >  >                             {
> >  >                                 axutil_stream_write(stream, env,
> >  > start_input_str, start_input_str_len);
> >  >
> AXIS2_FREE(env->allocator,start_input_str);
> >  >                             }
> >  >
> >  >
> >  >
> adb_ParametersType_serialize(_BrokerInformationRequestType->property_RequestParameters,
> >  >
> >  >
> >  > env, current_node, parent_element,
> >  >
> >  > adb_ParametersType_is_particle() || AXIS2_FALSE, namespaces,
> >  > next_ns_index);
> >  >
> >  >                             if(!adb_ParametersType_is_particle())
> >  >                             {
> >  >                                 axutil_stream_write(stream, env,
> >  > end_input_str, end_input_str_len);
> >  >
> AXIS2_FREE(env->allocator,end_input_str);
> >  >                             }
> >  >
> >  >                  }
> >  >
> >  >
> >  >                        p_prefix = NULL;
> >  >
> >  >
> >  >                    if
> >  > (!_BrokerInformationRequestType->is_valid_PortfolioNumber)
> >  >                    {
> >  >
> >  >
> >  >                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "Nil
> >  > value found in non-nillable property PortfolioNumber");
> >  >                             return NULL;
> >  >
> >  >                    }
> >  >                    else
> >  >                    {
> >  >                      start_input_str =
> >  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
> >  >                                  (4 + axutil_strlen(p_prefix) +
> >  >                                   axutil_strlen("PortfolioNumber") +
> >  >                                   ADB_DEFAULT_DIGIT_LIMIT* 2));
> >  >
> >  >                      end_input_str =
> >  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
> >  >                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
> >  > axutil_strlen("PortfolioNumber")));
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >                      /*
> >  >                       * parsing PortfolioNumber element
> >  >                       */
> >  >
> >  >
> >  >
> >  >                             sprintf(start_input_str,
> >  > "<%s%sPortfolioNumber>",
> >  >                                  p_prefix?p_prefix:"",
> >  >                                  (p_prefix && axutil_strcmp(p_prefix,
> >  > ""))?":":"");
> >  >
> >  >                         start_input_str_len =
> >  > axutil_strlen(start_input_str);
> >  >                         sprintf(end_input_str,
> "</%s%sPortfolioNumber>",
> >  >                                  p_prefix?p_prefix:"",
> >  >                                  (p_prefix && axutil_strcmp(p_prefix,
> >  > ""))?":":"");
> >  >                         end_input_str_len =
> axutil_strlen(end_input_str);
> >  >
> >  >                            text_value_2 =
> >  > _BrokerInformationRequestType->property_PortfolioNumber;
> >  >
> >  >                            axutil_stream_write(stream, env,
> >  > start_input_str,
> >  > start_input_str_len);
> >  >                            AXIS2_FREE(env->allocator,end_input_str);
> >  >
> >  >
> >  >                            text_value_2_temp =
> >  > axutil_xml_quote_string(env,
> >  > text_value_2, AXIS2_TRUE);
> >  >                            if (text_value_2_temp)
> >  >                            {
> >  >                                axutil_stream_write(stream, env,
> >  > text_value_2_temp, axutil_strlen(text_value_2_temp));
> >  >                                AXIS2_FREE(env->allocator,
> >  > text_value_2_temp);
> >  >                            }
> >  >                            else
> >  >                            {
> >  >                                axutil_stream_write(stream, env,
> >  > text_value_2, axutil_strlen(text_value_2));
> >  >                            }
> >  >
> >  >                            axutil_stream_write(stream, env,
> end_input_str,
> >  > end_input_str_len);
> >  > ######                AXIS2_FREE(env->allocator,end_input_str);
> >  >
> >  >                  }
> >  >
> >  >
> >  >
> >  >             return parent;
> >  >         }
> >  >
> >  >
> >  >
> >  >
> >  >             /**
> >  >              * getter for RequestParameters.
> >  >              */
> >  >             adb_ParametersType_t* AXIS2_CALL
> >  >             adb_BrokerInformationRequestType_get_RequestParameters(
> >  >                     adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                     const axutil_env_t *env)
> >  >              {
> >  >
> >  >                     AXIS2_ENV_CHECK(env, NULL);
> >  >                     AXIS2_PARAM_CHECK(env->error,
> >  > _BrokerInformationRequestType, NULL);
> >  >
> >  >
> >  >                 return
> >  > _BrokerInformationRequestType->property_RequestParameters;
> >  >              }
> >  >
> >  >             /**
> >  >              * setter for RequestParameters
> >  >              */
> >  >             axis2_status_t AXIS2_CALL
> >  >             adb_BrokerInformationRequestType_set_RequestParameters(
> >  >                     adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                     const axutil_env_t *env,
> >  >                     adb_ParametersType_t*  arg_RequestParameters)
> >  >              {
> >  >
> >  >
> >  >                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
> >  >                 AXIS2_PARAM_CHECK(env->error,
> >  > _BrokerInformationRequestType,
> >  > AXIS2_FAILURE);
> >  >
> >  >
> if(_BrokerInformationRequestType->is_valid_RequestParameters
> >  > &&
> >  >                         arg_RequestParameters ==
> >  > _BrokerInformationRequestType->property_RequestParameters)
> >  >                 {
> >  >
> >  >                     return AXIS2_SUCCESS;
> >  >                 }
> >  >
> >  >
> >  >                   if(NULL == arg_RequestParameters)
> >  >                   {
> >  >                       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> >  > "RequestParameters is being set to NULL, but it is not a nullable
> >  > element");
> >  >                       return AXIS2_FAILURE;
> >  >                   }
> >  >
> >  >
> adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
> >  > env);
> >  >
> >  >
> >  >                 if(NULL == arg_RequestParameters)
> >  >                 {
> >  >                     /* We are already done */
> >  >                     return AXIS2_SUCCESS;
> >  >                 }
> >  >
> _BrokerInformationRequestType->property_RequestParameters
> >  > =
> >  > arg_RequestParameters;
> >  >
> >  > _BrokerInformationRequestType->is_valid_RequestParameters =
> AXIS2_TRUE;
> >  >
> >  >                 return AXIS2_SUCCESS;
> >  >              }
> >  >
> >  >
> >  >
> >  >            /**
> >  >             * resetter for RequestParameters
> >  >             */
> >  >            axis2_status_t AXIS2_CALL
> >  >            adb_BrokerInformationRequestType_reset_RequestParameters(
> >  >                    adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                    const axutil_env_t *env)
> >  >            {
> >  >                int i = 0;
> >  >                int count = 0;
> >  >                void *element = NULL;
> >
> > >
> >  >                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
> >  >                AXIS2_PARAM_CHECK(env->error,
> >  > _BrokerInformationRequestType,
> >  > AXIS2_FAILURE);
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> if(_BrokerInformationRequestType->property_RequestParameters
> >  > != NULL)
> >  >                 {
> >  >
> >  >
> >  >
> >  >
> adb_ParametersType_free(_BrokerInformationRequestType->property_RequestParameters,
> >  > env);
> >
> > >
> >  > _BrokerInformationRequestType->property_RequestParameters = NULL;
> >  >                 }
> >  >
> >  >
> >  >
> >  >
> _BrokerInformationRequestType->is_valid_RequestParameters
> >  > =
> >  > AXIS2_FALSE;
> >  >                return AXIS2_SUCCESS;
> >  >            }
> >  >
> >  >            /**
> >  >             * Check whether RequestParameters is nill
> >  >             */
> >
> > >            axis2_bool_t AXIS2_CALL
> >  >            adb_BrokerInformationRequestType_is_RequestParameters_nil(
> >
> > >                    adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                    const axutil_env_t *env)
> >  >            {
> >  >                AXIS2_ENV_CHECK(env, AXIS2_TRUE);
> >
> > >                AXIS2_PARAM_CHECK(env->error,
> >  > _BrokerInformationRequestType,
> >  > AXIS2_TRUE);
> >  >
> >  >                return
> >  > !_BrokerInformationRequestType->is_valid_RequestParameters;
> >  >            }
> >  >
> >  >            /**
> >  >             * Set RequestParameters to nill (currently the same as
> reset)
> >
> > >             */
> >  >            axis2_status_t AXIS2_CALL
>
> >  >            adb_BrokerInformationRequestType_set_RequestParameters_nil(
> >  >                    adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                    const axutil_env_t *env)
> >  >            {
> >  >                return
> >
> > >
> adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
> >  > env);
> >  >            }
> >  >
> >  >
> >  >
> >  >             /**
> >  >              * getter for PortfolioNumber.
> >  >              */
> >  >             axis2_char_t* AXIS2_CALL
> >  >             adb_BrokerInformationRequestType_get_PortfolioNumber(
> >
> > >                     adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                     const axutil_env_t *env)
> >  >              {
> >  >
> >  >                     AXIS2_ENV_CHECK(env, NULL);
> >  >                     AXIS2_PARAM_CHECK(env->error,
> >  > _BrokerInformationRequestType, NULL);
> >  >
> >  >
> >  >                 return
> >  > _BrokerInformationRequestType->property_PortfolioNumber;
> >  >              }
> >  >
> >  >             /**
> >  >              * setter for PortfolioNumber
> >  >              */
> >
> > >             axis2_status_t AXIS2_CALL
> >  >             adb_BrokerInformationRequestType_set_PortfolioNumber(
> >  >                     adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                     const axutil_env_t *env,
> >  >                     const axis2_char_t*  arg_PortfolioNumber)
> >
> > >              {
> >  >
> >  >
> >  >                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
> >  >                 AXIS2_PARAM_CHECK(env->error,
> >  > _BrokerInformationRequestType,
> >  > AXIS2_FAILURE);
> >  >
> >  >
> if(_BrokerInformationRequestType->is_valid_PortfolioNumber
> >  > &&
> >  >                         arg_PortfolioNumber ==
> >  > _BrokerInformationRequestType->property_PortfolioNumber)
> >  >                 {
> >  >
> >  >                     return AXIS2_SUCCESS;
> >  >                 }
> >  >
> >  >
> >  >                   if(NULL == arg_PortfolioNumber)
> >
> > >                   {
> >  >                       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> >  > "PortfolioNumber is being set to NULL, but it is not a nullable
> element");
> >  >                       return AXIS2_FAILURE;
> >  >                   }
> >  >
> >  >
> adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
> >  > env);
> >  >
> >  >
> >  >                 if(NULL == arg_PortfolioNumber)
> >
> > >                 {
> >  >                     /* We are already done */
> >  >                     return AXIS2_SUCCESS;
> >  >                 }
> >  >
> _BrokerInformationRequestType->property_PortfolioNumber =
> >  > (axis2_char_t *)axutil_strdup(env, arg_PortfolioNumber);
> >  >                         if(NULL ==
> >  > _BrokerInformationRequestType->property_PortfolioNumber)
> >  >                         {
> >  >                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "Error
> >  > allocating memeory for PortfolioNumber");
> >  >                             return AXIS2_FAILURE;
> >  >                         }
> >  >
> >  > _BrokerInformationRequestType->is_valid_PortfolioNumber = AXIS2_TRUE;
> >  >
> >  >                 return AXIS2_SUCCESS;
> >  >              }
> >  >
> >  >
> >  >
> >  >            /**
> >  >             * resetter for PortfolioNumber
> >
> > >             */
> >  >            axis2_status_t AXIS2_CALL
> >  >            adb_BrokerInformationRequestType_reset_PortfolioNumber(
> >
> > >                    adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                    const axutil_env_t *env)
> >  >            {
> >  >                int i = 0;
> >  >                int count = 0;
> >  >                void *element = NULL;
> >
> > >
> >  >                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
> >  >                AXIS2_PARAM_CHECK(env->error,
> >  > _BrokerInformationRequestType,
> >  > AXIS2_FAILURE);
> >  >
> >  >
> >  >
> >  >
> >  >
> >  >
> if(_BrokerInformationRequestType->property_PortfolioNumber
> >  > != NULL)
> >  >                 {
> >  >
> >  >
> >  >                         AXIS2_FREE(env-> allocator,
> >  > _BrokerInformationRequestType->property_PortfolioNumber);
> >
> >
> >                      _BrokerInformationRequestType->property_PortfolioNumber
> >  > = NULL;
> >  >                 }
> >  >
> >  >
> >  >
> >  >
> _BrokerInformationRequestType->is_valid_PortfolioNumber =
> >  > AXIS2_FALSE;
> >  >                return AXIS2_SUCCESS;
> >  >            }
> >  >
> >  >            /**
> >  >             * Check whether PortfolioNumber is nill
> >  >             */
> >
> > >            axis2_bool_t AXIS2_CALL
> >  >            adb_BrokerInformationRequestType_is_PortfolioNumber_nil(
> >
> > >                    adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                    const axutil_env_t *env)
> >  >            {
> >  >                AXIS2_ENV_CHECK(env, AXIS2_TRUE);
> >
> > >                AXIS2_PARAM_CHECK(env->error,
> >  > _BrokerInformationRequestType,
> >  > AXIS2_TRUE);
> >  >
> >  >                return
> >  > !_BrokerInformationRequestType->is_valid_PortfolioNumber;
> >  >            }
> >  >
> >  >            /**
> >  >             * Set PortfolioNumber to nill (currently the same as
> reset)
> >  >             */
> >
> > >            axis2_status_t AXIS2_CALL
> >  >            adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
> >  >                    adb_BrokerInformationRequestType_t*
> >  > _BrokerInformationRequestType,
> >  >                    const axutil_env_t *env)
> >  >            {
> >  >                return
> >
> > >
> adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
> >  > env);
> >  >            }
> >  >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> >  For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

Re: possible bug in WSDL2C-generated code

Posted by Dimuthu Gamage <di...@gmail.com>.
Hi,

The problem is due to double freeing the end_input_str. I fixed it in the svn,

                           axutil_stream_write(stream, env,
start_input_str, start_input_str_len);
                           AXIS2_FREE(env->allocator,end_input_str);
//// This should be corrected to
AXIS2_FREE(env->allocator,start_input_str);


                           text_value_2_temp =
axutil_xml_quote_string(env, text_value_2, AXIS2_TRUE);
                           if (text_value_2_temp)
                           {
                               axutil_stream_write(stream, env,
text_value_2_temp, axutil_strlen(text_value_2_temp));
                               AXIS2_FREE(env->allocator, text_value_2_temp);
                           }
                           else
                           {
                               axutil_stream_write(stream, env,
text_value_2, axutil_strlen(text_value_2));

                           }

                           axutil_stream_write(stream, env,
end_input_str, end_input_str_len);
######                AXIS2_FREE(env->allocator,end_input_str);



Thanks
Dimuthu


On Wed, Mar 12, 2008 at 10:27 PM, Senaka Fernando <se...@wso2.com> wrote:
> Hi Carl,
>
>  Try this,
>
>  Replace: end_input_str =
>
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
>  axutil_strlen("RequestParameters")));
>
>  With: end_input_str =
>
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                  (5 + ADB_DEFAULT_DIGIT_LIMIT * 2 +
>  axutil_strlen("RequestParameters")));
>
>  Regards,
>  Senaka
>
>
>
>  > Hi Dimuthu,
>  >
>  > You are correct, I was mistakenly using the jars in the Axis2 1.3 instead
>  > of
>  > the nightly snapshot zip.
>  >
>  > with the new code, I get a "debug assertion failed" error.
>  > (        _ASSERTE(_CrtIsValidHeapPointer(pUserData));      from DBGHEAP.C)
>  >
>  > Is there some change needed in construction of the request parameters with
>  > the new version of the ADB stubs?
>  >
>  >
>  > Carl
>  >
>  >
>  > The generated file is:
>  > (###### is added to line causing the problem)
>  >
>  >
>  >         /**
>  >          * adb_BrokerInformationRequestType.c
>  >          *
>  >          * This file was auto-generated from WSDL
>  >          * by the Apache Axis2/C version: SNAPSHOT  Built on : Mar 10,
>  > 2008
>  > (08:35:52 GMT+00:00)
>  >          */
>  >
>  >         #include "adb_BrokerInformationRequestType.h"
>  >
>  >                 /*
>  >                  * This type was generated from the piece of schema that
>  > had
>  >                  * name = BrokerInformationRequestType
>  >                  * Namespace URI =
>  > http://www.axa.ca/BrokerInformationService/1.0/types/BrokerInformationRequestTypes
>  >                  * Namespace Prefix = ns2
>  >                  */
>  >
>  >
>  >
>  >         struct adb_BrokerInformationRequestType
>  >         {
>  >             adb_ParametersType_t* property_RequestParameters;
>  >
>  >
>  >                 axis2_bool_t is_valid_RequestParameters;
>  >
>  >
>  >             axis2_char_t* property_PortfolioNumber;
>  >
>  >
>  >                 axis2_bool_t is_valid_PortfolioNumber;
>  >
>  >
>  >
>  >         };
>  >
>  >
>  >        /************************* Private Function prototypes
>  > ********************************/
>  >
>  >
>  >                 axis2_status_t AXIS2_CALL
>  >                 adb_BrokerInformationRequestType_set_RequestParameters_nil(
>  >                         adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                         const axutil_env_t *env);
>  >
>  >
>  >                 axis2_status_t AXIS2_CALL
>  >                 adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
>  >                         adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                         const axutil_env_t *env);
>  >
>  >
>  >
>  >        /************************* Function Implmentations
>  > ********************************/
>  >         adb_BrokerInformationRequestType_t* AXIS2_CALL
>  >         adb_BrokerInformationRequestType_create(
>  >             const axutil_env_t *env)
>  >         {
>  >             adb_BrokerInformationRequestType_t
>  > *_BrokerInformationRequestType = NULL;
>  >
>  >             AXIS2_ENV_CHECK(env, NULL);
>  >
>  >             _BrokerInformationRequestType =
>  > (adb_BrokerInformationRequestType_t *) AXIS2_MALLOC(env->
>  >                 allocator, sizeof(adb_BrokerInformationRequestType_t));
>  >
>  >             if(NULL == _BrokerInformationRequestType)
>  >             {
>  >                 AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
>  > AXIS2_FAILURE);
>  >                 return NULL;
>  >             }
>  >
>  >             memset(_BrokerInformationRequestType, 0,
>  > sizeof(adb_BrokerInformationRequestType_t));
>  >
>  >             _BrokerInformationRequestType->property_RequestParameters  =
>  > NULL;
>  >                   _BrokerInformationRequestType->is_valid_RequestParameters
>  > = AXIS2_FALSE;
>  >             _BrokerInformationRequestType->property_PortfolioNumber  =
>  > NULL;
>  >                   _BrokerInformationRequestType->is_valid_PortfolioNumber
>  > =
>  > AXIS2_FALSE;
>  >
>  >
>  >             return _BrokerInformationRequestType;
>  >         }
>  >
>  >         axis2_status_t AXIS2_CALL
>  >         adb_BrokerInformationRequestType_free (
>  >                 adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                 const axutil_env_t *env)
>  >         {
>  >
>  >
>  >             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>  >             AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
>  > AXIS2_FAILURE);
>  >
>  >
>  > adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
>  > env);
>  >
>  > adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
>  > env);
>  >
>  >
>  >             if(_BrokerInformationRequestType)
>  >             {
>  >                 AXIS2_FREE(env->allocator, _BrokerInformationRequestType);
>  >                 _BrokerInformationRequestType = NULL;
>  >             }
>  >             return AXIS2_SUCCESS;
>  >         }
>  >
>  >
>  >
>  >
>  >         axis2_status_t AXIS2_CALL
>  >         adb_BrokerInformationRequestType_deserialize(
>  >                 adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                 const axutil_env_t *env,
>  >                 axiom_node_t **dp_parent,
>  >                 axis2_bool_t *dp_is_early_node_valid,
>  >                 axis2_bool_t dont_care_minoccurs)
>  >         {
>  >           axiom_node_t *parent = *dp_parent;
>  >
>  >           axis2_status_t status = AXIS2_SUCCESS;
>  >
>  >               void *element = NULL;
>  >
>  >              axis2_char_t* text_value = NULL;
>  >              axutil_qname_t *qname = NULL;
>  >
>  >             axutil_qname_t *element_qname = NULL;
>  >
>  >                axiom_node_t *first_node = NULL;
>  >                axis2_bool_t is_early_node_valid = AXIS2_TRUE;
>  >                axiom_node_t *current_node = NULL;
>  >                axiom_element_t *current_element = NULL;
>  >
>  >             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>  >             AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
>  > AXIS2_FAILURE);
>  >
>  >
>  >
>  >               while(parent && axiom_node_get_node_type(parent, env) !=
>  > AXIOM_ELEMENT)
>  >               {
>  >                   parent = axiom_node_get_next_sibling(parent, env);
>  >               }
>  >               if (NULL == parent)
>  >               {
>  >                 /* This should be checked before everything */
>  >                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>  >                             "Failed in building adb object for
>  > BrokerInformationRequestType : "
>  >                             "NULL elemenet can not be passed to
>  > deserialize");
>  >                 return AXIS2_FAILURE;
>  >               }
>  >
>  >
>  >                       first_node = axiom_node_get_first_child(parent,
>  > env);
>  >
>  >
>  >
>  >
>  >                      /*
>  >                       * building RequestParameters element
>  >                       */
>  >
>  >
>  >
>  >                                    current_node = first_node;
>  >                                    is_early_node_valid = AXIS2_FALSE;
>  >
>  >
>  >                                     while(current_node &&
>  > axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
>  >                                     {
>  >                                         current_node =
>  > axiom_node_get_next_sibling(current_node, env);
>  >                                     }
>  >                                     if(current_node != NULL)
>  >                                     {
>  >                                         current_element = (axiom_element_t
>  > *)axiom_node_get_data_element(current_node, env);
>  >                                         qname =
>  > axiom_element_get_qname(current_element, env, current_node);
>  >                                     }
>  >
>  >                                  element_qname = axutil_qname_create(env,
>  > "RequestParameters", NULL, NULL);
>  >
>  >
>  >                            if (adb_ParametersType_is_particle() ||
>  >                                 (current_node   && current_element &&
>  > (axutil_qname_equals(element_qname, env, qname) ||
>  > !axutil_strcmp("RequestParameters",
>  > axiom_element_get_localname(current_element, env)))))
>  >                            {
>  >                               if( current_node   && current_element &&
>  > (axutil_qname_equals(element_qname, env, qname) ||
>  > !axutil_strcmp("RequestParameters",
>  > axiom_element_get_localname(current_element, env))))
>  >                               {
>  >                                 is_early_node_valid = AXIS2_TRUE;
>  >                               }
>  >
>  >
>  >                                       element =
>  > (void*)adb_ParametersType_create(env);
>  >
>  >                                       status =
>  > adb_ParametersType_deserialize((adb_ParametersType_t*)element,
>  >
>  > env, &current_node, &is_early_node_valid, AXIS2_FALSE);
>  >                                       if(AXIS2_FAILURE == status)
>  >                                       {
>  >                                           AXIS2_LOG_ERROR(env->log,
>  > AXIS2_LOG_SI, "failed in building adb object for element
>  > RequestParameters");
>  >                                       }
>  >                                       else
>  >                                       {
>  >                                           status =
>  > adb_BrokerInformationRequestType_set_RequestParameters(_BrokerInformationRequestType,
>  > env,
>  >
>  > (adb_ParametersType_t*)element);
>  >                                       }
>  >
>  >                                  if(AXIS2_FAILURE ==  status)
>  >                                  {
>  >                                      AXIS2_LOG_ERROR(env->log,
>  > AXIS2_LOG_SI,
>  > "failed in setting the value for RequestParameters ");
>  >                                      if(element_qname)
>  >                                      {
>  >                                          axutil_qname_free(element_qname,
>  > env);
>  >                                      }
>  >                                      return AXIS2_FAILURE;
>  >                                  }
>  >                               }
>  >
>  >                               else if(!dont_care_minoccurs)
>  >                               {
>  >                                   if(element_qname)
>  >                                   {
>  >                                       axutil_qname_free(element_qname,
>  > env);
>  >                                   }
>  >                                   /* this is not a nillable element*/
>  >                                   AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>  > "non nillable or minOuccrs != 0 element RequestParameters missing");
>  >                                   return AXIS2_FAILURE;
>  >                               }
>  >
>  >                   if(element_qname)
>  >                   {
>  >                      axutil_qname_free(element_qname, env);
>  >                      element_qname = NULL;
>  >                   }
>  >
>  >
>  >
>  >                      /*
>  >                       * building PortfolioNumber element
>  >                       */
>  >
>  >
>  >
>  >                                     /*
>  >                                      * because elements are ordered this
>  > works fine
>  >                                      */
>  >
>  >
>  >                                    if(current_node != NULL &&
>  > is_early_node_valid)
>  >                                    {
>  >                                        current_node =
>  > axiom_node_get_next_sibling(current_node, env);
>  >
>  >
>  >                                         while(current_node &&
>  > axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
>  >                                         {
>  >                                             current_node =
>  > axiom_node_get_next_sibling(current_node, env);
>  >                                         }
>  >                                         if(current_node != NULL)
>  >                                         {
>  >                                             current_element =
>  > (axiom_element_t *)axiom_node_get_data_element(current_node, env);
>  >                                             qname =
>  > axiom_element_get_qname(current_element, env, current_node);
>  >                                         }
>  >
>  >                                    }
>  >                                    is_early_node_valid = AXIS2_FALSE;
>  >
>  >                                  element_qname = axutil_qname_create(env,
>  > "PortfolioNumber", NULL, NULL);
>  >
>  >
>  >                            if (
>  >                                 (current_node   && current_element &&
>  > (axutil_qname_equals(element_qname, env, qname) ||
>  > !axutil_strcmp("PortfolioNumber",
>  > axiom_element_get_localname(current_element, env)))))
>  >                            {
>  >                               if( current_node   && current_element &&
>  > (axutil_qname_equals(element_qname, env, qname) ||
>  > !axutil_strcmp("PortfolioNumber",
>  > axiom_element_get_localname(current_element, env))))
>  >                               {
>  >                                 is_early_node_valid = AXIS2_TRUE;
>  >                               }
>  >
>  >
>  >                                       text_value =
>  > axiom_element_get_text(current_element, env, current_node);
>  >                                       if(text_value != NULL)
>  >                                       {
>  >                                             status =
>  > adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
>  > env,
>  >                                                                text_value);
>  >                                       }
>  >
>  >                                       else
>  >                                       {
>  >                                             /*
>  >                                              * axis2_qname_t *qname =
>  > NULL;
>  >                                              * axiom_attribute_t
>  > *the_attri
>  > = NULL;
>  >                                              *
>  >                                              * qname =
>  > axutil_qname_create(env, "nil",
>  > "http://www.w3.org/2001/XMLSchema-instance",
>  > "xsi");
>  >                                              * the_attri =
>  > axiom_element_get_attribute(current_element, env, qname);
>  >                                              */
>  >                                             /* currently thereis a bug in
>  > the axiom_element_get_attribute, so we have to go to this bad method */
>  >
>  >                                             axiom_attribute_t *the_attri =
>  > NULL;
>  >                                             axis2_char_t *attrib_text =
>  > NULL;
>  >                                             axutil_hash_t *attribute_hash
>  > =
>  > NULL;
>  >
>  >                                             attribute_hash =
>  > axiom_element_get_all_attributes(current_element, env);
>  >
>  >                                             attrib_text = NULL;
>  >                                             if(attribute_hash)
>  >                                             {
>  >                                                  axutil_hash_index_t *hi;
>  >                                                  void *val;
>  >                                                  const void *key;
>  >
>  >                                                  for (hi =
>  > axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env,
>  > hi))
>  >                                                  {
>  >                                                      axutil_hash_this(hi,
>  > &key, NULL, &val);
>  >
>  >
>  > if(strstr((axis2_char_t*)key,
>  > "nil|http://www.w3.org/2001/XMLSchema-instance"))
>  >                                                      {
>  >                                                          the_attri =
>  > (axiom_attribute_t*)val;
>  >                                                          break;
>  >                                                      }
>  >                                                  }
>  >                                             }
>  >
>  >                                             if(the_attri)
>  >                                             {
>  >                                                 attrib_text =
>  > axiom_attribute_get_value(the_attri, env);
>  >                                             }
>  >                                             else
>  >                                             {
>  >                                                 /* this is hoping that
>  > attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this
>  > happnes when name is in default namespace */
>  >                                                 attrib_text =
>  > axiom_element_get_attribute_value_by_name(current_element, env, "nil");
>  >                                             }
>  >
>  >                                             if(attrib_text && 0 ==
>  > axutil_strcmp(attrib_text, "1"))
>  >                                             {
>  >                                                 AXIS2_LOG_ERROR(env->log,
>  > AXIS2_LOG_SI, "NULL value is set to a non nillable element
>  > PortfolioNumber");
>  >                                                 status = AXIS2_FAILURE;
>  >                                             }
>  >                                             else
>  >                                             {
>  >                                                 /* after all, we found
>  > this
>  > is a empty string */
>  >                                                 status =
>  > adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
>  > env,
>  >                                                                    "");
>  >                                             }
>  >                                       }
>  >
>  >                                  if(AXIS2_FAILURE ==  status)
>  >                                  {
>  >                                      AXIS2_LOG_ERROR(env->log,
>  > AXIS2_LOG_SI,
>  > "failed in setting the value for PortfolioNumber ");
>  >                                      if(element_qname)
>  >                                      {
>  >                                          axutil_qname_free(element_qname,
>  > env);
>  >                                      }
>  >                                      return AXIS2_FAILURE;
>  >                                  }
>  >                               }
>  >
>  >                               else if(!dont_care_minoccurs)
>  >                               {
>  >                                   if(element_qname)
>  >                                   {
>  >                                       axutil_qname_free(element_qname,
>  > env);
>  >                                   }
>  >                                   /* this is not a nillable element*/
>  >                                   AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>  > "non nillable or minOuccrs != 0 element PortfolioNumber missing");
>  >                                   return AXIS2_FAILURE;
>  >                               }
>  >
>  >                   if(element_qname)
>  >                   {
>  >                      axutil_qname_free(element_qname, env);
>  >                      element_qname = NULL;
>  >                   }
>  >
>  >           return status;
>  >        }
>  >
>  >           axis2_bool_t AXIS2_CALL
>  >           adb_BrokerInformationRequestType_is_particle()
>  >           {
>  >
>  >                  return AXIS2_FALSE;
>  >
>  >           }
>  >
>  >
>  >           void AXIS2_CALL
>  >           adb_BrokerInformationRequestType_declare_parent_namespaces(
>  >                     adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                     const axutil_env_t *env, axiom_element_t
>  > *parent_element,
>  >                     axutil_hash_t *namespaces, int *next_ns_index)
>  >           {
>  >
>  >                   /* Here this is an empty function, Nothing to declare */
>  >
>  >           }
>  >
>  >
>  >
>  >         axiom_node_t* AXIS2_CALL
>  >         adb_BrokerInformationRequestType_serialize(
>  >                 adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                 const axutil_env_t *env, axiom_node_t *parent,
>  > axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t
>  > *namespaces, int *next_ns_index)
>  >         {
>  >
>  >
>  >              axis2_char_t *string_to_stream;
>  >
>  >
>  >          axiom_node_t *current_node = NULL;
>  >          int tag_closed = 0;
>  >
>  >
>  >
>  >                 axiom_namespace_t *ns1 = NULL;
>  >
>  >                 axis2_char_t *qname_uri = NULL;
>  >                 axis2_char_t *qname_prefix = NULL;
>  >                 axis2_char_t *p_prefix = NULL;
>  >                 axis2_bool_t ns_already_defined;
>  >
>  >                     axis2_char_t text_value_1[64];
>  >
>  >                     axis2_char_t *text_value_2;
>  >                     axis2_char_t *text_value_2_temp;
>  >
>  >                axis2_char_t *start_input_str = NULL;
>  >                axis2_char_t *end_input_str = NULL;
>  >                unsigned int start_input_str_len = 0;
>  >                unsigned int end_input_str_len = 0;
>  >
>  >
>  >                axiom_data_source_t *data_source = NULL;
>  >                axutil_stream_t *stream = NULL;
>  >
>  >
>  >
>  >             AXIS2_ENV_CHECK(env, NULL);
>  >             AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
>  > NULL);
>  >
>  >
>  >                     current_node = parent;
>  >                     data_source = (axiom_data_source_t
>  > *)axiom_node_get_data_element(current_node, env);
>  >                     if (!data_source)
>  >                         return NULL;
>  >                     stream = axiom_data_source_get_stream(data_source,
>  > env);
>  > /* assume parent is of type data source */
>  >                     if (!stream)
>  >                         return NULL;
>  >
>  >             if(!parent_tag_closed)
>  >             {
>  >
>  >               string_to_stream = ">";
>  >               axutil_stream_write(stream, env, string_to_stream,
>  > axutil_strlen(string_to_stream));
>  >               tag_closed = 1;
>  >
>  >             }
>  >
>  >                        p_prefix = NULL;
>  >
>  >
>  >                    if
>  > (!_BrokerInformationRequestType->is_valid_RequestParameters)
>  >                    {
>  >
>  >
>  >                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil
>  > value found in non-nillable property RequestParameters");
>  >                             return NULL;
>  >
>  >                    }
>  >                    else
>  >                    {
>  >                      start_input_str =
>  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>  >                                  (4 + axutil_strlen(p_prefix) +
>  >                                   axutil_strlen("RequestParameters") +
>  >                                   ADB_DEFAULT_DIGIT_LIMIT* 2));
>  >
>  >                      end_input_str =
>  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>  >                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
>  > axutil_strlen("RequestParameters")));
>  >
>  >
>  >
>  >
>  >
>  >
>  >                      /*
>  >                       * parsing RequestParameters element
>  >                       */
>  >
>  >
>  >
>  >                             sprintf(start_input_str,
>  > "<%s%sRequestParameters",
>  >                                  p_prefix?p_prefix:"",
>  >                                  (p_prefix && axutil_strcmp(p_prefix,
>  > ""))?":":"");
>  >
>  >                         start_input_str_len =
>  > axutil_strlen(start_input_str);
>  >                         sprintf(end_input_str, "</%s%sRequestParameters>",
>  >                                  p_prefix?p_prefix:"",
>  >                                  (p_prefix && axutil_strcmp(p_prefix,
>  > ""))?":":"");
>  >                         end_input_str_len = axutil_strlen(end_input_str);
>  >
>  >                             if(!adb_ParametersType_is_particle())
>  >                             {
>  >                                 axutil_stream_write(stream, env,
>  > start_input_str, start_input_str_len);
>  >                                 AXIS2_FREE(env->allocator,start_input_str);
>  >                             }
>  >
>  >
>  > adb_ParametersType_serialize(_BrokerInformationRequestType->property_RequestParameters,
>  >
>  >
>  > env, current_node, parent_element,
>  >
>  > adb_ParametersType_is_particle() || AXIS2_FALSE, namespaces,
>  > next_ns_index);
>  >
>  >                             if(!adb_ParametersType_is_particle())
>  >                             {
>  >                                 axutil_stream_write(stream, env,
>  > end_input_str, end_input_str_len);
>  >                                 AXIS2_FREE(env->allocator,end_input_str);
>  >                             }
>  >
>  >                  }
>  >
>  >
>  >                        p_prefix = NULL;
>  >
>  >
>  >                    if
>  > (!_BrokerInformationRequestType->is_valid_PortfolioNumber)
>  >                    {
>  >
>  >
>  >                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil
>  > value found in non-nillable property PortfolioNumber");
>  >                             return NULL;
>  >
>  >                    }
>  >                    else
>  >                    {
>  >                      start_input_str =
>  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>  >                                  (4 + axutil_strlen(p_prefix) +
>  >                                   axutil_strlen("PortfolioNumber") +
>  >                                   ADB_DEFAULT_DIGIT_LIMIT* 2));
>  >
>  >                      end_input_str =
>  > (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>  >                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
>  > axutil_strlen("PortfolioNumber")));
>  >
>  >
>  >
>  >
>  >
>  >
>  >                      /*
>  >                       * parsing PortfolioNumber element
>  >                       */
>  >
>  >
>  >
>  >                             sprintf(start_input_str,
>  > "<%s%sPortfolioNumber>",
>  >                                  p_prefix?p_prefix:"",
>  >                                  (p_prefix && axutil_strcmp(p_prefix,
>  > ""))?":":"");
>  >
>  >                         start_input_str_len =
>  > axutil_strlen(start_input_str);
>  >                         sprintf(end_input_str, "</%s%sPortfolioNumber>",
>  >                                  p_prefix?p_prefix:"",
>  >                                  (p_prefix && axutil_strcmp(p_prefix,
>  > ""))?":":"");
>  >                         end_input_str_len = axutil_strlen(end_input_str);
>  >
>  >                            text_value_2 =
>  > _BrokerInformationRequestType->property_PortfolioNumber;
>  >
>  >                            axutil_stream_write(stream, env,
>  > start_input_str,
>  > start_input_str_len);
>  >                            AXIS2_FREE(env->allocator,end_input_str);
>  >
>  >
>  >                            text_value_2_temp =
>  > axutil_xml_quote_string(env,
>  > text_value_2, AXIS2_TRUE);
>  >                            if (text_value_2_temp)
>  >                            {
>  >                                axutil_stream_write(stream, env,
>  > text_value_2_temp, axutil_strlen(text_value_2_temp));
>  >                                AXIS2_FREE(env->allocator,
>  > text_value_2_temp);
>  >                            }
>  >                            else
>  >                            {
>  >                                axutil_stream_write(stream, env,
>  > text_value_2, axutil_strlen(text_value_2));
>  >                            }
>  >
>  >                            axutil_stream_write(stream, env, end_input_str,
>  > end_input_str_len);
>  > ######                AXIS2_FREE(env->allocator,end_input_str);
>  >
>  >                  }
>  >
>  >
>  >
>  >             return parent;
>  >         }
>  >
>  >
>  >
>  >
>  >             /**
>  >              * getter for RequestParameters.
>  >              */
>  >             adb_ParametersType_t* AXIS2_CALL
>  >             adb_BrokerInformationRequestType_get_RequestParameters(
>  >                     adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                     const axutil_env_t *env)
>  >              {
>  >
>  >                     AXIS2_ENV_CHECK(env, NULL);
>  >                     AXIS2_PARAM_CHECK(env->error,
>  > _BrokerInformationRequestType, NULL);
>  >
>  >
>  >                 return
>  > _BrokerInformationRequestType->property_RequestParameters;
>  >              }
>  >
>  >             /**
>  >              * setter for RequestParameters
>  >              */
>  >             axis2_status_t AXIS2_CALL
>  >             adb_BrokerInformationRequestType_set_RequestParameters(
>  >                     adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                     const axutil_env_t *env,
>  >                     adb_ParametersType_t*  arg_RequestParameters)
>  >              {
>  >
>  >
>  >                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>  >                 AXIS2_PARAM_CHECK(env->error,
>  > _BrokerInformationRequestType,
>  > AXIS2_FAILURE);
>  >
>  >                 if(_BrokerInformationRequestType->is_valid_RequestParameters
>  > &&
>  >                         arg_RequestParameters ==
>  > _BrokerInformationRequestType->property_RequestParameters)
>  >                 {
>  >
>  >                     return AXIS2_SUCCESS;
>  >                 }
>  >
>  >
>  >                   if(NULL == arg_RequestParameters)
>  >                   {
>  >                       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>  > "RequestParameters is being set to NULL, but it is not a nullable
>  > element");
>  >                       return AXIS2_FAILURE;
>  >                   }
>  >
>  > adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
>  > env);
>  >
>  >
>  >                 if(NULL == arg_RequestParameters)
>  >                 {
>  >                     /* We are already done */
>  >                     return AXIS2_SUCCESS;
>  >                 }
>  >                 _BrokerInformationRequestType->property_RequestParameters
>  > =
>  > arg_RequestParameters;
>  >
>  > _BrokerInformationRequestType->is_valid_RequestParameters = AXIS2_TRUE;
>  >
>  >                 return AXIS2_SUCCESS;
>  >              }
>  >
>  >
>  >
>  >            /**
>  >             * resetter for RequestParameters
>  >             */
>  >            axis2_status_t AXIS2_CALL
>  >            adb_BrokerInformationRequestType_reset_RequestParameters(
>  >                    adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                    const axutil_env_t *env)
>  >            {
>  >                int i = 0;
>  >                int count = 0;
>  >                void *element = NULL;
>
> >
>  >                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>  >                AXIS2_PARAM_CHECK(env->error,
>  > _BrokerInformationRequestType,
>  > AXIS2_FAILURE);
>  >
>  >
>  >
>  >
>  >
>  >                 if(_BrokerInformationRequestType->property_RequestParameters
>  > != NULL)
>  >                 {
>  >
>  >
>  >
>  > adb_ParametersType_free(_BrokerInformationRequestType->property_RequestParameters,
>  > env);
>
> >
>  > _BrokerInformationRequestType->property_RequestParameters = NULL;
>  >                 }
>  >
>  >
>  >
>  >                 _BrokerInformationRequestType->is_valid_RequestParameters
>  > =
>  > AXIS2_FALSE;
>  >                return AXIS2_SUCCESS;
>  >            }
>  >
>  >            /**
>  >             * Check whether RequestParameters is nill
>  >             */
>
> >            axis2_bool_t AXIS2_CALL
>  >            adb_BrokerInformationRequestType_is_RequestParameters_nil(
>
> >                    adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                    const axutil_env_t *env)
>  >            {
>  >                AXIS2_ENV_CHECK(env, AXIS2_TRUE);
>
> >                AXIS2_PARAM_CHECK(env->error,
>  > _BrokerInformationRequestType,
>  > AXIS2_TRUE);
>  >
>  >                return
>  > !_BrokerInformationRequestType->is_valid_RequestParameters;
>  >            }
>  >
>  >            /**
>  >             * Set RequestParameters to nill (currently the same as reset)
>
> >             */
>  >            axis2_status_t AXIS2_CALL
>  >            adb_BrokerInformationRequestType_set_RequestParameters_nil(
>  >                    adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                    const axutil_env_t *env)
>  >            {
>  >                return
>
> > adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
>  > env);
>  >            }
>  >
>  >
>  >
>  >             /**
>  >              * getter for PortfolioNumber.
>  >              */
>  >             axis2_char_t* AXIS2_CALL
>  >             adb_BrokerInformationRequestType_get_PortfolioNumber(
>
> >                     adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                     const axutil_env_t *env)
>  >              {
>  >
>  >                     AXIS2_ENV_CHECK(env, NULL);
>  >                     AXIS2_PARAM_CHECK(env->error,
>  > _BrokerInformationRequestType, NULL);
>  >
>  >
>  >                 return
>  > _BrokerInformationRequestType->property_PortfolioNumber;
>  >              }
>  >
>  >             /**
>  >              * setter for PortfolioNumber
>  >              */
>
> >             axis2_status_t AXIS2_CALL
>  >             adb_BrokerInformationRequestType_set_PortfolioNumber(
>  >                     adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                     const axutil_env_t *env,
>  >                     const axis2_char_t*  arg_PortfolioNumber)
>
> >              {
>  >
>  >
>  >                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>  >                 AXIS2_PARAM_CHECK(env->error,
>  > _BrokerInformationRequestType,
>  > AXIS2_FAILURE);
>  >
>  >                 if(_BrokerInformationRequestType->is_valid_PortfolioNumber
>  > &&
>  >                         arg_PortfolioNumber ==
>  > _BrokerInformationRequestType->property_PortfolioNumber)
>  >                 {
>  >
>  >                     return AXIS2_SUCCESS;
>  >                 }
>  >
>  >
>  >                   if(NULL == arg_PortfolioNumber)
>
> >                   {
>  >                       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>  > "PortfolioNumber is being set to NULL, but it is not a nullable element");
>  >                       return AXIS2_FAILURE;
>  >                   }
>  >
>  > adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
>  > env);
>  >
>  >
>  >                 if(NULL == arg_PortfolioNumber)
>
> >                 {
>  >                     /* We are already done */
>  >                     return AXIS2_SUCCESS;
>  >                 }
>  >                 _BrokerInformationRequestType->property_PortfolioNumber =
>  > (axis2_char_t *)axutil_strdup(env, arg_PortfolioNumber);
>  >                         if(NULL ==
>  > _BrokerInformationRequestType->property_PortfolioNumber)
>  >                         {
>  >                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error
>  > allocating memeory for PortfolioNumber");
>  >                             return AXIS2_FAILURE;
>  >                         }
>  >
>  > _BrokerInformationRequestType->is_valid_PortfolioNumber = AXIS2_TRUE;
>  >
>  >                 return AXIS2_SUCCESS;
>  >              }
>  >
>  >
>  >
>  >            /**
>  >             * resetter for PortfolioNumber
>
> >             */
>  >            axis2_status_t AXIS2_CALL
>  >            adb_BrokerInformationRequestType_reset_PortfolioNumber(
>
> >                    adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                    const axutil_env_t *env)
>  >            {
>  >                int i = 0;
>  >                int count = 0;
>  >                void *element = NULL;
>
> >
>  >                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>  >                AXIS2_PARAM_CHECK(env->error,
>  > _BrokerInformationRequestType,
>  > AXIS2_FAILURE);
>  >
>  >
>  >
>  >
>  >
>  >                 if(_BrokerInformationRequestType->property_PortfolioNumber
>  > != NULL)
>  >                 {
>  >
>  >
>  >                         AXIS2_FREE(env-> allocator,
>  > _BrokerInformationRequestType->property_PortfolioNumber);
>
> >                      _BrokerInformationRequestType->property_PortfolioNumber
>  > = NULL;
>  >                 }
>  >
>  >
>  >
>  >                 _BrokerInformationRequestType->is_valid_PortfolioNumber =
>  > AXIS2_FALSE;
>  >                return AXIS2_SUCCESS;
>  >            }
>  >
>  >            /**
>  >             * Check whether PortfolioNumber is nill
>  >             */
>
> >            axis2_bool_t AXIS2_CALL
>  >            adb_BrokerInformationRequestType_is_PortfolioNumber_nil(
>
> >                    adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                    const axutil_env_t *env)
>  >            {
>  >                AXIS2_ENV_CHECK(env, AXIS2_TRUE);
>
> >                AXIS2_PARAM_CHECK(env->error,
>  > _BrokerInformationRequestType,
>  > AXIS2_TRUE);
>  >
>  >                return
>  > !_BrokerInformationRequestType->is_valid_PortfolioNumber;
>  >            }
>  >
>  >            /**
>  >             * Set PortfolioNumber to nill (currently the same as reset)
>  >             */
>
> >            axis2_status_t AXIS2_CALL
>  >            adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
>  >                    adb_BrokerInformationRequestType_t*
>  > _BrokerInformationRequestType,
>  >                    const axutil_env_t *env)
>  >            {
>  >                return
>
> > adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
>  > env);
>  >            }
>  >
>
>
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
>  For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: possible bug in WSDL2C-generated code

Posted by Senaka Fernando <se...@wso2.com>.
Hi Carl,

Try this,

Replace: end_input_str =
(axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + ADB_DEFAULT_DIGIT_LIMIT +
axutil_strlen("RequestParameters")));

With: end_input_str =
(axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + ADB_DEFAULT_DIGIT_LIMIT * 2 +
axutil_strlen("RequestParameters")));

Regards,
Senaka

> Hi Dimuthu,
>
> You are correct, I was mistakenly using the jars in the Axis2 1.3 instead
> of
> the nightly snapshot zip.
>
> with the new code, I get a "debug assertion failed" error.
> (        _ASSERTE(_CrtIsValidHeapPointer(pUserData));      from DBGHEAP.C)
>
> Is there some change needed in construction of the request parameters with
> the new version of the ADB stubs?
>
>
> Carl
>
>
> The generated file is:
> (###### is added to line causing the problem)
>
>
>         /**
>          * adb_BrokerInformationRequestType.c
>          *
>          * This file was auto-generated from WSDL
>          * by the Apache Axis2/C version: SNAPSHOT  Built on : Mar 10,
> 2008
> (08:35:52 GMT+00:00)
>          */
>
>         #include "adb_BrokerInformationRequestType.h"
>
>                 /*
>                  * This type was generated from the piece of schema that
> had
>                  * name = BrokerInformationRequestType
>                  * Namespace URI =
> http://www.axa.ca/BrokerInformationService/1.0/types/BrokerInformationRequestTypes
>                  * Namespace Prefix = ns2
>                  */
>
>
>
>         struct adb_BrokerInformationRequestType
>         {
>             adb_ParametersType_t* property_RequestParameters;
>
>
>                 axis2_bool_t is_valid_RequestParameters;
>
>
>             axis2_char_t* property_PortfolioNumber;
>
>
>                 axis2_bool_t is_valid_PortfolioNumber;
>
>
>
>         };
>
>
>        /************************* Private Function prototypes
> ********************************/
>
>
>                 axis2_status_t AXIS2_CALL
>                 adb_BrokerInformationRequestType_set_RequestParameters_nil(
>                         adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                         const axutil_env_t *env);
>
>
>                 axis2_status_t AXIS2_CALL
>                 adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
>                         adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                         const axutil_env_t *env);
>
>
>
>        /************************* Function Implmentations
> ********************************/
>         adb_BrokerInformationRequestType_t* AXIS2_CALL
>         adb_BrokerInformationRequestType_create(
>             const axutil_env_t *env)
>         {
>             adb_BrokerInformationRequestType_t
> *_BrokerInformationRequestType = NULL;
>
>             AXIS2_ENV_CHECK(env, NULL);
>
>             _BrokerInformationRequestType =
> (adb_BrokerInformationRequestType_t *) AXIS2_MALLOC(env->
>                 allocator, sizeof(adb_BrokerInformationRequestType_t));
>
>             if(NULL == _BrokerInformationRequestType)
>             {
>                 AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
> AXIS2_FAILURE);
>                 return NULL;
>             }
>
>             memset(_BrokerInformationRequestType, 0,
> sizeof(adb_BrokerInformationRequestType_t));
>
>             _BrokerInformationRequestType->property_RequestParameters  =
> NULL;
>                   _BrokerInformationRequestType->is_valid_RequestParameters
> = AXIS2_FALSE;
>             _BrokerInformationRequestType->property_PortfolioNumber  =
> NULL;
>                   _BrokerInformationRequestType->is_valid_PortfolioNumber
> =
> AXIS2_FALSE;
>
>
>             return _BrokerInformationRequestType;
>         }
>
>         axis2_status_t AXIS2_CALL
>         adb_BrokerInformationRequestType_free (
>                 adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                 const axutil_env_t *env)
>         {
>
>
>             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>             AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
> AXIS2_FAILURE);
>
>
> adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
> env);
>
> adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
> env);
>
>
>             if(_BrokerInformationRequestType)
>             {
>                 AXIS2_FREE(env->allocator, _BrokerInformationRequestType);
>                 _BrokerInformationRequestType = NULL;
>             }
>             return AXIS2_SUCCESS;
>         }
>
>
>
>
>         axis2_status_t AXIS2_CALL
>         adb_BrokerInformationRequestType_deserialize(
>                 adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                 const axutil_env_t *env,
>                 axiom_node_t **dp_parent,
>                 axis2_bool_t *dp_is_early_node_valid,
>                 axis2_bool_t dont_care_minoccurs)
>         {
>           axiom_node_t *parent = *dp_parent;
>
>           axis2_status_t status = AXIS2_SUCCESS;
>
>               void *element = NULL;
>
>              axis2_char_t* text_value = NULL;
>              axutil_qname_t *qname = NULL;
>
>             axutil_qname_t *element_qname = NULL;
>
>                axiom_node_t *first_node = NULL;
>                axis2_bool_t is_early_node_valid = AXIS2_TRUE;
>                axiom_node_t *current_node = NULL;
>                axiom_element_t *current_element = NULL;
>
>             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>             AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
> AXIS2_FAILURE);
>
>
>
>               while(parent && axiom_node_get_node_type(parent, env) !=
> AXIOM_ELEMENT)
>               {
>                   parent = axiom_node_get_next_sibling(parent, env);
>               }
>               if (NULL == parent)
>               {
>                 /* This should be checked before everything */
>                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
>                             "Failed in building adb object for
> BrokerInformationRequestType : "
>                             "NULL elemenet can not be passed to
> deserialize");
>                 return AXIS2_FAILURE;
>               }
>
>
>                       first_node = axiom_node_get_first_child(parent,
> env);
>
>
>
>
>                      /*
>                       * building RequestParameters element
>                       */
>
>
>
>                                    current_node = first_node;
>                                    is_early_node_valid = AXIS2_FALSE;
>
>
>                                     while(current_node &&
> axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
>                                     {
>                                         current_node =
> axiom_node_get_next_sibling(current_node, env);
>                                     }
>                                     if(current_node != NULL)
>                                     {
>                                         current_element = (axiom_element_t
> *)axiom_node_get_data_element(current_node, env);
>                                         qname =
> axiom_element_get_qname(current_element, env, current_node);
>                                     }
>
>                                  element_qname = axutil_qname_create(env,
> "RequestParameters", NULL, NULL);
>
>
>                            if (adb_ParametersType_is_particle() ||
>                                 (current_node   && current_element &&
> (axutil_qname_equals(element_qname, env, qname) ||
> !axutil_strcmp("RequestParameters",
> axiom_element_get_localname(current_element, env)))))
>                            {
>                               if( current_node   && current_element &&
> (axutil_qname_equals(element_qname, env, qname) ||
> !axutil_strcmp("RequestParameters",
> axiom_element_get_localname(current_element, env))))
>                               {
>                                 is_early_node_valid = AXIS2_TRUE;
>                               }
>
>
>                                       element =
> (void*)adb_ParametersType_create(env);
>
>                                       status =
> adb_ParametersType_deserialize((adb_ParametersType_t*)element,
>
> env, &current_node, &is_early_node_valid, AXIS2_FALSE);
>                                       if(AXIS2_FAILURE == status)
>                                       {
>                                           AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI, "failed in building adb object for element
> RequestParameters");
>                                       }
>                                       else
>                                       {
>                                           status =
> adb_BrokerInformationRequestType_set_RequestParameters(_BrokerInformationRequestType,
> env,
>
> (adb_ParametersType_t*)element);
>                                       }
>
>                                  if(AXIS2_FAILURE ==  status)
>                                  {
>                                      AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI,
> "failed in setting the value for RequestParameters ");
>                                      if(element_qname)
>                                      {
>                                          axutil_qname_free(element_qname,
> env);
>                                      }
>                                      return AXIS2_FAILURE;
>                                  }
>                               }
>
>                               else if(!dont_care_minoccurs)
>                               {
>                                   if(element_qname)
>                                   {
>                                       axutil_qname_free(element_qname,
> env);
>                                   }
>                                   /* this is not a nillable element*/
>                                   AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "non nillable or minOuccrs != 0 element RequestParameters missing");
>                                   return AXIS2_FAILURE;
>                               }
>
>                   if(element_qname)
>                   {
>                      axutil_qname_free(element_qname, env);
>                      element_qname = NULL;
>                   }
>
>
>
>                      /*
>                       * building PortfolioNumber element
>                       */
>
>
>
>                                     /*
>                                      * because elements are ordered this
> works fine
>                                      */
>
>
>                                    if(current_node != NULL &&
> is_early_node_valid)
>                                    {
>                                        current_node =
> axiom_node_get_next_sibling(current_node, env);
>
>
>                                         while(current_node &&
> axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
>                                         {
>                                             current_node =
> axiom_node_get_next_sibling(current_node, env);
>                                         }
>                                         if(current_node != NULL)
>                                         {
>                                             current_element =
> (axiom_element_t *)axiom_node_get_data_element(current_node, env);
>                                             qname =
> axiom_element_get_qname(current_element, env, current_node);
>                                         }
>
>                                    }
>                                    is_early_node_valid = AXIS2_FALSE;
>
>                                  element_qname = axutil_qname_create(env,
> "PortfolioNumber", NULL, NULL);
>
>
>                            if (
>                                 (current_node   && current_element &&
> (axutil_qname_equals(element_qname, env, qname) ||
> !axutil_strcmp("PortfolioNumber",
> axiom_element_get_localname(current_element, env)))))
>                            {
>                               if( current_node   && current_element &&
> (axutil_qname_equals(element_qname, env, qname) ||
> !axutil_strcmp("PortfolioNumber",
> axiom_element_get_localname(current_element, env))))
>                               {
>                                 is_early_node_valid = AXIS2_TRUE;
>                               }
>
>
>                                       text_value =
> axiom_element_get_text(current_element, env, current_node);
>                                       if(text_value != NULL)
>                                       {
>                                             status =
> adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
> env,
>                                                                text_value);
>                                       }
>
>                                       else
>                                       {
>                                             /*
>                                              * axis2_qname_t *qname =
> NULL;
>                                              * axiom_attribute_t
> *the_attri
> = NULL;
>                                              *
>                                              * qname =
> axutil_qname_create(env, "nil",
> "http://www.w3.org/2001/XMLSchema-instance",
> "xsi");
>                                              * the_attri =
> axiom_element_get_attribute(current_element, env, qname);
>                                              */
>                                             /* currently thereis a bug in
> the axiom_element_get_attribute, so we have to go to this bad method */
>
>                                             axiom_attribute_t *the_attri =
> NULL;
>                                             axis2_char_t *attrib_text =
> NULL;
>                                             axutil_hash_t *attribute_hash
> =
> NULL;
>
>                                             attribute_hash =
> axiom_element_get_all_attributes(current_element, env);
>
>                                             attrib_text = NULL;
>                                             if(attribute_hash)
>                                             {
>                                                  axutil_hash_index_t *hi;
>                                                  void *val;
>                                                  const void *key;
>
>                                                  for (hi =
> axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env,
> hi))
>                                                  {
>                                                      axutil_hash_this(hi,
> &key, NULL, &val);
>
>
> if(strstr((axis2_char_t*)key,
> "nil|http://www.w3.org/2001/XMLSchema-instance"))
>                                                      {
>                                                          the_attri =
> (axiom_attribute_t*)val;
>                                                          break;
>                                                      }
>                                                  }
>                                             }
>
>                                             if(the_attri)
>                                             {
>                                                 attrib_text =
> axiom_attribute_get_value(the_attri, env);
>                                             }
>                                             else
>                                             {
>                                                 /* this is hoping that
> attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this
> happnes when name is in default namespace */
>                                                 attrib_text =
> axiom_element_get_attribute_value_by_name(current_element, env, "nil");
>                                             }
>
>                                             if(attrib_text && 0 ==
> axutil_strcmp(attrib_text, "1"))
>                                             {
>                                                 AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI, "NULL value is set to a non nillable element
> PortfolioNumber");
>                                                 status = AXIS2_FAILURE;
>                                             }
>                                             else
>                                             {
>                                                 /* after all, we found
> this
> is a empty string */
>                                                 status =
> adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
> env,
>                                                                    "");
>                                             }
>                                       }
>
>                                  if(AXIS2_FAILURE ==  status)
>                                  {
>                                      AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI,
> "failed in setting the value for PortfolioNumber ");
>                                      if(element_qname)
>                                      {
>                                          axutil_qname_free(element_qname,
> env);
>                                      }
>                                      return AXIS2_FAILURE;
>                                  }
>                               }
>
>                               else if(!dont_care_minoccurs)
>                               {
>                                   if(element_qname)
>                                   {
>                                       axutil_qname_free(element_qname,
> env);
>                                   }
>                                   /* this is not a nillable element*/
>                                   AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "non nillable or minOuccrs != 0 element PortfolioNumber missing");
>                                   return AXIS2_FAILURE;
>                               }
>
>                   if(element_qname)
>                   {
>                      axutil_qname_free(element_qname, env);
>                      element_qname = NULL;
>                   }
>
>           return status;
>        }
>
>           axis2_bool_t AXIS2_CALL
>           adb_BrokerInformationRequestType_is_particle()
>           {
>
>                  return AXIS2_FALSE;
>
>           }
>
>
>           void AXIS2_CALL
>           adb_BrokerInformationRequestType_declare_parent_namespaces(
>                     adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                     const axutil_env_t *env, axiom_element_t
> *parent_element,
>                     axutil_hash_t *namespaces, int *next_ns_index)
>           {
>
>                   /* Here this is an empty function, Nothing to declare */
>
>           }
>
>
>
>         axiom_node_t* AXIS2_CALL
>         adb_BrokerInformationRequestType_serialize(
>                 adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                 const axutil_env_t *env, axiom_node_t *parent,
> axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t
> *namespaces, int *next_ns_index)
>         {
>
>
>              axis2_char_t *string_to_stream;
>
>
>          axiom_node_t *current_node = NULL;
>          int tag_closed = 0;
>
>
>
>                 axiom_namespace_t *ns1 = NULL;
>
>                 axis2_char_t *qname_uri = NULL;
>                 axis2_char_t *qname_prefix = NULL;
>                 axis2_char_t *p_prefix = NULL;
>                 axis2_bool_t ns_already_defined;
>
>                     axis2_char_t text_value_1[64];
>
>                     axis2_char_t *text_value_2;
>                     axis2_char_t *text_value_2_temp;
>
>                axis2_char_t *start_input_str = NULL;
>                axis2_char_t *end_input_str = NULL;
>                unsigned int start_input_str_len = 0;
>                unsigned int end_input_str_len = 0;
>
>
>                axiom_data_source_t *data_source = NULL;
>                axutil_stream_t *stream = NULL;
>
>
>
>             AXIS2_ENV_CHECK(env, NULL);
>             AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
> NULL);
>
>
>                     current_node = parent;
>                     data_source = (axiom_data_source_t
> *)axiom_node_get_data_element(current_node, env);
>                     if (!data_source)
>                         return NULL;
>                     stream = axiom_data_source_get_stream(data_source,
> env);
> /* assume parent is of type data source */
>                     if (!stream)
>                         return NULL;
>
>             if(!parent_tag_closed)
>             {
>
>               string_to_stream = ">";
>               axutil_stream_write(stream, env, string_to_stream,
> axutil_strlen(string_to_stream));
>               tag_closed = 1;
>
>             }
>
>                        p_prefix = NULL;
>
>
>                    if
> (!_BrokerInformationRequestType->is_valid_RequestParameters)
>                    {
>
>
>                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil
> value found in non-nillable property RequestParameters");
>                             return NULL;
>
>                    }
>                    else
>                    {
>                      start_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                  (4 + axutil_strlen(p_prefix) +
>                                   axutil_strlen("RequestParameters") +
>                                   ADB_DEFAULT_DIGIT_LIMIT* 2));
>
>                      end_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
> axutil_strlen("RequestParameters")));
>
>
>
>
>
>
>                      /*
>                       * parsing RequestParameters element
>                       */
>
>
>
>                             sprintf(start_input_str,
> "<%s%sRequestParameters",
>                                  p_prefix?p_prefix:"",
>                                  (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>
>                         start_input_str_len =
> axutil_strlen(start_input_str);
>                         sprintf(end_input_str, "</%s%sRequestParameters>",
>                                  p_prefix?p_prefix:"",
>                                  (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>                         end_input_str_len = axutil_strlen(end_input_str);
>
>                             if(!adb_ParametersType_is_particle())
>                             {
>                                 axutil_stream_write(stream, env,
> start_input_str, start_input_str_len);
>                                 AXIS2_FREE(env->allocator,start_input_str);
>                             }
>
>
> adb_ParametersType_serialize(_BrokerInformationRequestType->property_RequestParameters,
>
>
> env, current_node, parent_element,
>
> adb_ParametersType_is_particle() || AXIS2_FALSE, namespaces,
> next_ns_index);
>
>                             if(!adb_ParametersType_is_particle())
>                             {
>                                 axutil_stream_write(stream, env,
> end_input_str, end_input_str_len);
>                                 AXIS2_FREE(env->allocator,end_input_str);
>                             }
>
>                  }
>
>
>                        p_prefix = NULL;
>
>
>                    if
> (!_BrokerInformationRequestType->is_valid_PortfolioNumber)
>                    {
>
>
>                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil
> value found in non-nillable property PortfolioNumber");
>                             return NULL;
>
>                    }
>                    else
>                    {
>                      start_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                  (4 + axutil_strlen(p_prefix) +
>                                   axutil_strlen("PortfolioNumber") +
>                                   ADB_DEFAULT_DIGIT_LIMIT* 2));
>
>                      end_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                  (5 + ADB_DEFAULT_DIGIT_LIMIT +
> axutil_strlen("PortfolioNumber")));
>
>
>
>
>
>
>                      /*
>                       * parsing PortfolioNumber element
>                       */
>
>
>
>                             sprintf(start_input_str,
> "<%s%sPortfolioNumber>",
>                                  p_prefix?p_prefix:"",
>                                  (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>
>                         start_input_str_len =
> axutil_strlen(start_input_str);
>                         sprintf(end_input_str, "</%s%sPortfolioNumber>",
>                                  p_prefix?p_prefix:"",
>                                  (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>                         end_input_str_len = axutil_strlen(end_input_str);
>
>                            text_value_2 =
> _BrokerInformationRequestType->property_PortfolioNumber;
>
>                            axutil_stream_write(stream, env,
> start_input_str,
> start_input_str_len);
>                            AXIS2_FREE(env->allocator,end_input_str);
>
>
>                            text_value_2_temp =
> axutil_xml_quote_string(env,
> text_value_2, AXIS2_TRUE);
>                            if (text_value_2_temp)
>                            {
>                                axutil_stream_write(stream, env,
> text_value_2_temp, axutil_strlen(text_value_2_temp));
>                                AXIS2_FREE(env->allocator,
> text_value_2_temp);
>                            }
>                            else
>                            {
>                                axutil_stream_write(stream, env,
> text_value_2, axutil_strlen(text_value_2));
>                            }
>
>                            axutil_stream_write(stream, env, end_input_str,
> end_input_str_len);
> ######                AXIS2_FREE(env->allocator,end_input_str);
>
>                  }
>
>
>
>             return parent;
>         }
>
>
>
>
>             /**
>              * getter for RequestParameters.
>              */
>             adb_ParametersType_t* AXIS2_CALL
>             adb_BrokerInformationRequestType_get_RequestParameters(
>                     adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                     const axutil_env_t *env)
>              {
>
>                     AXIS2_ENV_CHECK(env, NULL);
>                     AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType, NULL);
>
>
>                 return
> _BrokerInformationRequestType->property_RequestParameters;
>              }
>
>             /**
>              * setter for RequestParameters
>              */
>             axis2_status_t AXIS2_CALL
>             adb_BrokerInformationRequestType_set_RequestParameters(
>                     adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                     const axutil_env_t *env,
>                     adb_ParametersType_t*  arg_RequestParameters)
>              {
>
>
>                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>                 AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType,
> AXIS2_FAILURE);
>
>                 if(_BrokerInformationRequestType->is_valid_RequestParameters
> &&
>                         arg_RequestParameters ==
> _BrokerInformationRequestType->property_RequestParameters)
>                 {
>
>                     return AXIS2_SUCCESS;
>                 }
>
>
>                   if(NULL == arg_RequestParameters)
>                   {
>                       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "RequestParameters is being set to NULL, but it is not a nullable
> element");
>                       return AXIS2_FAILURE;
>                   }
>
> adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
> env);
>
>
>                 if(NULL == arg_RequestParameters)
>                 {
>                     /* We are already done */
>                     return AXIS2_SUCCESS;
>                 }
>                 _BrokerInformationRequestType->property_RequestParameters
> =
> arg_RequestParameters;
>
> _BrokerInformationRequestType->is_valid_RequestParameters = AXIS2_TRUE;
>
>                 return AXIS2_SUCCESS;
>              }
>
>
>
>            /**
>             * resetter for RequestParameters
>             */
>            axis2_status_t AXIS2_CALL
>            adb_BrokerInformationRequestType_reset_RequestParameters(
>                    adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                    const axutil_env_t *env)
>            {
>                int i = 0;
>                int count = 0;
>                void *element = NULL;
>
>                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>                AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType,
> AXIS2_FAILURE);
>
>
>
>
>
>                 if(_BrokerInformationRequestType->property_RequestParameters
> != NULL)
>                 {
>
>
>
> adb_ParametersType_free(_BrokerInformationRequestType->property_RequestParameters,
> env);
>
> _BrokerInformationRequestType->property_RequestParameters = NULL;
>                 }
>
>
>
>                 _BrokerInformationRequestType->is_valid_RequestParameters
> =
> AXIS2_FALSE;
>                return AXIS2_SUCCESS;
>            }
>
>            /**
>             * Check whether RequestParameters is nill
>             */
>            axis2_bool_t AXIS2_CALL
>            adb_BrokerInformationRequestType_is_RequestParameters_nil(
>                    adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                    const axutil_env_t *env)
>            {
>                AXIS2_ENV_CHECK(env, AXIS2_TRUE);
>                AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType,
> AXIS2_TRUE);
>
>                return
> !_BrokerInformationRequestType->is_valid_RequestParameters;
>            }
>
>            /**
>             * Set RequestParameters to nill (currently the same as reset)
>             */
>            axis2_status_t AXIS2_CALL
>            adb_BrokerInformationRequestType_set_RequestParameters_nil(
>                    adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                    const axutil_env_t *env)
>            {
>                return
> adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
> env);
>            }
>
>
>
>             /**
>              * getter for PortfolioNumber.
>              */
>             axis2_char_t* AXIS2_CALL
>             adb_BrokerInformationRequestType_get_PortfolioNumber(
>                     adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                     const axutil_env_t *env)
>              {
>
>                     AXIS2_ENV_CHECK(env, NULL);
>                     AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType, NULL);
>
>
>                 return
> _BrokerInformationRequestType->property_PortfolioNumber;
>              }
>
>             /**
>              * setter for PortfolioNumber
>              */
>             axis2_status_t AXIS2_CALL
>             adb_BrokerInformationRequestType_set_PortfolioNumber(
>                     adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                     const axutil_env_t *env,
>                     const axis2_char_t*  arg_PortfolioNumber)
>              {
>
>
>                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>                 AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType,
> AXIS2_FAILURE);
>
>                 if(_BrokerInformationRequestType->is_valid_PortfolioNumber
> &&
>                         arg_PortfolioNumber ==
> _BrokerInformationRequestType->property_PortfolioNumber)
>                 {
>
>                     return AXIS2_SUCCESS;
>                 }
>
>
>                   if(NULL == arg_PortfolioNumber)
>                   {
>                       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "PortfolioNumber is being set to NULL, but it is not a nullable element");
>                       return AXIS2_FAILURE;
>                   }
>
> adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
> env);
>
>
>                 if(NULL == arg_PortfolioNumber)
>                 {
>                     /* We are already done */
>                     return AXIS2_SUCCESS;
>                 }
>                 _BrokerInformationRequestType->property_PortfolioNumber =
> (axis2_char_t *)axutil_strdup(env, arg_PortfolioNumber);
>                         if(NULL ==
> _BrokerInformationRequestType->property_PortfolioNumber)
>                         {
>                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error
> allocating memeory for PortfolioNumber");
>                             return AXIS2_FAILURE;
>                         }
>
> _BrokerInformationRequestType->is_valid_PortfolioNumber = AXIS2_TRUE;
>
>                 return AXIS2_SUCCESS;
>              }
>
>
>
>            /**
>             * resetter for PortfolioNumber
>             */
>            axis2_status_t AXIS2_CALL
>            adb_BrokerInformationRequestType_reset_PortfolioNumber(
>                    adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                    const axutil_env_t *env)
>            {
>                int i = 0;
>                int count = 0;
>                void *element = NULL;
>
>                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>                AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType,
> AXIS2_FAILURE);
>
>
>
>
>
>                 if(_BrokerInformationRequestType->property_PortfolioNumber
> != NULL)
>                 {
>
>
>                         AXIS2_FREE(env-> allocator,
> _BrokerInformationRequestType->property_PortfolioNumber);
>                      _BrokerInformationRequestType->property_PortfolioNumber
> = NULL;
>                 }
>
>
>
>                 _BrokerInformationRequestType->is_valid_PortfolioNumber =
> AXIS2_FALSE;
>                return AXIS2_SUCCESS;
>            }
>
>            /**
>             * Check whether PortfolioNumber is nill
>             */
>            axis2_bool_t AXIS2_CALL
>            adb_BrokerInformationRequestType_is_PortfolioNumber_nil(
>                    adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                    const axutil_env_t *env)
>            {
>                AXIS2_ENV_CHECK(env, AXIS2_TRUE);
>                AXIS2_PARAM_CHECK(env->error,
> _BrokerInformationRequestType,
> AXIS2_TRUE);
>
>                return
> !_BrokerInformationRequestType->is_valid_PortfolioNumber;
>            }
>
>            /**
>             * Set PortfolioNumber to nill (currently the same as reset)
>             */
>            axis2_status_t AXIS2_CALL
>            adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
>                    adb_BrokerInformationRequestType_t*
> _BrokerInformationRequestType,
>                    const axutil_env_t *env)
>            {
>                return
> adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
> env);
>            }
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: possible bug in WSDL2C-generated code

Posted by Carl Lefrançois <ca...@gmail.com>.
Hi Dimuthu,

You are correct, I was mistakenly using the jars in the Axis2 1.3 instead of
the nightly snapshot zip.

with the new code, I get a "debug assertion failed" error.
(        _ASSERTE(_CrtIsValidHeapPointer(pUserData));      from DBGHEAP.C)

Is there some change needed in construction of the request parameters with
the new version of the ADB stubs?


Carl


The generated file is:
(###### is added to line causing the problem)


        /**
         * adb_BrokerInformationRequestType.c
         *
         * This file was auto-generated from WSDL
         * by the Apache Axis2/C version: SNAPSHOT  Built on : Mar 10, 2008
(08:35:52 GMT+00:00)
         */

        #include "adb_BrokerInformationRequestType.h"

                /*
                 * This type was generated from the piece of schema that had
                 * name = BrokerInformationRequestType
                 * Namespace URI =
http://www.axa.ca/BrokerInformationService/1.0/types/BrokerInformationRequestTypes
                 * Namespace Prefix = ns2
                 */



        struct adb_BrokerInformationRequestType
        {
            adb_ParametersType_t* property_RequestParameters;


                axis2_bool_t is_valid_RequestParameters;


            axis2_char_t* property_PortfolioNumber;


                axis2_bool_t is_valid_PortfolioNumber;



        };


       /************************* Private Function prototypes
********************************/


                axis2_status_t AXIS2_CALL
                adb_BrokerInformationRequestType_set_RequestParameters_nil(
                        adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                        const axutil_env_t *env);


                axis2_status_t AXIS2_CALL
                adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
                        adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                        const axutil_env_t *env);



       /************************* Function Implmentations
********************************/
        adb_BrokerInformationRequestType_t* AXIS2_CALL
        adb_BrokerInformationRequestType_create(
            const axutil_env_t *env)
        {
            adb_BrokerInformationRequestType_t
*_BrokerInformationRequestType = NULL;

            AXIS2_ENV_CHECK(env, NULL);

            _BrokerInformationRequestType =
(adb_BrokerInformationRequestType_t *) AXIS2_MALLOC(env->
                allocator, sizeof(adb_BrokerInformationRequestType_t));

            if(NULL == _BrokerInformationRequestType)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
AXIS2_FAILURE);
                return NULL;
            }

            memset(_BrokerInformationRequestType, 0,
sizeof(adb_BrokerInformationRequestType_t));

            _BrokerInformationRequestType->property_RequestParameters  =
NULL;
                  _BrokerInformationRequestType->is_valid_RequestParameters
= AXIS2_FALSE;
            _BrokerInformationRequestType->property_PortfolioNumber  = NULL;
                  _BrokerInformationRequestType->is_valid_PortfolioNumber  =
AXIS2_FALSE;


            return _BrokerInformationRequestType;
        }

        axis2_status_t AXIS2_CALL
        adb_BrokerInformationRequestType_free (
                adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                const axutil_env_t *env)
        {


            AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
            AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
AXIS2_FAILURE);


adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
env);

adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
env);


            if(_BrokerInformationRequestType)
            {
                AXIS2_FREE(env->allocator, _BrokerInformationRequestType);
                _BrokerInformationRequestType = NULL;
            }
            return AXIS2_SUCCESS;
        }




        axis2_status_t AXIS2_CALL
        adb_BrokerInformationRequestType_deserialize(
                adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                const axutil_env_t *env,
                axiom_node_t **dp_parent,
                axis2_bool_t *dp_is_early_node_valid,
                axis2_bool_t dont_care_minoccurs)
        {
          axiom_node_t *parent = *dp_parent;

          axis2_status_t status = AXIS2_SUCCESS;

              void *element = NULL;

             axis2_char_t* text_value = NULL;
             axutil_qname_t *qname = NULL;

            axutil_qname_t *element_qname = NULL;

               axiom_node_t *first_node = NULL;
               axis2_bool_t is_early_node_valid = AXIS2_TRUE;
               axiom_node_t *current_node = NULL;
               axiom_element_t *current_element = NULL;

            AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
            AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
AXIS2_FAILURE);



              while(parent && axiom_node_get_node_type(parent, env) !=
AXIOM_ELEMENT)
              {
                  parent = axiom_node_get_next_sibling(parent, env);
              }
              if (NULL == parent)
              {
                /* This should be checked before everything */
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                            "Failed in building adb object for
BrokerInformationRequestType : "
                            "NULL elemenet can not be passed to
deserialize");
                return AXIS2_FAILURE;
              }


                      first_node = axiom_node_get_first_child(parent, env);




                     /*
                      * building RequestParameters element
                      */



                                   current_node = first_node;
                                   is_early_node_valid = AXIS2_FALSE;


                                    while(current_node &&
axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
                                    {
                                        current_node =
axiom_node_get_next_sibling(current_node, env);
                                    }
                                    if(current_node != NULL)
                                    {
                                        current_element = (axiom_element_t
*)axiom_node_get_data_element(current_node, env);
                                        qname =
axiom_element_get_qname(current_element, env, current_node);
                                    }

                                 element_qname = axutil_qname_create(env,
"RequestParameters", NULL, NULL);


                           if (adb_ParametersType_is_particle() ||
                                (current_node   && current_element &&
(axutil_qname_equals(element_qname, env, qname) ||
!axutil_strcmp("RequestParameters",
axiom_element_get_localname(current_element, env)))))
                           {
                              if( current_node   && current_element &&
(axutil_qname_equals(element_qname, env, qname) ||
!axutil_strcmp("RequestParameters",
axiom_element_get_localname(current_element, env))))
                              {
                                is_early_node_valid = AXIS2_TRUE;
                              }


                                      element =
(void*)adb_ParametersType_create(env);

                                      status =
adb_ParametersType_deserialize((adb_ParametersType_t*)element,

env, &current_node, &is_early_node_valid, AXIS2_FALSE);
                                      if(AXIS2_FAILURE == status)
                                      {
                                          AXIS2_LOG_ERROR(env->log,
AXIS2_LOG_SI, "failed in building adb object for element
RequestParameters");
                                      }
                                      else
                                      {
                                          status =
adb_BrokerInformationRequestType_set_RequestParameters(_BrokerInformationRequestType,
env,

(adb_ParametersType_t*)element);
                                      }

                                 if(AXIS2_FAILURE ==  status)
                                 {
                                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"failed in setting the value for RequestParameters ");
                                     if(element_qname)
                                     {
                                         axutil_qname_free(element_qname,
env);
                                     }
                                     return AXIS2_FAILURE;
                                 }
                              }

                              else if(!dont_care_minoccurs)
                              {
                                  if(element_qname)
                                  {
                                      axutil_qname_free(element_qname, env);
                                  }
                                  /* this is not a nillable element*/
                                  AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"non nillable or minOuccrs != 0 element RequestParameters missing");
                                  return AXIS2_FAILURE;
                              }

                  if(element_qname)
                  {
                     axutil_qname_free(element_qname, env);
                     element_qname = NULL;
                  }



                     /*
                      * building PortfolioNumber element
                      */



                                    /*
                                     * because elements are ordered this
works fine
                                     */


                                   if(current_node != NULL &&
is_early_node_valid)
                                   {
                                       current_node =
axiom_node_get_next_sibling(current_node, env);


                                        while(current_node &&
axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
                                        {
                                            current_node =
axiom_node_get_next_sibling(current_node, env);
                                        }
                                        if(current_node != NULL)
                                        {
                                            current_element =
(axiom_element_t *)axiom_node_get_data_element(current_node, env);
                                            qname =
axiom_element_get_qname(current_element, env, current_node);
                                        }

                                   }
                                   is_early_node_valid = AXIS2_FALSE;

                                 element_qname = axutil_qname_create(env,
"PortfolioNumber", NULL, NULL);


                           if (
                                (current_node   && current_element &&
(axutil_qname_equals(element_qname, env, qname) ||
!axutil_strcmp("PortfolioNumber",
axiom_element_get_localname(current_element, env)))))
                           {
                              if( current_node   && current_element &&
(axutil_qname_equals(element_qname, env, qname) ||
!axutil_strcmp("PortfolioNumber",
axiom_element_get_localname(current_element, env))))
                              {
                                is_early_node_valid = AXIS2_TRUE;
                              }


                                      text_value =
axiom_element_get_text(current_element, env, current_node);
                                      if(text_value != NULL)
                                      {
                                            status =
adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
env,
                                                               text_value);
                                      }

                                      else
                                      {
                                            /*
                                             * axis2_qname_t *qname = NULL;
                                             * axiom_attribute_t *the_attri
= NULL;
                                             *
                                             * qname =
axutil_qname_create(env, "nil", "http://www.w3.org/2001/XMLSchema-instance",
"xsi");
                                             * the_attri =
axiom_element_get_attribute(current_element, env, qname);
                                             */
                                            /* currently thereis a bug in
the axiom_element_get_attribute, so we have to go to this bad method */

                                            axiom_attribute_t *the_attri =
NULL;
                                            axis2_char_t *attrib_text =
NULL;
                                            axutil_hash_t *attribute_hash =
NULL;

                                            attribute_hash =
axiom_element_get_all_attributes(current_element, env);

                                            attrib_text = NULL;
                                            if(attribute_hash)
                                            {
                                                 axutil_hash_index_t *hi;
                                                 void *val;
                                                 const void *key;

                                                 for (hi =
axutil_hash_first(attribute_hash, env); hi; hi = axutil_hash_next(env, hi))
                                                 {
                                                     axutil_hash_this(hi,
&key, NULL, &val);


if(strstr((axis2_char_t*)key,
"nil|http://www.w3.org/2001/XMLSchema-instance"))
                                                     {
                                                         the_attri =
(axiom_attribute_t*)val;
                                                         break;
                                                     }
                                                 }
                                            }

                                            if(the_attri)
                                            {
                                                attrib_text =
axiom_attribute_get_value(the_attri, env);
                                            }
                                            else
                                            {
                                                /* this is hoping that
attribute is stored in "http://www.w3.org/2001/XMLSchema-instance", this
happnes when name is in default namespace */
                                                attrib_text =
axiom_element_get_attribute_value_by_name(current_element, env, "nil");
                                            }

                                            if(attrib_text && 0 ==
axutil_strcmp(attrib_text, "1"))
                                            {
                                                AXIS2_LOG_ERROR(env->log,
AXIS2_LOG_SI, "NULL value is set to a non nillable element
PortfolioNumber");
                                                status = AXIS2_FAILURE;
                                            }
                                            else
                                            {
                                                /* after all, we found this
is a empty string */
                                                status =
adb_BrokerInformationRequestType_set_PortfolioNumber(_BrokerInformationRequestType,
env,
                                                                   "");
                                            }
                                      }

                                 if(AXIS2_FAILURE ==  status)
                                 {
                                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"failed in setting the value for PortfolioNumber ");
                                     if(element_qname)
                                     {
                                         axutil_qname_free(element_qname,
env);
                                     }
                                     return AXIS2_FAILURE;
                                 }
                              }

                              else if(!dont_care_minoccurs)
                              {
                                  if(element_qname)
                                  {
                                      axutil_qname_free(element_qname, env);
                                  }
                                  /* this is not a nillable element*/
                                  AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"non nillable or minOuccrs != 0 element PortfolioNumber missing");
                                  return AXIS2_FAILURE;
                              }

                  if(element_qname)
                  {
                     axutil_qname_free(element_qname, env);
                     element_qname = NULL;
                  }

          return status;
       }

          axis2_bool_t AXIS2_CALL
          adb_BrokerInformationRequestType_is_particle()
          {

                 return AXIS2_FALSE;

          }


          void AXIS2_CALL
          adb_BrokerInformationRequestType_declare_parent_namespaces(
                    adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                    const axutil_env_t *env, axiom_element_t
*parent_element,
                    axutil_hash_t *namespaces, int *next_ns_index)
          {

                  /* Here this is an empty function, Nothing to declare */

          }



        axiom_node_t* AXIS2_CALL
        adb_BrokerInformationRequestType_serialize(
                adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                const axutil_env_t *env, axiom_node_t *parent,
axiom_element_t *parent_element, int parent_tag_closed, axutil_hash_t
*namespaces, int *next_ns_index)
        {


             axis2_char_t *string_to_stream;


         axiom_node_t *current_node = NULL;
         int tag_closed = 0;



                axiom_namespace_t *ns1 = NULL;

                axis2_char_t *qname_uri = NULL;
                axis2_char_t *qname_prefix = NULL;
                axis2_char_t *p_prefix = NULL;
                axis2_bool_t ns_already_defined;

                    axis2_char_t text_value_1[64];

                    axis2_char_t *text_value_2;
                    axis2_char_t *text_value_2_temp;

               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;


               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;



            AXIS2_ENV_CHECK(env, NULL);
            AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
NULL);


                    current_node = parent;
                    data_source = (axiom_data_source_t
*)axiom_node_get_data_element(current_node, env);
                    if (!data_source)
                        return NULL;
                    stream = axiom_data_source_get_stream(data_source, env);
/* assume parent is of type data source */
                    if (!stream)
                        return NULL;

            if(!parent_tag_closed)
            {

              string_to_stream = ">";
              axutil_stream_write(stream, env, string_to_stream,
axutil_strlen(string_to_stream));
              tag_closed = 1;

            }

                       p_prefix = NULL;


                   if
(!_BrokerInformationRequestType->is_valid_RequestParameters)
                   {


                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil
value found in non-nillable property RequestParameters");
                            return NULL;

                   }
                   else
                   {
                     start_input_str =
(axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) +
                                  axutil_strlen("RequestParameters") +
                                  ADB_DEFAULT_DIGIT_LIMIT* 2));

                     end_input_str =
(axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + ADB_DEFAULT_DIGIT_LIMIT +
axutil_strlen("RequestParameters")));






                     /*
                      * parsing RequestParameters element
                      */



                            sprintf(start_input_str,
"<%s%sRequestParameters",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix,
""))?":":"");

                        start_input_str_len =
axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%sRequestParameters>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix,
""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);

                            if(!adb_ParametersType_is_particle())
                            {
                                axutil_stream_write(stream, env,
start_input_str, start_input_str_len);
                                AXIS2_FREE(env->allocator,start_input_str);
                            }


adb_ParametersType_serialize(_BrokerInformationRequestType->property_RequestParameters,


env, current_node, parent_element,

adb_ParametersType_is_particle() || AXIS2_FALSE, namespaces, next_ns_index);

                            if(!adb_ParametersType_is_particle())
                            {
                                axutil_stream_write(stream, env,
end_input_str, end_input_str_len);
                                AXIS2_FREE(env->allocator,end_input_str);
                            }

                 }


                       p_prefix = NULL;


                   if
(!_BrokerInformationRequestType->is_valid_PortfolioNumber)
                   {


                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil
value found in non-nillable property PortfolioNumber");
                            return NULL;

                   }
                   else
                   {
                     start_input_str =
(axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (4 + axutil_strlen(p_prefix) +
                                  axutil_strlen("PortfolioNumber") +
                                  ADB_DEFAULT_DIGIT_LIMIT* 2));

                     end_input_str =
(axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
                                 (5 + ADB_DEFAULT_DIGIT_LIMIT +
axutil_strlen("PortfolioNumber")));






                     /*
                      * parsing PortfolioNumber element
                      */



                            sprintf(start_input_str,
"<%s%sPortfolioNumber>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix,
""))?":":"");

                        start_input_str_len =
axutil_strlen(start_input_str);
                        sprintf(end_input_str, "</%s%sPortfolioNumber>",
                                 p_prefix?p_prefix:"",
                                 (p_prefix && axutil_strcmp(p_prefix,
""))?":":"");
                        end_input_str_len = axutil_strlen(end_input_str);

                           text_value_2 =
_BrokerInformationRequestType->property_PortfolioNumber;

                           axutil_stream_write(stream, env, start_input_str,
start_input_str_len);
                           AXIS2_FREE(env->allocator,end_input_str);


                           text_value_2_temp = axutil_xml_quote_string(env,
text_value_2, AXIS2_TRUE);
                           if (text_value_2_temp)
                           {
                               axutil_stream_write(stream, env,
text_value_2_temp, axutil_strlen(text_value_2_temp));
                               AXIS2_FREE(env->allocator,
text_value_2_temp);
                           }
                           else
                           {
                               axutil_stream_write(stream, env,
text_value_2, axutil_strlen(text_value_2));
                           }

                           axutil_stream_write(stream, env, end_input_str,
end_input_str_len);
######                AXIS2_FREE(env->allocator,end_input_str);

                 }



            return parent;
        }




            /**
             * getter for RequestParameters.
             */
            adb_ParametersType_t* AXIS2_CALL
            adb_BrokerInformationRequestType_get_RequestParameters(
                    adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                    const axutil_env_t *env)
             {

                    AXIS2_ENV_CHECK(env, NULL);
                    AXIS2_PARAM_CHECK(env->error,
_BrokerInformationRequestType, NULL);


                return
_BrokerInformationRequestType->property_RequestParameters;
             }

            /**
             * setter for RequestParameters
             */
            axis2_status_t AXIS2_CALL
            adb_BrokerInformationRequestType_set_RequestParameters(
                    adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                    const axutil_env_t *env,
                    adb_ParametersType_t*  arg_RequestParameters)
             {


                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
                AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
AXIS2_FAILURE);

                if(_BrokerInformationRequestType->is_valid_RequestParameters
&&
                        arg_RequestParameters ==
_BrokerInformationRequestType->property_RequestParameters)
                {

                    return AXIS2_SUCCESS;
                }


                  if(NULL == arg_RequestParameters)
                  {
                      AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"RequestParameters is being set to NULL, but it is not a nullable element");
                      return AXIS2_FAILURE;
                  }

adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
env);


                if(NULL == arg_RequestParameters)
                {
                    /* We are already done */
                    return AXIS2_SUCCESS;
                }
                _BrokerInformationRequestType->property_RequestParameters =
arg_RequestParameters;

_BrokerInformationRequestType->is_valid_RequestParameters = AXIS2_TRUE;

                return AXIS2_SUCCESS;
             }



           /**
            * resetter for RequestParameters
            */
           axis2_status_t AXIS2_CALL
           adb_BrokerInformationRequestType_reset_RequestParameters(
                   adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                   const axutil_env_t *env)
           {
               int i = 0;
               int count = 0;
               void *element = NULL;

               AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
               AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
AXIS2_FAILURE);





                if(_BrokerInformationRequestType->property_RequestParameters
!= NULL)
                {



adb_ParametersType_free(_BrokerInformationRequestType->property_RequestParameters,
env);

_BrokerInformationRequestType->property_RequestParameters = NULL;
                }



                _BrokerInformationRequestType->is_valid_RequestParameters =
AXIS2_FALSE;
               return AXIS2_SUCCESS;
           }

           /**
            * Check whether RequestParameters is nill
            */
           axis2_bool_t AXIS2_CALL
           adb_BrokerInformationRequestType_is_RequestParameters_nil(
                   adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                   const axutil_env_t *env)
           {
               AXIS2_ENV_CHECK(env, AXIS2_TRUE);
               AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
AXIS2_TRUE);

               return
!_BrokerInformationRequestType->is_valid_RequestParameters;
           }

           /**
            * Set RequestParameters to nill (currently the same as reset)
            */
           axis2_status_t AXIS2_CALL
           adb_BrokerInformationRequestType_set_RequestParameters_nil(
                   adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                   const axutil_env_t *env)
           {
               return
adb_BrokerInformationRequestType_reset_RequestParameters(_BrokerInformationRequestType,
env);
           }



            /**
             * getter for PortfolioNumber.
             */
            axis2_char_t* AXIS2_CALL
            adb_BrokerInformationRequestType_get_PortfolioNumber(
                    adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                    const axutil_env_t *env)
             {

                    AXIS2_ENV_CHECK(env, NULL);
                    AXIS2_PARAM_CHECK(env->error,
_BrokerInformationRequestType, NULL);


                return
_BrokerInformationRequestType->property_PortfolioNumber;
             }

            /**
             * setter for PortfolioNumber
             */
            axis2_status_t AXIS2_CALL
            adb_BrokerInformationRequestType_set_PortfolioNumber(
                    adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                    const axutil_env_t *env,
                    const axis2_char_t*  arg_PortfolioNumber)
             {


                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
                AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
AXIS2_FAILURE);

                if(_BrokerInformationRequestType->is_valid_PortfolioNumber
&&
                        arg_PortfolioNumber ==
_BrokerInformationRequestType->property_PortfolioNumber)
                {

                    return AXIS2_SUCCESS;
                }


                  if(NULL == arg_PortfolioNumber)
                  {
                      AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"PortfolioNumber is being set to NULL, but it is not a nullable element");
                      return AXIS2_FAILURE;
                  }

adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
env);


                if(NULL == arg_PortfolioNumber)
                {
                    /* We are already done */
                    return AXIS2_SUCCESS;
                }
                _BrokerInformationRequestType->property_PortfolioNumber =
(axis2_char_t *)axutil_strdup(env, arg_PortfolioNumber);
                        if(NULL ==
_BrokerInformationRequestType->property_PortfolioNumber)
                        {
                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error
allocating memeory for PortfolioNumber");
                            return AXIS2_FAILURE;
                        }

_BrokerInformationRequestType->is_valid_PortfolioNumber = AXIS2_TRUE;

                return AXIS2_SUCCESS;
             }



           /**
            * resetter for PortfolioNumber
            */
           axis2_status_t AXIS2_CALL
           adb_BrokerInformationRequestType_reset_PortfolioNumber(
                   adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                   const axutil_env_t *env)
           {
               int i = 0;
               int count = 0;
               void *element = NULL;

               AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
               AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
AXIS2_FAILURE);





                if(_BrokerInformationRequestType->property_PortfolioNumber
!= NULL)
                {


                        AXIS2_FREE(env-> allocator,
_BrokerInformationRequestType->property_PortfolioNumber);
                     _BrokerInformationRequestType->property_PortfolioNumber
= NULL;
                }



                _BrokerInformationRequestType->is_valid_PortfolioNumber =
AXIS2_FALSE;
               return AXIS2_SUCCESS;
           }

           /**
            * Check whether PortfolioNumber is nill
            */
           axis2_bool_t AXIS2_CALL
           adb_BrokerInformationRequestType_is_PortfolioNumber_nil(
                   adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                   const axutil_env_t *env)
           {
               AXIS2_ENV_CHECK(env, AXIS2_TRUE);
               AXIS2_PARAM_CHECK(env->error, _BrokerInformationRequestType,
AXIS2_TRUE);

               return
!_BrokerInformationRequestType->is_valid_PortfolioNumber;
           }

           /**
            * Set PortfolioNumber to nill (currently the same as reset)
            */
           axis2_status_t AXIS2_CALL
           adb_BrokerInformationRequestType_set_PortfolioNumber_nil(
                   adb_BrokerInformationRequestType_t*
_BrokerInformationRequestType,
                   const axutil_env_t *env)
           {
               return
adb_BrokerInformationRequestType_reset_PortfolioNumber(_BrokerInformationRequestType,
env);
           }

Re: possible bug in WSDL2C-generated code

Posted by Dimuthu Gamage <di...@gmail.com>.
Hi Carl,

You seems loading the library from axis2 1.3 (Check the  quotes
*********by the Apache Axis2/C version: 1.3  Built on : Aug 10, 2007),

Make sure you have set CLASSPATH correctly to the newer jars.

In the latest svn the code should be generated as,

                               /*
                                * because elements are not ordered we
should surf all the sibling to pick the right one
                                */
                               for (current_node = first_node;
current_node != NULL;
                                             current_node =
axiom_node_get_next_sibling(current_node, env))
                               {

if(axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
                                  {
                                     continue;
                                  }


Can you recheck with the updated CLASSPATH again,


Thanks
Dimuthu



On Wed, Mar 12, 2008 at 6:59 PM, Carl Lefrançois
<ca...@gmail.com> wrote:
> Hi Dimuthu,
>
> Sorry I should have thought of sending the problematic .c file
>
> I'll prefix the relevant lines with #####.
>
> Carl
>
>
>        /**
>         * adb_ResultStatusCodeFormat.h
>         *
>          * This file was auto-generated from WSDL
*******************>         * by the Apache Axis2/C version: 1.3
Built on : Aug 10, 2007
> (04:45:58 LKT)
>         *
>         */
>
>         #include "adb_ResultStatusCodeFormat.h"
>
>               /**
>                * This type was generated from the piece of schema that had
>                * name = ResultStatusCodeFormat
>                * Namespace URI =
> http://www.axa.ca/message/1.0/types/message-types
>                 * Namespace Prefix = ns5
>                */
>
>
>
>         struct adb_ResultStatusCodeFormat
>         {
>             axis2_char_t* attrib_ResultStatusCodeFormat;
>
>          };
>
>
>        /************************* Function Implmentations
> ********************************/
>         AXIS2_EXTERN adb_ResultStatusCodeFormat_t* AXIS2_CALL
>         adb_ResultStatusCodeFormat_create(
>              const axutil_env_t *env )
>         {
>             adb_ResultStatusCodeFormat_t *_ResultStatusCodeFormat = NULL;
>
>             AXIS2_ENV_CHECK(env, NULL);
>
>             _ResultStatusCodeFormat = (adb_ResultStatusCodeFormat_t *)
> AXIS2_MALLOC(env->
>                  allocator, sizeof(adb_ResultStatusCodeFormat_t));
>
>             if(NULL == _ResultStatusCodeFormat)
>             {
>                 AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
> AXIS2_FAILURE);
>                  return NULL;
>             }
>
>
>
>             return _ResultStatusCodeFormat;
>          }
>
>         axis2_status_t AXIS2_CALL
>         adb_ResultStatusCodeFormat_free (
>                 adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
>                  const axutil_env_t *env)
>         {
>
>
>
>             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>
>
>
>             if(_ResultStatusCodeFormat)
>             {
>                  AXIS2_FREE( env->allocator, _ResultStatusCodeFormat);
>                 _ResultStatusCodeFormat = NULL;
>             }
>             return AXIS2_SUCCESS;
>         }
>
>
>
>         axis2_status_t AXIS2_CALL
>          adb_ResultStatusCodeFormat_deserialize(
>                 adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
>                 const axutil_env_t *env,
>                 axiom_node_t* parent)
>         {
>
>             axis2_status_t status = AXIS2_SUCCESS;
>             axiom_namespace_t *ns1 = NULL;
>
>              axis2_char_t* text_value = NULL;
>              axutil_qname_t *qname = NULL;
>
>
>               axutil_qname_t *element_qname = NULL;
>
>                axiom_node_t *first_node = NULL;
>
>
>                axiom_node_t *current_node = NULL;
>  #####               axiom_element_t *current_element = NULL;
>
>             AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>
>             ns1 = axiom_namespace_create (env,
>
> "http://www.axa.ca/message/1.0/types/message-types",
>                                           "ns5");
>
>               if ( NULL == parent )
>               {
>                 /** This should be checked above */
>                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL elemenet for
> ResultStatusCodeFormat"
>                                                " %d :: %s",
> env->error->error_number,
>
> AXIS2_ERROR_GET_MESSAGE(env->error));
>                 return AXIS2_FAILURE;
>                }
>
>                 first_node = parent;
>
>
>
>                      /**
>                       * building ResultStatusCodeFormat element
>                       */
>
>
>
>                                    /**
>                                      * because elements are not ordered we
> should surf all the sibling to pick the right one
>                                       */
>                                for ( current_node = first_node; current_node
> != NULL;
>                                              current_node =
> axiom_node_get_next_sibling( current_node, env))
>                                 {
> #####                                  current_element =
> axiom_node_get_data_element( current_node, env);
>
>                                   qname = axiom_element_get_qname(
> current_element, env, current_node);
>                                    element_qname = axutil_qname_create( env,
> "ResultStatusCodeFormat",
> "http://www.axa.ca/message/1.0/types/message-types", "ns5");
>                                    if ( axutil_qname_equals( element_qname,
> env, qname))
>                                   {
>                                        /** found the requried element */
>                                        break;
>                                    }
>                                }
>
>                            if ( current_node != NULL)
>                            {
>
>                                        text_value =
> axiom_element_get_text(current_element, env, current_node );
>                                       status =
> adb_ResultStatusCodeFormat_set_ResultStatusCodeFormat(
> _ResultStatusCodeFormat, env,
>
> text_value);
>
>                                  if( AXIS2_FAILURE ==  status)
>                                  {
>                                       AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI, "failed in setting the value for ResultStatusCodeFormat "
>                                                          " %d :: %s",
> env->error->error_number,
>
> AXIS2_ERROR_GET_MESSAGE(env->error));
>                                      return AXIS2_FAILURE;
>                                  }
>                            }
>
>                                else
>                                {
>                                    /** this is not a nillable element*/
>                                    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "non nillable or minOuccrs != 0 element ResultStatusCodeFormat missing"
>                                                           " %d :: %s",
> env->error->error_number,
>
> AXIS2_ERROR_GET_MESSAGE(env->error));
>                                    return AXIS2_FAILURE;
>                                 }
>
>
>           return status;
>        }
>
>         axiom_node_t* AXIS2_CALL
>         adb_ResultStatusCodeFormat_serialize(
>                 adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
>                  const axutil_env_t *env, axiom_node_t* parent, int
> has_parent)
>         {
>
>             axiom_namespace_t *ns1 = NULL;
>
>                     axis2_char_t *text_value_1;
>
>                axiom_node_t *current_node = NULL;
>
>                axiom_element_t *current_element = NULL;
>                axiom_data_source_t *data_source = NULL;
>                axutil_stream_t *stream = NULL;
>                 axis2_char_t *start_input_str = NULL;
>                axis2_char_t *end_input_str = NULL;
>                unsigned int start_input_str_len = 0;
>                unsigned int end_input_str_len = 0;
>
>              AXIS2_ENV_CHECK(env, NULL);
>
>             ns1 = axiom_namespace_create (env,
>
> "http://www.axa.ca/message/1.0/types/message-types",
>                                           "ns5");
>
>                 if(has_parent)
>                 {
>                     data_source = axiom_node_get_data_element(parent, env);
>                     if (!data_source)
>                          return NULL;
>                     stream = axiom_data_source_get_stream(data_source, env);
> /* assume parent is of type data source */
>                     if (!stream)
>                         return NULL;
>                      current_node = parent;
>                 }
>                 else
>                 {
>                     data_source = axiom_data_source_create(env, parent,
> &current_node);
>                     stream = axiom_data_source_get_stream(data_source, env);
>                  }
>
>
>                      /**
>                       * parsing ResultStatusCodeFormat element
>                       */
>
>
>
>
>                         start_input_str = "<ns5:ResultStatusCodeFormat>";
>                         start_input_str_len =
> axutil_strlen(start_input_str);
>                         end_input_str = "</ns5:ResultStatusCodeFormat>";
>                          end_input_str_len = axutil_strlen(end_input_str);
>
>                            text_value_1 =
> _ResultStatusCodeFormat->attrib_ResultStatusCodeFormat;
>                            axutil_stream_write(stream, env, start_input_str,
> start_input_str_len);
>                             axutil_stream_write(stream, env, text_value_1,
> axutil_strlen(text_value_1));
>                            axutil_stream_write(stream, env, end_input_str,
> end_input_str_len);
>
>              return parent;
>         }
>
>
>
>             /**
>              * getter for ResultStatusCodeFormat.
>              */
>             axis2_char_t* AXIS2_CALL
>             adb_ResultStatusCodeFormat_get_ResultStatusCodeFormat(
>                      adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
>                     const axutil_env_t *env)
>              {
>                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>
>                 return _ResultStatusCodeFormat->
> attrib_ResultStatusCodeFormat;
>               }
>
>             /**
>              * setter for ResultStatusCodeFormat
>              */
>             axis2_status_t AXIS2_CALL
>             adb_ResultStatusCodeFormat_set_ResultStatusCodeFormat(
>                      adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
>                     const axutil_env_t *env,
>                     axis2_char_t*  param_ResultStatusCodeFormat)
>              {
>
>
>                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>                 if(!_ResultStatusCodeFormat)
>                 {
>                     return AXIS2_FAILURE;
>                 }
>
>
>                   if( NULL == param_ResultStatusCodeFormat )
>                    {
>                       AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
> "ResultStatusCodeFormat is NULL, but not a nullable element"
>                                                  " %d :: %s",
> env->error->error_number,
>
> AXIS2_ERROR_GET_MESSAGE(env->error));
>                       return AXIS2_FAILURE;
>                   }
>                 _ResultStatusCodeFormat-> attrib_ResultStatusCodeFormat =
> param_ResultStatusCodeFormat;
>                  return AXIS2_SUCCESS;
>              }
>
>
>
>
>
> 2008/3/11, Dimuthu Gamage <di...@gmail.com>:
> >
> >
> >
> > Hi Carl,
> >
> > If you can send us the relevant generated adb_ file it would be easy
> > to track the problem.
> >
> > Thanks
> > Dimuthu
> >
> >
> > On Wed, Mar 12, 2008 at 12:42 AM, Carl Lefrançois
> > <ca...@gmail.com> wrote:
> > > Hi all,
> > >
> > > After much debugging I have found why an access violation is being
> caused in
> > > my WSDL2C-generated code.
> > >
> > > While processing the following document: (http : // removed due to
> problems
> > > with my emails being flagged as spam)
> > >
> > > <?xml version='1.0' encoding='UTF-8'?>
> > > <soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/">
> > >     <soapenv:Body>
> > >          <BrokerInformationResponse
> > > xmlns:xsi="www.w3.org/2001/XMLSchema-instance"
> > >
> > >
> xmlns="www.axa.ca/BrokerInformationService/1.0/BrokerInformationResponse"
> > >              xmlns:xsd="www.w3.org/2001/XMLSchema"
> > >             xmlns:soap="schemas.xmlsoap.org/soap/envelope/">
> > >              <TrackingNumber>UNKNOWN</TrackingNumber>
> > >             <Status>
> > >                 <Status xmlns="">ERROR</Status>
> > >                 <Detail xmlns="">
> > >                      <Code>ERROR</Code>
> > >                     <Description>Could not unbind Request from
> > > XML!</Description>
> > >                 </Detail>
> > >             </Status>
> > >         </BrokerInformationResponse>
> > >      </soapenv:Body>
> > > </soapenv:Envelope>
> > >
> > >
> > > During construction of the node tree representing this document, an
> om_text
> > > data element is created to hold the text "ERROR" in the first Status
> > > element.  This om_text element is then assigned to the data_element
> member
> > > of the axiom_node_t representing the first Status element on the
> following
> > > line:
> > >
> > > (line 603 of axiom\src\om\om_text.c:)
> > >     axiom_node_set_data_element((*node), env, om_text);
> > >
> > > The node_type element of this node is correctly set to 8 (AXIOM_TEXT).
> > >
> > > however during deserialization in the WSDL2C generated code, the same
> data
> > > element is read into an axiom_element_t * defined as:
> > >  axiom_element_t *current_element = NULL;
> > >
> > > in the following line:
> > > current_element = axiom_node_get_data_element( current_node, env);
> > >
> > >
> > > followed by a call which attempts to read the string value of
> > > (axiom_element_t *)current_element->ns->prefix:
> > >  qname = axiom_element_get_qname( current_element, env, current_node);
> > >
> > > which causes an access violation.
> > >
> > > I would like to help with debugging the WSDL2C tool but my time on this
> > > project doesn't allow it at the moment.  If the information above isn't
> > > detailed enough I'll gladly clarify so the problem can be fixed.
> > >
> > > Carl
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: possible bug in WSDL2C-generated code

Posted by Carl Lefrançois <ca...@gmail.com>.
Hi Dimuthu,

Sorry I should have thought of sending the problematic .c file

I'll prefix the relevant lines with #####.

Carl


       /**
        * adb_ResultStatusCodeFormat.h
        *
        * This file was auto-generated from WSDL
        * by the Apache Axis2/C version: 1.3  Built on : Aug 10, 2007
(04:45:58 LKT)
        *
        */

        #include "adb_ResultStatusCodeFormat.h"

              /**
               * This type was generated from the piece of schema that had
               * name = ResultStatusCodeFormat
               * Namespace URI =
http://www.axa.ca/message/1.0/types/message-types
               * Namespace Prefix = ns5
               */



        struct adb_ResultStatusCodeFormat
        {
            axis2_char_t* attrib_ResultStatusCodeFormat;

        };


       /************************* Function Implmentations
********************************/
        AXIS2_EXTERN adb_ResultStatusCodeFormat_t* AXIS2_CALL
        adb_ResultStatusCodeFormat_create(
            const axutil_env_t *env )
        {
            adb_ResultStatusCodeFormat_t *_ResultStatusCodeFormat = NULL;

            AXIS2_ENV_CHECK(env, NULL);

            _ResultStatusCodeFormat = (adb_ResultStatusCodeFormat_t *)
AXIS2_MALLOC(env->
                allocator, sizeof(adb_ResultStatusCodeFormat_t));

            if(NULL == _ResultStatusCodeFormat)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
AXIS2_FAILURE);
                return NULL;
            }



            return _ResultStatusCodeFormat;
         }

        axis2_status_t AXIS2_CALL
        adb_ResultStatusCodeFormat_free (
                adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
                const axutil_env_t *env)
        {



            AXIS2_ENV_CHECK(env, AXIS2_FAILURE);



            if(_ResultStatusCodeFormat)
            {
                AXIS2_FREE( env->allocator, _ResultStatusCodeFormat);
                _ResultStatusCodeFormat = NULL;
            }
            return AXIS2_SUCCESS;
        }



        axis2_status_t AXIS2_CALL
        adb_ResultStatusCodeFormat_deserialize(
                adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
                const axutil_env_t *env,
                axiom_node_t* parent)
        {

            axis2_status_t status = AXIS2_SUCCESS;
            axiom_namespace_t *ns1 = NULL;

             axis2_char_t* text_value = NULL;
             axutil_qname_t *qname = NULL;


              axutil_qname_t *element_qname = NULL;

               axiom_node_t *first_node = NULL;


               axiom_node_t *current_node = NULL;
#####               axiom_element_t *current_element = NULL;

            AXIS2_ENV_CHECK(env, AXIS2_FAILURE);

            ns1 = axiom_namespace_create (env,
                                         "
http://www.axa.ca/message/1.0/types/message-types",
                                         "ns5");

              if ( NULL == parent )
              {
                /** This should be checked above */
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL elemenet for
ResultStatusCodeFormat"
                                              " %d :: %s",
env->error->error_number,

AXIS2_ERROR_GET_MESSAGE(env->error));
                return AXIS2_FAILURE;
              }

                first_node = parent;



                     /**
                      * building ResultStatusCodeFormat element
                      */



                                   /**
                                     * because elements are not ordered we
should surf all the sibling to pick the right one
                                     */
                               for ( current_node = first_node; current_node
!= NULL;
                                             current_node =
axiom_node_get_next_sibling( current_node, env))
                               {
#####                                  current_element =
axiom_node_get_data_element( current_node, env);
                                  qname = axiom_element_get_qname(
current_element, env, current_node);
                                  element_qname = axutil_qname_create( env,
"ResultStatusCodeFormat", "http://www.axa.ca/message/1.0/types/message-types",
"ns5");
                                  if ( axutil_qname_equals( element_qname,
env, qname))
                                  {
                                       /** found the requried element */
                                       break;
                                  }
                               }

                           if ( current_node != NULL)
                           {

                                      text_value =
axiom_element_get_text(current_element, env, current_node );
                                      status =
adb_ResultStatusCodeFormat_set_ResultStatusCodeFormat(
_ResultStatusCodeFormat, env,

text_value);

                                 if( AXIS2_FAILURE ==  status)
                                 {
                                     AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"failed in setting the value for ResultStatusCodeFormat "
                                                         " %d :: %s",
env->error->error_number,

AXIS2_ERROR_GET_MESSAGE(env->error));
                                     return AXIS2_FAILURE;
                                 }
                           }

                               else
                               {
                                   /** this is not a nillable element*/
                                   AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"non nillable or minOuccrs != 0 element ResultStatusCodeFormat missing"
                                                         " %d :: %s",
env->error->error_number,

AXIS2_ERROR_GET_MESSAGE(env->error));
                                   return AXIS2_FAILURE;
                               }


          return status;
       }

        axiom_node_t* AXIS2_CALL
        adb_ResultStatusCodeFormat_serialize(
                adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
                const axutil_env_t *env, axiom_node_t* parent, int
has_parent)
        {

            axiom_namespace_t *ns1 = NULL;

                    axis2_char_t *text_value_1;

               axiom_node_t *current_node = NULL;
               axiom_element_t *current_element = NULL;
               axiom_data_source_t *data_source = NULL;
               axutil_stream_t *stream = NULL;
               axis2_char_t *start_input_str = NULL;
               axis2_char_t *end_input_str = NULL;
               unsigned int start_input_str_len = 0;
               unsigned int end_input_str_len = 0;

            AXIS2_ENV_CHECK(env, NULL);

            ns1 = axiom_namespace_create (env,
                                         "
http://www.axa.ca/message/1.0/types/message-types",
                                         "ns5");

                if(has_parent)
                {
                    data_source = axiom_node_get_data_element(parent, env);
                    if (!data_source)
                        return NULL;
                    stream = axiom_data_source_get_stream(data_source, env);
/* assume parent is of type data source */
                    if (!stream)
                        return NULL;
                    current_node = parent;
                }
                else
                {
                    data_source = axiom_data_source_create(env, parent,
&current_node);
                    stream = axiom_data_source_get_stream(data_source, env);
                }


                     /**
                      * parsing ResultStatusCodeFormat element
                      */




                        start_input_str = "<ns5:ResultStatusCodeFormat>";
                        start_input_str_len =
axutil_strlen(start_input_str);
                        end_input_str = "</ns5:ResultStatusCodeFormat>";
                        end_input_str_len = axutil_strlen(end_input_str);

                           text_value_1 =
_ResultStatusCodeFormat->attrib_ResultStatusCodeFormat;
                           axutil_stream_write(stream, env, start_input_str,
start_input_str_len);
                           axutil_stream_write(stream, env, text_value_1,
axutil_strlen(text_value_1));
                           axutil_stream_write(stream, env, end_input_str,
end_input_str_len);

            return parent;
        }



            /**
             * getter for ResultStatusCodeFormat.
             */
            axis2_char_t* AXIS2_CALL
            adb_ResultStatusCodeFormat_get_ResultStatusCodeFormat(
                    adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
                    const axutil_env_t *env)
             {
                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);

                return _ResultStatusCodeFormat->
attrib_ResultStatusCodeFormat;
             }

            /**
             * setter for ResultStatusCodeFormat
             */
            axis2_status_t AXIS2_CALL
            adb_ResultStatusCodeFormat_set_ResultStatusCodeFormat(
                    adb_ResultStatusCodeFormat_t* _ResultStatusCodeFormat,
                    const axutil_env_t *env,
                    axis2_char_t*  param_ResultStatusCodeFormat)
             {


                AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
                if(!_ResultStatusCodeFormat)
                {
                    return AXIS2_FAILURE;
                }


                  if( NULL == param_ResultStatusCodeFormat )
                  {
                      AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"ResultStatusCodeFormat is NULL, but not a nullable element"
                                                 " %d :: %s",
env->error->error_number,

AXIS2_ERROR_GET_MESSAGE(env->error));
                      return AXIS2_FAILURE;
                  }
                _ResultStatusCodeFormat-> attrib_ResultStatusCodeFormat =
param_ResultStatusCodeFormat;
                return AXIS2_SUCCESS;
             }





2008/3/11, Dimuthu Gamage <di...@gmail.com>:
>
> Hi Carl,
>
> If you can send us the relevant generated adb_ file it would be easy
> to track the problem.
>
> Thanks
> Dimuthu
>
>
> On Wed, Mar 12, 2008 at 12:42 AM, Carl Lefrançois
> <ca...@gmail.com> wrote:
> > Hi all,
> >
> > After much debugging I have found why an access violation is being
> caused in
> > my WSDL2C-generated code.
> >
> > While processing the following document: (http : // removed due to
> problems
> > with my emails being flagged as spam)
> >
> > <?xml version='1.0' encoding='UTF-8'?>
> > <soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/">
> >     <soapenv:Body>
> >          <BrokerInformationResponse
> > xmlns:xsi="www.w3.org/2001/XMLSchema-instance"
> >
> > xmlns="www.axa.ca/BrokerInformationService/1.0/BrokerInformationResponse
> "
> >              xmlns:xsd="www.w3.org/2001/XMLSchema"
> >             xmlns:soap="schemas.xmlsoap.org/soap/envelope/">
> >              <TrackingNumber>UNKNOWN</TrackingNumber>
> >             <Status>
> >                 <Status xmlns="">ERROR</Status>
> >                 <Detail xmlns="">
> >                      <Code>ERROR</Code>
> >                     <Description>Could not unbind Request from
> > XML!</Description>
> >                 </Detail>
> >             </Status>
> >         </BrokerInformationResponse>
> >      </soapenv:Body>
> > </soapenv:Envelope>
> >
> >
> > During construction of the node tree representing this document, an
> om_text
> > data element is created to hold the text "ERROR" in the first Status
> > element.  This om_text element is then assigned to the data_element
> member
> > of the axiom_node_t representing the first Status element on the
> following
> > line:
> >
> > (line 603 of axiom\src\om\om_text.c:)
> >     axiom_node_set_data_element((*node), env, om_text);
> >
> > The node_type element of this node is correctly set to 8 (AXIOM_TEXT).
> >
> > however during deserialization in the WSDL2C generated code, the same
> data
> > element is read into an axiom_element_t * defined as:
> >  axiom_element_t *current_element = NULL;
> >
> > in the following line:
> > current_element = axiom_node_get_data_element( current_node, env);
> >
> >
> > followed by a call which attempts to read the string value of
> > (axiom_element_t *)current_element->ns->prefix:
> >  qname = axiom_element_get_qname( current_element, env, current_node);
> >
> > which causes an access violation.
> >
> > I would like to help with debugging the WSDL2C tool but my time on this
> > project doesn't allow it at the moment.  If the information above isn't
> > detailed enough I'll gladly clarify so the problem can be fixed.
> >
> > Carl
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

Re: possible bug in WSDL2C-generated code

Posted by Dimuthu Gamage <di...@gmail.com>.
For the above reason we have been putting following whenever the
get_qname is called,

                                    while(current_node &amp;&amp;
axiom_node_get_node_type(current_node, env) != AXIOM_ELEMENT)
                                    {
                                        current_node =
axiom_node_get_next_sibling(current_node, env);
                                    }
                                    if(current_node != NULL)
                                    {
                                        current_element =
(axiom_element_t *)axiom_node_get_data_element(current_node, env);
                                        qname =
axiom_element_get_qname(current_element, env, current_node);
                                    }

You post give impression that there are paths that we have not tracked
and tested. So it would be helpful if you can send the WSDL too,


Thanks
Dimuthu


On Wed, Mar 12, 2008 at 8:15 AM, Dimuthu Gamage <di...@gmail.com> wrote:
> Hi Carl,
>
>  If you can send us the relevant generated adb_ file it would be easy
>  to track the problem.
>
>  Thanks
>  Dimuthu
>
>
>
>  On Wed, Mar 12, 2008 at 12:42 AM, Carl Lefrançois
>  <ca...@gmail.com> wrote:
>  > Hi all,
>  >
>  > After much debugging I have found why an access violation is being caused in
>  > my WSDL2C-generated code.
>  >
>  > While processing the following document: (http : // removed due to problems
>  > with my emails being flagged as spam)
>  >
>  > <?xml version='1.0' encoding='UTF-8'?>
>  > <soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/">
>  >     <soapenv:Body>
>  >          <BrokerInformationResponse
>  > xmlns:xsi="www.w3.org/2001/XMLSchema-instance"
>  >
>  > xmlns="www.axa.ca/BrokerInformationService/1.0/BrokerInformationResponse"
>  >              xmlns:xsd="www.w3.org/2001/XMLSchema"
>  >             xmlns:soap="schemas.xmlsoap.org/soap/envelope/">
>  >              <TrackingNumber>UNKNOWN</TrackingNumber>
>  >             <Status>
>  >                 <Status xmlns="">ERROR</Status>
>  >                 <Detail xmlns="">
>  >                      <Code>ERROR</Code>
>  >                     <Description>Could not unbind Request from
>  > XML!</Description>
>  >                 </Detail>
>  >             </Status>
>  >         </BrokerInformationResponse>
>  >      </soapenv:Body>
>  > </soapenv:Envelope>
>  >
>  >
>  > During construction of the node tree representing this document, an om_text
>  > data element is created to hold the text "ERROR" in the first Status
>  > element.  This om_text element is then assigned to the data_element member
>  > of the axiom_node_t representing the first Status element on the following
>  > line:
>  >
>  > (line 603 of axiom\src\om\om_text.c:)
>  >     axiom_node_set_data_element((*node), env, om_text);
>  >
>  > The node_type element of this node is correctly set to 8 (AXIOM_TEXT).
>  >
>  > however during deserialization in the WSDL2C generated code, the same data
>  > element is read into an axiom_element_t * defined as:
>  >  axiom_element_t *current_element = NULL;
>  >
>  > in the following line:
>  > current_element = axiom_node_get_data_element( current_node, env);
>  >
>  >
>  > followed by a call which attempts to read the string value of
>  > (axiom_element_t *)current_element->ns->prefix:
>  >  qname = axiom_element_get_qname( current_element, env, current_node);
>  >
>  > which causes an access violation.
>  >
>  > I would like to help with debugging the WSDL2C tool but my time on this
>  > project doesn't allow it at the moment.  If the information above isn't
>  > detailed enough I'll gladly clarify so the problem can be fixed.
>  >
>  > Carl
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: possible bug in WSDL2C-generated code

Posted by Dimuthu Gamage <di...@gmail.com>.
Hi Carl,

If you can send us the relevant generated adb_ file it would be easy
to track the problem.

Thanks
Dimuthu

On Wed, Mar 12, 2008 at 12:42 AM, Carl Lefrançois
<ca...@gmail.com> wrote:
> Hi all,
>
> After much debugging I have found why an access violation is being caused in
> my WSDL2C-generated code.
>
> While processing the following document: (http : // removed due to problems
> with my emails being flagged as spam)
>
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/">
>     <soapenv:Body>
>          <BrokerInformationResponse
> xmlns:xsi="www.w3.org/2001/XMLSchema-instance"
>
> xmlns="www.axa.ca/BrokerInformationService/1.0/BrokerInformationResponse"
>              xmlns:xsd="www.w3.org/2001/XMLSchema"
>             xmlns:soap="schemas.xmlsoap.org/soap/envelope/">
>              <TrackingNumber>UNKNOWN</TrackingNumber>
>             <Status>
>                 <Status xmlns="">ERROR</Status>
>                 <Detail xmlns="">
>                      <Code>ERROR</Code>
>                     <Description>Could not unbind Request from
> XML!</Description>
>                 </Detail>
>             </Status>
>         </BrokerInformationResponse>
>      </soapenv:Body>
> </soapenv:Envelope>
>
>
> During construction of the node tree representing this document, an om_text
> data element is created to hold the text "ERROR" in the first Status
> element.  This om_text element is then assigned to the data_element member
> of the axiom_node_t representing the first Status element on the following
> line:
>
> (line 603 of axiom\src\om\om_text.c:)
>     axiom_node_set_data_element((*node), env, om_text);
>
> The node_type element of this node is correctly set to 8 (AXIOM_TEXT).
>
> however during deserialization in the WSDL2C generated code, the same data
> element is read into an axiom_element_t * defined as:
>  axiom_element_t *current_element = NULL;
>
> in the following line:
> current_element = axiom_node_get_data_element( current_node, env);
>
>
> followed by a call which attempts to read the string value of
> (axiom_element_t *)current_element->ns->prefix:
>  qname = axiom_element_get_qname( current_element, env, current_node);
>
> which causes an access violation.
>
> I would like to help with debugging the WSDL2C tool but my time on this
> project doesn't allow it at the moment.  If the information above isn't
> detailed enough I'll gladly clarify so the problem can be fixed.
>
> Carl
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org