Derived classes are not being serialized properly in a request
--------------------------------------------------------------

         Key: AXIS-2494
         URL: http://issues.apache.org/jira/browse/AXIS-2494
     Project: Apache Axis
        Type: Bug

  Components: Serialization/Deserialization  
    Versions: 1.3    
 Environment: Windows 2000 Server
    Reporter: Pat Malay


When a method parameter has an attribute which is derived from the original 
type axis serializes the attribute as original type.

Ex:  methodA( MyParam param)

public class MyParam {
   public MyObject myObj;
}

public class MyObject {
   public int myInt;
}

public class MyDerivedObject{
   public int myInt2;
}

code...

MyParam param1 = new MyParam();
param1.myObj = new MyDerivedObject();
methodA(param1)

this serializes the MyParam.myObj as MyObject and not as MyDerivedObject.

I think the problem is in the 

method of

org.apache.axis.encoding.SerializationContext

    private Class getActualJavaClass(QName xmlType, Class javaType, Object obj) 
{
        Class cls = obj.getClass();
        
        if ((xmlType != null 
                    && Constants.isSchemaXSD(xmlType.getNamespaceURI()) && 
"anyType".equals(xmlType.getLocalPart()))
                || (javaType != null 
                        && (javaType.isArray() || javaType == Object.class))) {
            return cls;
        }
        
        if (javaType != null && cls != javaType && !cls.isArray()) {
            return javaType;
        }
        
        return cls;
    }

It doesn't check if obj extends javaType or xmlType.localPart



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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

Reply via email to