axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carl Lefran├žois" <carl.lefranc...@gmail.com>
Subject Re: possible bug in WSDL2C-generated code
Date Wed, 12 Mar 2008 13:29:03 GMT
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 <dimuthuc@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
> <carl.lefrancois@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
>
>

Mime
View raw message