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 sc...@apache.org on 2002/01/29 22:31:38 UTC

cvs commit: xml-axis/java/test/wsdl/marrays MArrayTestsServiceTestCase.java

scheu       02/01/29 13:31:38

  Modified:    java/src/org/apache/axis/encoding
                        DefaultTypeMappingImpl.java
                        SerializationContextImpl.java
               java/test/wsdl/marrays MArrayTestsServiceTestCase.java
  Log:
  Changes to make arrays single reference.
  Fix for Base64.
  
  Revision  Changes    Path
  1.3       +10 -1     xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
  
  Index: DefaultTypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultTypeMappingImpl.java	28 Jan 2002 23:05:41 -0000	1.2
  +++ DefaultTypeMappingImpl.java	29 Jan 2002 21:31:38 -0000	1.3
  @@ -200,12 +200,12 @@
               myRegister(Constants.SOAP_LONG,       java.lang.Long.class,       null, null, false);
               myRegister(Constants.SOAP_SHORT,      java.lang.Short.class,      null, null, false);
               myRegister(Constants.SOAP_BYTE,       java.lang.Byte.class,       null, null, false);
  -
               // Note that a SOAP_BASE64 is mapped to a Byte[] not a byte[].  This is 
               // the reason why the array serialization is used.
               myRegister(Constants.SOAP_BASE64,     java.lang.Byte[].class,       
                          new ArraySerializerFactory(),
                          new ArrayDeserializerFactory(),true);
  +
           } else {
               // Even though the java class is an object, since these are all 
               // xsd primitives, treat them as a primitive.
  @@ -219,6 +219,15 @@
               myRegister(Constants.XSD_LONG,       java.lang.Long.class,       null, null, true);
               myRegister(Constants.XSD_SHORT,      java.lang.Short.class,      null, null, true);
               myRegister(Constants.XSD_BYTE,       java.lang.Byte.class,       null, null, true);
  +
  +            // Need to accept a SOAP_BASE64 over the wire...which maps to byte[].         
  +            // Note that this is serialized over the wire as XSD_BASE64.
  +            myRegister(Constants.SOAP_BASE64,    byte[].class,       
  +                       null,
  +                       new Base64DeserializerFactory(),true);
  +            myRegister(Constants.XSD_BASE64,     byte[].class,                                   
  +                       new Base64SerializerFactory(),
  +                       new Base64DeserializerFactory(),true);
           }
   
       }
  
  
  
  1.3       +21 -2     xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java
  
  Index: SerializationContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SerializationContextImpl.java	28 Jan 2002 23:05:41 -0000	1.2
  +++ SerializationContextImpl.java	29 Jan 2002 21:31:38 -0000	1.3
  @@ -378,9 +378,28 @@
           if (Element.class.isAssignableFrom(javaType)) return true;
           if (byte[].class.isAssignableFrom(javaType)) return true;
           
  -        // Note that arrays are not primitives.
  -        // Also note that java.lang wrapper classes (i.e. java.lang.Integer) are
  +        // There has been discussion as to whether arrays themselves should
  +        // be regarded as multi-ref.
  +        // Here are the three options:
  +        //   1) Arrays are full-fledged Objects and therefore should always be
  +        //      multi-ref'd  (Pro: This is like java.  Con: Some runtimes don't
  +        //      support this yet, and it requires more stuff to be passed over the wire.)
  +        //   2) Arrays are not full-fledged Objects and therefore should
  +        //      always be passed as single ref (note the elements of the array
  +        //      may be multi-ref'd.) (Pro:  This seems reasonable, if a user
  +        //      wants multi-referencing put the array in a container.  Also 
  +        //      is more interop compatible.  Con: Not like java serialization.)
  +        //   3) Arrays of primitives should be single ref, and arrays of 
  +        //      non-primitives should be multi-ref.  (Pro: Takes care of the
  +        //      looping case.  Con: Seems like an obtuse rule.)
  +        //
  +        // Changing the code from (1) to (2) to see if interop fairs better.
  +        if (javaType.isArray()) return true;
  +
  +        // Note that java.lang wrapper classes (i.e. java.lang.Integer) are
           // not primitives unless the corresponding type is an xsd type.
  +        // (If the wrapper maps to a soap encoded primitive, it can be nillable
  +        // and multi-ref'd).  
           QName qName = getQNameForClass(javaType);
           if (qName != null && Constants.isSchemaXSD(qName.getNamespaceURI())) {
               if (qName.equals(Constants.XSD_BOOLEAN) ||
  
  
  
  1.3       +3 -0      xml-axis/java/test/wsdl/marrays/MArrayTestsServiceTestCase.java
  
  Index: MArrayTestsServiceTestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/marrays/MArrayTestsServiceTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MArrayTestsServiceTestCase.java	24 Jan 2002 17:01:39 -0000	1.2
  +++ MArrayTestsServiceTestCase.java	29 Jan 2002 21:31:38 -0000	1.3
  @@ -97,6 +97,8 @@
           } catch (java.rmi.RemoteException re) {
               throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
           }
  +        // This test is no longer valid if Axis treats arrays as always single-ref
  +        /*        
           try {
               // Test 4F: Foo arrays are multi-referenced.   
               Foo[][][] in = new Foo[3][3][3];
  @@ -122,6 +124,7 @@
           } catch (java.rmi.RemoteException re) {
               throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
           }
  +        */
       }
   
       public void fill(int[][][] array) {