VetorDeserializer cannot deserialize Beans inside of a Vector
-------------------------------------------------------------

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

  Components: Serialization/Deserialization  
    Versions: 1.4    
 Environment: Win XP SP2, Tomcat 5.5.15, Axis1.4
    Reporter: Steffen Heinzl


The VectorDeserializer is only able to deserialize primitive Types and Strings 
(and perhaps a few other types). The VectorSerializer should add the namespcae 
of the object
to be serialized to the SOAP message.

The following patch provides bean support for VectorSerializer and 
-Deserializer. Instead of <item xmlns="">, the namespace of the object (if 
registered as  typeMapping) to be serialized is used.


Index: VectorDeserializer.java
===================================================================
RCS file: 
/Volumes/data/cvs/heinzl/PatchTest/src/org/apache/axis/encoding/ser/VectorDeserializer.java,v
retrieving revision 1.1
diff -u -r1.1 VectorDeserializer.java
--- VectorDeserializer.java     31 May 2006 09:23:33 -0000      1.1
+++ VectorDeserializer.java     31 May 2006 09:38:27 -0000
@@ -110,11 +110,18 @@
         QName itemType = context.getTypeFromAttributes(namespace,
                                                        localName,
                                                        attributes);
+                                                       
         // Get the deserializer
         Deserializer dSer = null;
         if (itemType != null) {
            dSer = context.getDeserializerForType(itemType);
         }
+
+        if (itemType == null && namespace != null && localName != null)
+        {
+               dSer = context.getDeserializerForType(new QName(namespace, 
localName));
+        }
+        
         if (dSer == null) {
             dSer = new DeserializerImpl();
         }
Index: VectorSerializer.java
===================================================================
RCS file: 
/Volumes/data/cvs/heinzl/PatchTest/src/org/apache/axis/encoding/ser/VectorSerializer.java,v
retrieving revision 1.1
diff -u -r1.1 VectorSerializer.java
--- VectorSerializer.java       31 May 2006 09:23:33 -0000      1.1
+++ VectorSerializer.java       31 May 2006 09:38:27 -0000
@@ -32,6 +32,8 @@
 import java.util.Iterator;
 import java.util.Vector;
 
+import org.apache.axis.encoding.TypeMapping;
+
 /**
  * A <code>VectorSerializer</code> is be used to serialize and
  * deserialize Vectors using the <code>SOAP-ENC</code>
@@ -71,12 +73,21 @@
         if(isRecursive(new IdentityHashMap(), vector)){
             throw new IOException(Messages.getMessage("badVector00"));
         }
-        
+
+        TypeMapping tm = context.getTypeMapping();
         context.startElement(name, attributes);
         for (Iterator i = vector.iterator(); i.hasNext(); )
         {
             Object item = i.next();
-            context.serialize(Constants.QNAME_LITERAL_ITEM,  null, item);
+            QName elemQName = tm.getTypeQName(item.getClass());
+            if (elemQName != null)
+            {
+                         context.serialize(elemQName,  null, item);
+                       }
+            else
+            {
+               context.serialize(Constants.QNAME_LITERAL_ITEM,  null, item);
+            }
         }
         context.endElement();
     }





-- 
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