You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Bill Mitchell (JIRA)" <ji...@apache.org> on 2008/02/15 14:42:08 UTC

[jira] Created: (AXIS2C-987) Generated adb stubs do not support attributes with namespaces

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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Commented: (AXIS2C-987) Generated adb stubs do not support attributes with namespaces

Posted by "Senaka Fernando (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2C-987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12575794#action_12575794 ] 

Senaka Fernando commented on AXIS2C-987:
----------------------------------------

Devs,

This seems to be an easy fix. Thoughts?

Regards,
Senaka

> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Resolved: (AXIS2C-987) Generated adb stubs do not support attributes with namespaces

Posted by "Dimuthu Gamage (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-987?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dimuthu Gamage resolved AXIS2C-987.
-----------------------------------

    Resolution: Fixed

Already Fixed

> 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
>         Attachments: case36_qualified_ns.zip
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Updated: (AXIS2C-987) Generated adb stubs do not support attributes with namespaces

Posted by "Senaka Fernando (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-987?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Senaka Fernando updated AXIS2C-987:
-----------------------------------

    Comment: was deleted

> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Commented: (AXIS2C-987) Generated adb stubs do not support attributes with namespaces

Posted by "Dimuthu Gamage (JIRA)" <ji...@apache.org>.
    [ 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, &amp;key, NULL, &amp;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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Updated: (AXIS2C-987) Generated adb stubs do not support attributes with namespaces

Posted by "Dimuthu Gamage (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-987?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dimuthu Gamage updated AXIS2C-987:
----------------------------------

    Attachment: case36_qualified_ns.zip

Here is an attached test case where there are namespace qualified attributes

> 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
>         Attachments: case36_qualified_ns.zip
>
>
> 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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org