Generated adb stubs do not support attributes with namespaces
-------------------------------------------------------------

                 Key: AXIS2C-987
                 URL: https://issues.apache.org/jira/browse/AXIS2C-987
             Project: Axis2-C
          Issue Type: Bug
          Components: code generation
    Affects Versions: 1.2.0
         Environment: Windows XP, Visual Studio 2005, guththila, libcurl
            Reporter: Bill Mitchell


For the attributes defined in the wsdl, the generated stub classes require that 
the namespace prefix be omitted from the attribute.  If a prefix is attached to 
the attribute, the generated stub fails to find the attribute.

For example, the following is the code that looks for a "handle" attribute:
                  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(!strcmp((axis2_char_t*)key, "handle"))
                             
                               {
                                   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 "handle", 
this happnes when name is in default namespace */
                    attrib_text = 
axiom_element_get_attribute_value_by_name(parent_element, env, "handle");
                  }

The strcmp compares the attribute key against the string "handle", but the 
attribute key is the qname string from the attribute.  

Obviously the robust fix is to ensure the attribute localname matches, and that 
the namespace uri matches if present. 

The quick fix is to replace the strcmp with something like:
                               
if(!strcmp(axiom_attribute_get_localname((axiom_attribute_t *)val, env), 
"handle"))

I suspect this quick fix is not the longterm fix, as it accepts an attribute 
with a different uri than that expected.  It appears to me that the non-uri 
case is handled later in the code by the 
axiom_element_get_attribute_value_by_name call.  The hash search loop was 
probably intended to compare against the attribute qname, but the qname logic 
was may have been removed temporarily or not fully implemented to solve other 
issues with the default namespace or multiple namespaces in the wsdl.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to