[ 
https://issues.apache.org/jira/browse/AXIS2C-987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12584248#action_12584248
 ] 

Dimuthu Gamage commented on AXIS2C-987:
---------------------------------------

Hi Bill,

I think currently the codegen generated code is right. when I took a look at 
the template it is like this, 

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

                           <xsl:choose>
                             <xsl:when test="@nsuri and @nsuri != ''">
                               if(strstr((axis2_char_t*)key, "<xsl:value-of 
select="$propertyName"/>|<xsl:value-of select="@nsuri"/>"))
                             </xsl:when>
                             <xsl:otherwise>
                               if(!strcmp((axis2_char_t*)key, "<xsl:value-of 
select="$propertyName"/>"))
                             </xsl:otherwise>
                           </xsl:choose>
                               {
                                   parent_attri = (axiom_attribute_t*)val;
                                   break;
                               }
                       }

Which mean whenever the attribute key is namespace qualified it will compare 
with the "propertyName|uri".

 I think what happen in your case is the "handle" is not associated with a 
namespace. Note that in the template it generates the full comparison only if 
the namespace uri exists. 

If it is not the case, there should be error in parsing your attributes in the 
WSDL which have to be corrected in the Java codegen engine level or even xml 
schema level . So please try again and report your result.

Thanks
Dimuthu

> 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