You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/07/09 19:07:26 UTC

cvs commit: ws-axis/java/src/org/apache/axis/encoding SerializationContext.java

dims        2005/07/09 10:07:26

  Modified:    java/src/org/apache/axis/encoding/ser BeanDeserializer.java
               java/src/org/apache/axis/encoding SerializationContext.java
  Log:
  Fix for AXIS-1752 - xs:list attributes do not serialize
  Fix for AXIS-1762 - xs:list attributes do not deserialize
  
  from Steve Green
  
  Revision  Changes    Path
  1.78      +13 -0     ws-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java
  
  Index: BeanDeserializer.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- BeanDeserializer.java	9 Jun 2005 05:08:39 -0000	1.77
  +++ BeanDeserializer.java	9 Jul 2005 17:07:26 -0000	1.78
  @@ -430,7 +430,20 @@
                                                       context);
                   if (dSer == null) {
                       dSer = context.getDeserializerForClass(bpd.getType());
  +
  +                    // The java type is an array, but the context didn't
  +                    // know that we are an attribute.  Better stick with
  +                    // simple types..
  +                    if (dSer instanceof ArrayDeserializer)
  +                    {
  +                        SimpleListDeserializerFactory factory =
  +                            new SimpleListDeserializerFactory(bpd.getType(),
  +                                    fieldDesc.getXmlType());
  +                        dSer = (Deserializer)
  +                            factory.getDeserializerAs(dSer.getMechanismType());
  +                    }
                   }
  +
                   if (dSer == null)
                       throw new SAXException(
                               Messages.getMessage("unregistered00",
  
  
  
  1.110     +17 -6     ws-axis/java/src/org/apache/axis/encoding/SerializationContext.java
  
  Index: SerializationContext.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/SerializationContext.java,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- SerializationContext.java	10 Jun 2005 03:04:52 -0000	1.109
  +++ SerializationContext.java	9 Jul 2005 17:07:26 -0000	1.110
  @@ -18,8 +18,6 @@
   
   import java.io.IOException;
   import java.io.Writer;
  -import java.lang.IllegalAccessException;
  -import java.lang.NoSuchMethodException;
   import java.lang.reflect.InvocationTargetException;
   import java.lang.reflect.Method;
   import java.util.ArrayList;
  @@ -33,30 +31,33 @@
   import javax.xml.namespace.QName;
   import javax.xml.rpc.JAXRPCException;
   import javax.xml.rpc.holders.QNameHolder;
  +
   import org.apache.axis.AxisEngine;
  +import org.apache.axis.AxisProperties;
   import org.apache.axis.Constants;
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
  -import org.apache.axis.AxisProperties;
   import org.apache.axis.attachments.Attachments;
   import org.apache.axis.client.Call;
  -import org.apache.axis.components.logger.LogFactory;
   import org.apache.axis.components.encoding.XMLEncoder;
   import org.apache.axis.components.encoding.XMLEncoderFactory;
  +import org.apache.axis.components.logger.LogFactory;
  +import org.apache.axis.constants.Use;
   import org.apache.axis.description.OperationDesc;
   import org.apache.axis.description.TypeDesc;
  +import org.apache.axis.encoding.ser.ArraySerializer;
   import org.apache.axis.encoding.ser.BaseSerializerFactory;
  -import org.apache.axis.constants.Use;
  +import org.apache.axis.encoding.ser.SimpleListSerializerFactory;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.schema.SchemaVersion;
   import org.apache.axis.soap.SOAPConstants;
   import org.apache.axis.types.HexBinary;
   import org.apache.axis.utils.IDKey;
  +import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.Mapping;
   import org.apache.axis.utils.Messages;
   import org.apache.axis.utils.NSStack;
   import org.apache.axis.utils.XMLUtils;
  -import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.cache.MethodCache;
   import org.apache.axis.wsdl.symbolTable.SchemaUtils;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
  @@ -1562,6 +1563,16 @@
       public String getValueAsString(Object value, QName xmlType) throws IOException {
           Class cls = value.getClass();
           Serializer ser = getSerializer(cls, xmlType, null);
  +        
  +        // The java type is an array, but we need a simple type.
  +        if (ser instanceof ArraySerializer)
  +        {
  +            SimpleListSerializerFactory factory =
  +                new SimpleListSerializerFactory(cls, xmlType);
  +            ser = (Serializer)
  +                factory.getSerializerAs(getEncodingStyle());
  +        }
  +
           if (!(ser instanceof SimpleValueSerializer)) {
               throw new IOException(
                       Messages.getMessage("needSimpleValueSer",