axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/test/encoding TestDeser.java
Date Mon, 09 Jul 2001 21:32:08 GMT
gdaniels    01/07/09 14:32:06

  Modified:    java/src/org/apache/axis/encoding ArraySerializer.java
                        BeanSerializer.java DeserializerBase.java
                        SOAPTypeMappingRegistry.java
                        TypeMappingRegistry.java
               java/src/org/apache/axis/message MessageElement.java
               java/src/org/apache/axis/providers/java RPCProvider.java
               java/src/org/apache/axis/server server-config.xml
               java/src/org/apache/axis/transport/local LocalSender.java
               java/test/encoding TestDeser.java
  Added:       java/src/org/apache/axis/transport/local LocalResponder.java
  Log:
  Fix some serialization stuff:
  
  * Using the Local transport was re-serializing the message into String form
    in the context of the *client*, not the server.  We deal with this by adding
    a default local transport output chain on the server (the LocalResponder)
    which simply sets the message to string form, exercising the serializers
    while still in server-land.
  
  * The ArraySerializer now produces Vectors by default instead of Arrays.
    This is a way to make life a little easier when we're needing to convert
    general array types into specific ones.  For instance, if we get a SOAP
    array with arrayType="xsd:anyType", and the argument this parameter maps
    to is an Integer[], we can just use the List.toArray(Integer[]) method
    to let Java do the conversion (or throw an Exception) for us.  The
    TestDeser unit test was changed to reflect the new behavior.
  
  * The RPCProvider.convert() method is now static and public, so that the
    BeanSerializer (or whoever) can get to it.  This should probably move
    to a utility class.
  
  * Cleaned up the CallbackTarget in DeserializerBase - it now acts like a
    regular Target, thus obliviating the need for a separate callbacks
    Vector.
  
  * Support all the SOAP-ENC:<Type> element names.
  
  Revision  Changes    Path
  1.9       +16 -4     xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java
  
  Index: ArraySerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ArraySerializer.java	2001/07/08 14:18:36	1.8
  +++ ArraySerializer.java	2001/07/09 21:31:20	1.9
  @@ -63,6 +63,7 @@
   import java.lang.reflect.Array;
   import java.io.IOException;
   import java.util.List;
  +import java.util.Vector;
   import java.util.Hashtable;
   
   /** An ArraySerializer handles serializing and deserializing SOAP
  @@ -159,10 +160,15 @@
                       throw new SAXException("No component type for " + arrayItemType);
                   
                   // Replace wrapper classes with primitive equivalents
  +                /*
                   Object primitive = primitives.get(componentType);
                   if (primitive != null) componentType = (Class) primitive;
   
                   value = Array.newInstance(componentType, length);
  +                */
  +                
  +                value = new Vector(length);
  +                ((Vector)value).setSize(length);
   
               }
               catch (NumberFormatException e)
  @@ -180,14 +186,17 @@
       {
           // !!! Check position attribute, type attribute....
           QName itemType = context.getTypeFromAttributes(attributes);
  -        
  +        /*
           if (itemType != null) {
               if (!arrayItemType.equals(itemType))
                   throw new SAXException("Item type (" + itemType + ") didn't match ArrayType
(" +
  -                                        itemType + ")");
  +                                        arrayItemType + ")");
           }
  +        */
  +        if (itemType == null)
  +          itemType = arrayItemType;
           
  -        DeserializerBase dSer = context.getDeserializer(arrayItemType);
  +        DeserializerBase dSer = context.getDeserializer(itemType);
           dSer.registerCallback(this, new Integer(curIndex++));
           context.pushElementHandler(dSer);
       }
  @@ -199,7 +208,10 @@
       
       public void valueReady(Object value, Object hint)
       {
  +      /*
           Array.set(this.value, ((Integer)hint).intValue(), value);
  +      */
  +      ((Vector)this.value).set(((Integer)hint).intValue(), value);
       }
   
       public void serialize(QName name, Attributes attributes,
  @@ -214,7 +226,7 @@
           
           if (!cls.isArray()) {
             if (!(value instanceof List)) {
  -            throw new IOException("Can't seialize a " + cls.getName() +
  +            throw new IOException("Can't serialize a " + cls.getName() +
                                     " with the ArraySerializer!");
             }
             list = (List)value;
  
  
  
  1.7       +18 -2     xml-axis/java/src/org/apache/axis/encoding/BeanSerializer.java
  
  Index: BeanSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/BeanSerializer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BeanSerializer.java	2001/07/08 14:18:36	1.6
  +++ BeanSerializer.java	2001/07/09 21:31:21	1.7
  @@ -65,7 +65,9 @@
   import java.beans.PropertyDescriptor;
   
   import org.apache.axis.encoding.*;
  +import org.apache.axis.utils.Debug;
   import org.apache.axis.utils.QName;
  +import org.apache.axis.providers.java.RPCProvider;
   
   import org.xml.sax.*;
   
  @@ -104,6 +106,12 @@
   
           return pd;
       }
  +    
  +    protected PropertyDescriptor [] getPd(Object val)
  +    {
  +      if (cls == null) cls = val.getClass();
  +      return getPd();
  +    }
   
       protected void setPd(PropertyDescriptor[] pd) {
           this.pd = pd;
  @@ -192,7 +200,15 @@
               try {
                   pd.getWriteMethod().invoke(object, new Object[] {value});
               } catch (Exception e) {
  -                throw new SAXException(e);
  +                value = RPCProvider.convert(value, pd.getPropertyType());
  +                try {
  +                    pd.getWriteMethod().invoke(object, new Object[] {value});
  +                } catch (Exception ex) {
  +                    Debug.Print(1, "Couldn't convert " + value.getClass().getName() +
  +                                   " to bean field '" + pd.getName() + "', type " +
  +                                   pd.getPropertyType().getName());
  +                    throw new SAXException(ex);
  +                }
               }
           }
       }
  @@ -255,7 +271,7 @@
           throws IOException
       {
           context.startElement(name, attributes);
  -        PropertyDescriptor[] pd = getPd();
  +        PropertyDescriptor[] pd = getPd(value);
   
           try {
               for (int i=0; i<pd.length; i++) {
  
  
  
  1.9       +23 -29    xml-axis/java/src/org/apache/axis/encoding/DeserializerBase.java
  
  Index: DeserializerBase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializerBase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DeserializerBase.java	2001/07/08 14:18:37	1.8
  +++ DeserializerBase.java	2001/07/09 21:31:23	1.9
  @@ -89,27 +89,6 @@
           this.value = value;
       }
   
  -    class CallbackTarget {
  -        public ValueReceiver target;
  -        public Object hint;
  -        CallbackTarget(ValueReceiver target, Object hint)
  -        {
  -            this.target = target;
  -            this.hint = hint;
  -        }
  -    }
  -    protected Vector callbacks = null;
  -
  -    public void registerCallback(ValueReceiver target, Object hint)
  -    {
  -        if (target == null)
  -            return;
  -        
  -        if (callbacks == null)
  -            callbacks = new Vector();
  -        callbacks.addElement(new CallbackTarget(target, hint));
  -    }
  -    
       /////////////////////////////////////////////////////////////
       //  Reflection-based insertion of values into target objects
       //  once deserialization is complete.
  @@ -142,6 +121,29 @@
           }
       }
   
  +    class CallbackTarget implements Target {
  +        public ValueReceiver target;
  +        public Object hint;
  +        CallbackTarget(ValueReceiver target, Object hint)
  +        {
  +            this.target = target;
  +            this.hint = hint;
  +        }
  +        
  +        public void set(Object value) throws SAXException {
  +            target.valueReady(value, hint);
  +        }
  +    }
  +
  +    public void registerCallback(ValueReceiver target, Object hint)
  +    {
  +        if (target == null)
  +            return;
  +        
  +        registerValueTarget(new CallbackTarget(target, hint));
  +    }
  +    
  +
       protected Vector targets = null;
       public void registerValueTarget(Target target)
       {
  @@ -184,14 +186,6 @@
       public void valueComplete() throws SAXException
       {
           isComplete = true;
  -        
  -        if (callbacks != null) {
  -            Enumeration e = callbacks.elements();
  -            while (e.hasMoreElements()) {
  -                CallbackTarget target = (CallbackTarget)e.nextElement();
  -                target.target.valueReady(value, target.hint);
  -            }
  -        }
           
           if (targets != null) {
               Enumeration e = targets.elements();
  
  
  
  1.25      +17 -0     xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java
  
  Index: SOAPTypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- SOAPTypeMappingRegistry.java	2001/07/09 14:07:57	1.24
  +++ SOAPTypeMappingRegistry.java	2001/07/09 21:31:26	1.25
  @@ -64,6 +64,7 @@
   import java.util.Date;
   import java.util.List;
   import java.math.BigDecimal;
  +import java.io.IOException;
   
   public class SOAPTypeMappingRegistry extends TypeMappingRegistry { 
       
  @@ -77,6 +78,7 @@
       public static final QName XSD_BYTE = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "byte");
       public static final QName XSD_DECIMAL = new QName(Constants.URI_CURRENT_SCHEMA_XSD,
"decimal");
       public static final QName XSD_BASE64 = new QName(Constants.URI_2001_SCHEMA_XSD, "base64Binary");
  +    public static final QName XSD_ANYTYPE = new QName(Constants.URI_2001_SCHEMA_XSD, "anyType");
       public static final QName SOAP_BASE64 = new QName(Constants.URI_SOAP_ENC, "base64");
   
       public static final QName SOAP_STRING = new QName(Constants.URI_SOAP_ENC, "string");
  @@ -99,6 +101,18 @@
           else
               XSD_DATE = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "dateTime");
       }
  +    
  +    public static class ObjDeserializerFactory implements DeserializerFactory {
  +        public DeserializerBase getDeserializer(Class cls) { return null; }
  +    }
  +    public static class ObjSerializer implements Serializer {
  +        public void serialize(QName name, Attributes attributes,
  +                          Object value, SerializationContext context)
  +            throws IOException
  +        {
  +            throw new IOException("Can't serialize a raw object");
  +        }
  +    }
   
       public static abstract class BasicDeser extends DeserializerBase {
           StringBuffer val = new StringBuffer();
  @@ -246,6 +260,9 @@
             new QName(Constants.URI_2001_SCHEMA_XSD, "dateTime"),
             java.util.Date.class,
             new DateSerializer.DateDeserializerFactory());
  +        
  +        addDeserializerFactory(XSD_ANYTYPE, java.lang.Object.class, new ObjDeserializerFactory());
  +        addSerializer(java.lang.Object.class, XSD_ANYTYPE, new ObjSerializer());
   
           // handle the various base64 QNames...
           addDeserializerFactory(SOAP_BASE64, byte[].class, base64Ser);
  
  
  
  1.18      +2 -1      xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java
  
  Index: TypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TypeMappingRegistry.java	2001/07/08 14:18:37	1.17
  +++ TypeMappingRegistry.java	2001/07/09 21:31:29	1.18
  @@ -232,7 +232,8 @@
                   attributes = setTypeAttribute(attributes, type, context);
                   ser.serialize(name, attributes, value, context);
               } else {
  -                throw new IOException("No serializer found for class " + _class.getName());
  +                throw new IOException("No serializer found for class " + _class.getName()
+
  +                                      " in registry " + this);
               }
           }
           // !!! Write out a generic null, or get type info from somewhere else?
  
  
  
  1.27      +29 -3     xml-axis/java/src/org/apache/axis/message/MessageElement.java
  
  Index: MessageElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/MessageElement.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- MessageElement.java	2001/07/09 15:41:18	1.26
  +++ MessageElement.java	2001/07/09 21:31:41	1.27
  @@ -136,18 +136,32 @@
           }
               
           href = attributes.getValue(Constants.ATTR_HREF);
  +        
  +        // If there's an arrayType attribute, we can pretty well guess that we're an Array???
  +        if (attributes.getValue(Constants.URI_SOAP_ENC, Constants.ATTR_ARRAY_TYPE) != null)
  +          typeQName = SOAPTypeMappingRegistry.SOAP_ARRAY;
         }
   
         if (typeQName == null) {
             QName myQName = new QName(namespaceURI, name);
             if (myQName.equals(SOAPTypeMappingRegistry.SOAP_ARRAY)) {
                 typeQName = SOAPTypeMappingRegistry.SOAP_ARRAY;
  -          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_INT)) {
  -              typeQName = SOAPTypeMappingRegistry.XSD_INT;
  +          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_STRING)) {
  +              typeQName = SOAPTypeMappingRegistry.XSD_STRING;
             } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_BOOLEAN)) {
                 typeQName = SOAPTypeMappingRegistry.XSD_BOOLEAN;
  +          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_DOUBLE)) {
  +              typeQName = SOAPTypeMappingRegistry.XSD_DOUBLE;
  +          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_FLOAT)) {
  +              typeQName = SOAPTypeMappingRegistry.XSD_FLOAT;
  +          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_INT)) {
  +              typeQName = SOAPTypeMappingRegistry.XSD_INT;
  +          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_LONG)) {
  +              typeQName = SOAPTypeMappingRegistry.XSD_LONG;
             } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_SHORT)) {
                 typeQName = SOAPTypeMappingRegistry.XSD_SHORT;
  +          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_BYTE)) {
  +              typeQName = SOAPTypeMappingRegistry.XSD_BYTE;
             }
         }
         
  @@ -225,15 +239,25 @@
       public Object getValue()
       {
           if (value != null) {
  +            if (DEBUG_LOG) {
  +                System.out.println(this + " returning val " + value);
  +            }
               return value;
           }
           
           if (href != null) {
  +            if (DEBUG_LOG) {
  +                System.out.println(this + " looking up ref element " + href);
  +            }
               return getRealElement().getValue();
           }
           
           if (deserializer != null) {
               value = deserializer.getValue();
  +            if (DEBUG_LOG) {
  +                System.out.println(this + " returning dser (" + deserializer +
  +                                   ") val=" + value);
  +            }
               deserializer = null;
           } else {
               // No attached deserializer, try it as a String...
  @@ -244,6 +268,9 @@
               }
           }
           
  +        if (DEBUG_LOG) {
  +            System.out.println(this + " returning val=" + value);
  +        }
           return value;
       }
   
  @@ -276,7 +303,6 @@
           if (isDeserializing()) {
             if (href != null) {
               deserializer = context.getElementByID(href.substring(1));
  -            System.out.println("Got href dser " + deserializer);
               if (deserializer != null)
                 return deserializer;
             }
  
  
  
  1.9       +34 -9     xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
  
  Index: RPCProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RPCProvider.java	2001/07/07 01:45:43	1.8
  +++ RPCProvider.java	2001/07/09 21:31:46	1.9
  @@ -80,27 +80,52 @@
        * @param arg the array to convert
        * @param destClass the actual class we want (must implement List)
        */
  -    private Object convert(Object arg, Class destClass)
  +    public static Object convert(Object arg, Class destClass)
       {
  -      // Right now only converts arrays -> Lists...
  -      if (!arg.getClass().isArray())
  +      if (DEBUG_LOG) {
  +        System.out.println("Converting " + arg + " to " + destClass.getName());
  +      }
  +      
  +      if (!(arg instanceof List))
           return arg;
  +      
  +      List list = (List)arg;
  +      int length = list.size();
         
  -      Object [] argArray = (Object [])arg;
  +      if (destClass.isArray()) {
  +        if (destClass.getComponentType().isPrimitive()) {
  +          
  +          Object array = Array.newInstance(destClass.getComponentType(), length);
  +          for (int i = 0; i < length; i++) {
  +            Array.set(array, i, list.get(i));
  +          }
  +          return array;
  +          
  +        } else {
  +          Object [] array;
  +          try {
  +            array = (Object [])Array.newInstance(destClass.getComponentType(), length);
  +          } catch (Exception e) {
  +            return arg;
  +          }
  +          
  +          return list.toArray(array);
  +        }
  +      }
         
         if (List.class.isAssignableFrom(destClass)) {
  -        List list = null;
  +        List newList = null;
           try {
  -          list = (List)destClass.newInstance();
  +          newList = (List)destClass.newInstance();
           } catch (Exception e) {
             // Couldn't build one for some reason... so forget it.
             return arg;
           }
           
  -        for (int j = 0; j < argArray.length; j++) {
  -          list.add(argArray[j]);
  +        for (int j = 0; j < ((List)arg).size(); j++) {
  +          newList.add(list.get(j));
           }
  -        return list;
  +        return newList;
         }
         
         return arg;
  
  
  
  1.3       +2 -0      xml-axis/java/src/org/apache/axis/server/server-config.xml
  
  Index: server-config.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/server/server-config.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- server-config.xml	2001/07/01 14:32:17	1.2
  +++ server-config.xml	2001/07/09 21:31:51	1.3
  @@ -8,12 +8,14 @@
     <handler name="EchoHandler" class="org.apache.axis.handlers.EchoHandler"/>
     <handler name="JWSProcessor" class="org.apache.axis.handlers.JWSProcessor"/>
     <handler name="JWSHandler" class="org.apache.axis.handlers.JWSHandler"/>
  +  <handler name="LocalResponder" class="org.apache.axis.transport.local.LocalResponder"/>
   
     <chain name="global.request" flow="JWSHandler,debug"/>
    </handlers>
   
    <transports>
     <transport name="http" pivot="HTTPSender"/>
  +  <transport name="local" response="LocalResponder"/>
    </transports>
   
    <services>
  
  
  
  1.4       +2 -1      xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java
  
  Index: LocalSender.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LocalSender.java	2001/07/01 03:31:07	1.3
  +++ LocalSender.java	2001/07/09 21:31:57	1.4
  @@ -106,6 +106,7 @@
       Debug.Print(3, msgStr);
   
       serverContext.setRequestMessage(new Message(msgStr));
  +    serverContext.setTransportName("local");
   
       // copy soap action if it is present
       String action = clientContext.getStrProp(HTTPConstants.MC_HTTP_SOAPACTION);
  @@ -134,7 +135,7 @@
       // copy back the response, and force its format to String in order to
       // exercise the deserializers.
       clientContext.setResponseMessage(serverContext.getResponseMessage());
  -    clientContext.getResponseMessage().getAsString();
  +    //clientContext.getResponseMessage().getAsString();
   
       Debug.Print( 1, "Exit: LocalSender::invoke" );
     }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/transport/local/LocalResponder.java
  
  Index: LocalResponder.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.transport.local;
  
  import org.apache.axis.*;
  import org.apache.axis.handlers.*;
  import org.apache.axis.utils.Debug;
  
  /**
   * Tiny Handler which just makes sure to Stringize the outgoing
   * Message to appropriately use serializers on the server side.
   *
   * @author Glen Daniels (gdaniels@macromedia.com)
   */
  public class LocalResponder extends BasicHandler {
    public void invoke(MessageContext msgContext) throws AxisFault {
      Debug.Print( 1, "Enter: LocalResponder::invoke" );
      msgContext.getResponseMessage().getAsString();
      Debug.Print( 1, "Enter: LocalResponder::invoke" );
    }
  
    public void undo(MessageContext msgContext) {
      Debug.Print( 1, "Enter: LocalResponder::undo" );
      Debug.Print( 1, "Exit: LocalResponder::undo" );
    }
  };
  
  
  
  1.11      +19 -7     xml-axis/java/test/encoding/TestDeser.java
  
  Index: TestDeser.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestDeser.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TestDeser.java	2001/07/08 14:18:39	1.10
  +++ TestDeser.java	2001/07/09 21:32:03	1.11
  @@ -53,12 +53,21 @@
       private static boolean equals(Object obj1, Object obj2) {
          if (obj1 == null) return (obj2 == null);
          if (obj1.equals(obj2)) return true;
  -       if (!obj2.getClass().isArray()) return false;
  -       if (!obj1.getClass().isArray()) return false;
  -       if (Array.getLength(obj1) != Array.getLength(obj2)) return false;
  -       for (int i=0; i<Array.getLength(obj1); i++)
  -           if (!equals(Array.get(obj1,i),Array.get(obj2,i))) return false;
  -       return true;
  +       if (obj2.getClass().isArray() && obj1.getClass().isArray()) {
  +           if (Array.getLength(obj1) != Array.getLength(obj2)) return false;
  +           for (int i=0; i<Array.getLength(obj1); i++)
  +               if (!equals(Array.get(obj1,i),Array.get(obj2,i))) return false;
  +           return true;
  +       }
  +       if ((obj1 instanceof List) && (obj2 instanceof List)) {
  +           List list1 = (List)obj1;
  +           List list2 = (List)obj2;
  +           if (list1.size() != list2.size()) return false;
  +           for (int i=0; i < list1.size(); i++) {
  +               if (!equals(list1.get(i), list2.get(i))) return false;
  +           }
  +       }
  +       return false;
       }
   
       /**
  @@ -121,12 +130,15 @@
       }
   
       public void testArray() {
  +        Vector v = new Vector();
  +        v.addElement("abc");
  +        v.addElement("def");
           deserialize("<result xsi:type=\"soapenc:Array\" " +
                               "soapenc:arrayType=\"xsd:string[2]\"> " +
                          "<item xsi:type=\"xsd:string\">abc</item>" + 
                          "<item xsi:type=\"xsd:string\">def</item>" +
                       "</result>",
  -                    new String[] {"abc", "def"});
  +                    v);
       }
   
       public void testUntyped() {
  
  
  

Mime
View raw message