Hi Dimuthu,

I did try adding those lines to the deserialize function but had the same 
result. As part of the debugging process I downloaded the nightly snapshot 
dated 2008/07/07.  It is possible there has been a fix since then.

I'm not convinced this is a real bug, but I still can't explain what mistake I 
made to get this behaviour.  If no one else is having this problem then it must 
be me :)

Anyway it works with this patch.  The WSDL on the server stays the same and my 
local WSDL used to generate the stubs can have this modification.  Thanks for 
your suggestions.


Carl
-----Message d'origine-----
De : Dimuthu Gamage [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi, juillet 17, 2008 10:46
À : Apache AXIS C User List
Objet : Re: RE : RE : RE : WSDL2C deserialisation problem


Hi Carl,
Again I tried without any elements in the parent type, i.e. only with an 
attribute as in your case. But it was generating correct code and give the 
correct result at running. May be some modification in the latest svn may have 
correct the problem. (i believe some correction done after axis2/java 1.4 
release).

So from your note I saw it works when 

                                  current_node = first_node;
                                  is_early_node_valid = AXIS2_FALSE;

is at the start. I think you can just add these lines in the deserialize 
funciton without changing the wsdl. (you may able to debug the logic removing 
the code that handle your fake element from the deserialize logic.

Thanks
Dimuthu


On Wed, Jul 16, 2008 at 8:43 PM, Lefrancois, Carl <[EMAIL PROTECTED]> wrote:

Hi Dimuthu,

More information on this interesting problem...

I decided to start by modifying the definition of my schema to try and get 
around the current_node initialisation problem.  I changed the definition of 
the base type to this:

   <xs:complexType name="ActivityType">
       <xs:sequence>
           <xs:element name="deser_test" type="xs:int" minOccurs="0"/>
       </xs:sequence>
       <xs:attribute ref="addDataTypes:ObjectIdentifier" use="optional"/>
   </xs:complexType>

I ignore the deser_test element and my source document never contains it, but 
the new generated code for deserialisation contains this:


                    /*
                     * building deser_test element
                     */



                                  current_node = first_node;
                                  is_early_node_valid = AXIS2_FALSE;


And now my ActivityNumber element is correctly deserialised.

Is there anything more I can do to help debug this behaviour?

-Carl



-----Message d'origine-----
De : Lefrancois, Carl
Envoyé : mardi, juillet 8, 2008 11:23
À : Apache AXIS C User List
Objet : RE : RE : WSDL2C deserialisation problem


Hi Dimuthu,

the parent type is
   <xs:complexType name="ActivityType">
       <xs:attribute ref="addDataTypes:ObjectIdentifier" use="optional"/>
   </xs:complexType>

Please let me know if there is anything else I can send you to help figure this 
out.

I already tried setting

                                  current_node = first_node;

as described in my last response.  I will try with the

                                  is_early_node_valid = AXIS2_FALSE; and see if 
it helps.


Carl




-----Message d'origine-----
De : Dimuthu Gamage [mailto:[EMAIL PROTECTED]
Envoyé : lundi, juillet 7, 2008 21:17
À : Apache AXIS C User List
Objet : Re: RE : WSDL2C deserialisation problem


Hi Carl,
I have a test case with the following schema and it works fine

           <xs:complexType name="DiagonalMatrix">
               <xs:complexContent>
                   <xs:extension base="ax21:Matrix">
                       <xs:sequence>
                           <xs:element name="somejunk" minOccurs="0"  
type="xs:int"/>
                           <xs:element name="diagonal" nillable="true" 
type="ax21:MatrixRow"/>
                           <xs:element name="anotherjunk" minOccurs="0"  
type="xs:int"/>
                       </xs:sequence>
                       <xs:attribute name="diagonalSum" type="xs:int"/>
                   </xs:extension>
               </xs:complexContent>
           </xs:complexType>
           <xs:complexType name="Matrix">
               <xs:sequence>
                   <xs:element minOccurs="0" maxOccurs="unbounded" name="rows" 
nillable="true" type="ax21:MatrixRow"/> <!-- i removed maxOcccurs="unbounded" 
part and checked, it woring too -->
               </xs:sequence>
               <xs:attribute name="rowCount" type="xs:int"/>
           </xs:complexType>
           <xs:complexType name="MatrixRow">
               <xs:sequence>
                   <xs:element maxOccurs="unbounded" minOccurs="0" 
name="columns" nillable="true" type="xs:int"/>
               </xs:sequence>
               <xs:attribute name="columnCount" type="xs:int"/>
           </xs:complexType>

I think this is exactly simmilar to your schema (it has elements and an 
attribute), may be the parent type is the different.  Just check whether there 
is special different in 'ActivityType' in your schema with the Matrix type 
here. It s better if you can send that as well.

And normally at the stat of the deserialize, we see the following code segment 
code together, you may give a try with it too.

                                  current_node = first_node;
                                  is_early_node_valid = AXIS2_FALSE;

Thanks
Dimuthu


On Tue, Jul 8, 2008 at 2:19 AM, Lefrancois, Carl <[EMAIL PROTECTED]> wrote:


Hi Dimuthu

Thanks for the quick response.  The schema piece that defines the commercial 
activity type is

  <xs:complexType name="CommercialActivityType">
      <xs:complexContent>
          <xs:extension base="ActivityType">
              <xs:sequence>
                  <xs:element name="ActivityNumber" 
type="CommercialActivityNumberFormat" minOccurs="0"/>
                  <xs:element name="RiskPoint" 
type="addDataTypes:CodeValueType" minOccurs="0"/>
                  <xs:element name="DefaultOccupancyPercentage" 
type="addDataTypes:PercentageType" minOccurs="0"/>
                  <xs:element name="RejectingActivity" 
type="addDataTypes:BooleanType" minOccurs="0"/>
                  <xs:element name="LinguisticDescription" 
type="addDataTypes:LinguisticDescriptionType" minOccurs="0" 
maxOccurs="unbounded"/>
              </xs:sequence>
              <xs:attribute name="Id" type="addDataTypes:IDFormat" 
use="optional"/>
          </xs:extension>
      </xs:complexContent>
  </xs:complexType>


I tried setting current_node = first_node; just after first_node = 
axiom_node_get_first_child(parent, env);  however, the call to current_node = 
axiom_node_get_next_sibling(current_node, env);  set current_node to NULL.

Here is a piece of the XML that I am trying to deserialise:

              <LiabilityActivities xmlns="">
                  <RelatedActivity>
                      <ActivityNumber>503200</ActivityNumber>
                  </RelatedActivity>

So I know the value is there.


Carl



-----Message d'origine-----
De : Dimuthu Gamage [mailto:[EMAIL PROTECTED]
Envoyé : lundi, juillet 7, 2008 14:41
À : Apache AXIS C User List
Objet : Re: WSDL2C deserialisation problem



Hi Carl,
My guess is this has missed the statement current_node = first_node; but it is 
just a guess. If you can send us the schema part which correspond to 
adb_CommercialActivityType we can find the error in the logic more easily and 
find exactly what current_node is.

Thanks
Dimuthu


On Mon, Jul 7, 2008 at 9:39 PM, Lefrancois, Carl <[EMAIL PROTECTED]> wrote:

Hello List,

While deserialising my document, I have the following behaviour:

current_node is initialised to NULL
An if statement checks current_node to make sure it is not null before 
deserialising a sub-element. The sub-element can never be created during 
deserialisation.

This is the first ADB object that gives me this problem.  I looked at the other 
files and they have a line like this:

current_node = first_node;

Somewhere before the if statement that checks current_node for NULL. However in 
the other files this line comes when deserialising another type of sub-element. 
 This may be a bug in WSDL2C logic.




Below is a piece of the deserialise function for this element and the important 
lines have ####### in front

Because current node stays null, no qname is set on the line marked @@@@@@@.

Then the if statement marked &&&&&&& does not enter and finally the sub-element 
can not get deserialised on the line marked %%%%%%%%%.

This code was generated with the latest snapshot downloaded just before sending 
this mail

Does anyone have an idea how to set the current_node properly for this element 
to deserialise?





     axis2_status_t AXIS2_CALL
     adb_CommercialActivityType_deserialize(
             adb_CommercialActivityType_t* _CommercialActivityType,
             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;

           axiom_attribute_t *parent_attri = NULL;
           axiom_element_t *parent_element = NULL;
           axis2_char_t *attrib_text = NULL;

           axutil_hash_t *attribute_hash = NULL;


           void *element = NULL;

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

            int i = 0;
            axutil_array_list_t *arr_list = NULL;

            int sequence_broken = 0;
            axiom_node_t *tmp_node = 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, _CommercialActivityType, 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 
CommercialActivityType : "
                         "NULL elemenet can not be passed to deserialize");
             return AXIS2_FAILURE;
           }


                   first_node = axiom_node_get_first_child(parent,
env);


              parent_element = (axiom_element_t 
*)axiom_node_get_data_element(parent, env);
              attribute_hash = axiom_element_get_all_attributes(parent_element, 
env);



               parent_attri = NULL;
               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,
"ObjectIdentifier|http://www.axa.ca/add/types/data-types";))

                            {
                                parent_attri = (axiom_attribute_t*)val;
                                break;
                            }
                    }
               }

               if(parent_attri)
               {
                 attrib_text = axiom_attribute_get_value(parent_attri, env);
               }
               else
               {
                 /* this is hoping that attribute is stored in 
"ObjectIdentifier", this happnes when name is in default namespace */
                 attrib_text = 
axiom_element_get_attribute_value_by_name(parent_element, env, 
"ObjectIdentifier");
               }

               if(attrib_text != NULL)
               {


                         element = (void*)adb_ObjectIDFormat_create(env);

adb_ObjectIDFormat_deserialize_from_string((adb_ObjectIDFormat_t*)elemen
t, env, attrib_text, parent);

adb_CommercialActivityType_set_ObjectIdentifier(_CommercialActivityType,
                                                       env, 
(adb_ObjectIDFormat_t*)element);

                 }

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



                  /*
                   * building ActivityNumber 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, 
"ActivityNumber", NULL, NULL);


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


                                   element = 
(void*)adb_CommercialActivityNumberFormat_create(env);

%%%%%%%%%                             status =
adb_CommercialActivityNumberFormat_deserialize((adb_CommercialActivityNu
mberFormat_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 ActivityNumber");
                                   }
                                   else
                                   {
                                       status = 
adb_CommercialActivityType_set_ActivityNumber(_CommercialActivityType,
env,

(adb_CommercialActivityNumberFormat_t*)element);
                                   }

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

axutil_qname_free(element_qname, env);
                                  }
                                  return AXIS2_FAILURE;
                              }
                           }







Carl Lefrançois
Analyst / Programmeur
consultant Larochelle Groupe Conseil
pour AXA Canada Tech

Tél. :      514-282-6817, poste 4548
Couriel : [EMAIL PROTECTED]
 _____

"Ce message est confidentiel, à l'usage exclusif du destinataire ci-dessus et 
son contenu ne représente en aucun cas un engagement de la part de AXA, sauf en 
cas de stipulation expresse et par écrit de la part de AXA. Toute publication, 
utilisation ou diffusion, même partielle, doit être autorisée préalablement. Si 
vous n'êtes pas destinataire de ce message, merci d'en avertir immédiatement 
l'expéditeur."

"This e-mail message is confidential, for the exclusive use of the addressee 
and its contents shall not constitute a commitment by AXA, except as otherwise 
specifically provided in writing by AXA. Any unauthorized disclosure, use or 
dissemination, either whole or partial, is prohibited. If you are not the 
intended recipient of the message, please notify the sender immediately."

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to