gdaniels    02/03/20 07:53:44

  Modified:    java/src/org/apache/axis/description TypeDesc.java
               java/src/org/apache/axis/encoding/ser BeanDeserializer.java
  Log:
  If we're SOAP-encoded and dealing with unprefixed elements, ignore
  the namespace when matching XML name against metadata.
  
  Revision  Changes    Path
  1.6       +12 -3     xml-axis/java/src/org/apache/axis/description/TypeDesc.java
  
  Index: TypeDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/TypeDesc.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TypeDesc.java     9 Mar 2002 19:29:49 -0000       1.5
  +++ TypeDesc.java     20 Mar 2002 15:53:44 -0000      1.6
  @@ -187,16 +187,25 @@
       /**
        * Get the field name associated with this QName, but only if it's
        * marked as an element.
  +     * 
  +     * If the "ignoreNS" argument is true, just compare localNames.
        */
  -    public String getFieldNameForElement(QName qname)
  +    public String getFieldNameForElement(QName qname, boolean ignoreNS)
       {
           if (fields == null)
               return null;
   
           for (int i = 0; i < fields.length; i++) {
               FieldDesc field = fields[i];
  -            if (field.isElement() && qname.equals(field.getXmlName()))
  -                return field.getFieldName();
  +            if (field.isElement()) {
  +                QName xmlName = field.getXmlName();
  +                if (qname.getLocalPart().equals(xmlName.getLocalPart())) {
  +                    if (ignoreNS || qname.getNamespaceURI().
  +                                        equals(xmlName.getNamespaceURI())) {
  +                        return field.getFieldName();
  +                    }
  +                }
  +            }
           }
   
           return null;
  
  
  
  1.15      +11 -2     
xml-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java
  
  Index: BeanDeserializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- BeanDeserializer.java     20 Mar 2002 13:44:57 -0000      1.14
  +++ BeanDeserializer.java     20 Mar 2002 15:53:44 -0000      1.15
  @@ -155,13 +155,22 @@
           
           if (typeDesc != null) {
               QName elemQName = new QName(namespace, localName);
  -            String fieldName = typeDesc.getFieldNameForElement(elemQName);
  +            
  +            // IF we're SOAP-encoded AND this is an unprefixed element,
  +            // ignore the actual namespace context for the element, and
  +            // just compare local names.
  +            boolean ignoreNS = ((prefix == null || prefix.equals("")) && 
  +                                context.getMessageContext().isEncoded());
  +            
  +            String fieldName = typeDesc.getFieldNameForElement(elemQName, 
  +                                                               ignoreNS);
  +            
               propDesc = (BeanPropertyDescriptor)propertyMap.get(fieldName);
           }
   
           if (propDesc == null) {
               // look for a field by this name.
  -            propDesc = (BeanPropertyDescriptor) 
propertyMap.get(JavaUtils.xmlNameToJava(localName));
  +            propDesc = (BeanPropertyDescriptor) propertyMap.get(localName);
           }
           if (propDesc == null) {
               // No such field
  
  
  


Reply via email to