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 00:05:42 UTC

cvs commit: xml-axis/java/src/org/apache/axis/encoding DefaultTypeMappingImpl.java DeserializationContextImpl.java SerializationContextImpl.java TypeMappingRegistryImpl.java

scheu       02/01/28 15:05:42

  Modified:    java/src/org/apache/axis Constants.java
               java/src/org/apache/axis/encoding
                        DefaultTypeMappingImpl.java
                        DeserializationContextImpl.java
                        SerializationContextImpl.java
                        TypeMappingRegistryImpl.java
  Log:
  Interop Fix: Changed to use SOAP 1.1 format over the wire
  
  Revision  Changes    Path
  1.47      +2 -2      xml-axis/java/src/org/apache/axis/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- Constants.java	26 Jan 2002 02:50:51 -0000	1.46
  +++ Constants.java	28 Jan 2002 23:05:41 -0000	1.47
  @@ -90,7 +90,7 @@
                                   "http://schemas.xmlsoap.org/soap/envelope/" ;
       public static final String URI_SOAP12_ENV =
                                      "http://www.w3.org/2001/06/soap-envelope";
  -    public static final String URI_CURRENT_SOAP_ENV = URI_SOAP12_ENV;
  +    public static final String URI_CURRENT_SOAP_ENV = URI_SOAP_ENV;  // SOAP 1.1 over the wire
   
       public static final String[] URIS_SOAP_ENV = {
           URI_SOAP_ENV,
  @@ -118,7 +118,7 @@
                                   "http://schemas.xmlsoap.org/soap/encoding" ;
       public static final String URI_SOAP12_ENC =
                                      "http://www.w3.org/2001/06/soap-encoding";
  -    public static final String URI_CURRENT_SOAP_ENC = URI_SOAP12_ENC;
  +    public static final String URI_CURRENT_SOAP_ENC = URI_SOAP_ENC; // SOAP 1.1 over the wire
   
       public static final String[] URIS_SOAP_ENC = {
           URI_SOAP_ENC,
  
  
  
  1.2       +59 -43    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultTypeMappingImpl.java	26 Jan 2002 02:40:33 -0000	1.1
  +++ DefaultTypeMappingImpl.java	28 Jan 2002 23:05:41 -0000	1.2
  @@ -126,53 +126,53 @@
   
           // The XSD Primitives are mapped to java primitives.
           // The corresponding SOAP-ENC primitives are mapped to the wrapper classes.
  -        myRegister(Constants.XSD_BOOLEAN,    boolean.class,              null, null);
  -        myRegister(Constants.XSD_DOUBLE,     double.class,               null, null);
  -        myRegister(Constants.XSD_FLOAT,      float.class,                null, null);
  -        myRegister(Constants.XSD_INT,        int.class,                  null, null);
  -        myRegister(Constants.XSD_LONG,       long.class,                 null, null);
  -        myRegister(Constants.XSD_SHORT,      short.class,                null, null);
  -        myRegister(Constants.XSD_BYTE,       byte.class,                 null, null);
  -        myRegister(Constants.XSD_STRING,     java.lang.String.class,     null, null);
  -        myRegister(Constants.XSD_INTEGER,    java.math.BigInteger.class, null, null);
  -        myRegister(Constants.XSD_DECIMAL,    java.math.BigDecimal.class, null, null);
  +        myRegister(Constants.XSD_BOOLEAN,    boolean.class,              null, null, true);
  +        myRegister(Constants.XSD_DOUBLE,     double.class,               null, null,true);
  +        myRegister(Constants.XSD_FLOAT,      float.class,                null, null,true);
  +        myRegister(Constants.XSD_INT,        int.class,                  null, null,true);
  +        myRegister(Constants.XSD_LONG,       long.class,                 null, null,true);
  +        myRegister(Constants.XSD_SHORT,      short.class,                null, null,true);
  +        myRegister(Constants.XSD_BYTE,       byte.class,                 null, null,true);
  +        myRegister(Constants.XSD_STRING,     java.lang.String.class,     null, null,true);
  +        myRegister(Constants.XSD_INTEGER,    java.math.BigInteger.class, null, null,true);
  +        myRegister(Constants.XSD_DECIMAL,    java.math.BigDecimal.class, null, null,true);
           myRegister(Constants.XSD_QNAME,      javax.xml.rpc.namespace.QName.class,
                      new BeanSerializerFactory(javax.xml.rpc.namespace.QName.class,
                                                Constants.XSD_QNAME),
                      new BeanDeserializerFactory(javax.xml.rpc.namespace.QName.class,
  -                                               Constants.XSD_QNAME));
  -        myRegister(Constants.XSD_ANYTYPE,    java.lang.Object.class,     null, null);
  +                                               Constants.XSD_QNAME),true);
  +        myRegister(Constants.XSD_ANYTYPE,    java.lang.Object.class,     null, null, false);
           myRegister(Constants.XSD_DATE,       java.util.Date.class,                           
                      new DateSerializerFactory(java.util.Date.class,Constants.XSD_DATE),
  -                   new DateDeserializerFactory(java.util.Date.class,Constants.XSD_DATE));
  +                   new DateDeserializerFactory(java.util.Date.class,Constants.XSD_DATE),true);
           myRegister(Constants.XSD_DATE2,      java.util.Date.class,                           
                      new DateSerializerFactory(java.util.Date.class, Constants.XSD_DATE2),
  -                   new DateDeserializerFactory(java.util.Date.class, Constants.XSD_DATE2));
  +                   new DateDeserializerFactory(java.util.Date.class, Constants.XSD_DATE2),true);
           myRegister(Constants.XSD_DATE3,      java.util.Date.class,                           
                      new DateSerializerFactory(java.util.Date.class, Constants.XSD_DATE3),
  -                   new DateDeserializerFactory(java.util.Date.class, Constants.XSD_DATE3));
  +                   new DateDeserializerFactory(java.util.Date.class, Constants.XSD_DATE3),true);
           myRegister(Constants.XSD_BASE64,     byte[].class,                                   
                      new Base64SerializerFactory(),
  -                   new Base64DeserializerFactory());
  +                   new Base64DeserializerFactory(),true);
           myRegister(Constants.XSD_HEXBIN,     Hex.class,   
                      new HexSerializerFactory(),
  -                   new HexDeserializerFactory());
  +                   new HexDeserializerFactory(),true);
   
           // Use the Map Serialization for both Hashtables and HashMap objects
           myRegister(Constants.SOAP_MAP,       java.util.HashMap.class,    
                      new MapSerializerFactory(java.util.HashMap.class,Constants.SOAP_MAP),
  -                   new MapDeserializerFactory(java.util.HashMap.class,Constants.SOAP_MAP));
  +                   new MapDeserializerFactory(java.util.HashMap.class,Constants.SOAP_MAP), false);
           myRegister(Constants.SOAP_MAP,       java.util.Hashtable.class,    
                      new MapSerializerFactory(java.util.Hashtable.class,Constants.SOAP_MAP),
  -                   new MapDeserializerFactory(java.util.Hashtable.class,Constants.SOAP_MAP));
  +                   new MapDeserializerFactory(java.util.Hashtable.class,Constants.SOAP_MAP), false);
   
           // Use the Element Serializeration for elements
           myRegister(Constants.SOAP_ELEMENT,   org.w3c.dom.Element.class,    
                      new ElementSerializerFactory(),
  -                   new ElementDeserializerFactory());
  +                   new ElementDeserializerFactory(), false);
           myRegister(Constants.SOAP_VECTOR,    java.util.Vector.class,             
                      null,
  -                   new VectorDeserializerFactory(java.util.Vector.class,Constants.SOAP_VECTOR));
  +                   new VectorDeserializerFactory(java.util.Vector.class,Constants.SOAP_VECTOR), false);
   
           // All array objects automatically get associated with the SOAP_ARRAY.  There
           // is no way to do this with a hash table, so it is done directly in getTypeQName.
  @@ -181,27 +181,46 @@
           // all objects that implement the List interface as a SOAP_ARRAY
           myRegister(Constants.SOAP_ARRAY,     java.util.List.class,               
                      new ArraySerializerFactory(),
  -                   new ArrayDeserializerFactory());
  +                   new ArrayDeserializerFactory(), false);
           myRegister(Constants.SOAP_ARRAY,     java.util.ArrayList.class,               
                      new ArraySerializerFactory(),
  -                   new ArrayDeserializerFactory());
  +                   new ArrayDeserializerFactory(), false);
  +
  +        // Register the SOAP Primitives if we SOAP 1.2 over the wire.
  +        // (Currently URI_CURRENT_SOAP_ENC is set to SOAP 1.1)
  +        if (Constants.URI_CURRENT_SOAP_ENC.equals(Constants.URI_SOAP12_ENC)) {
  +            // SOAP Encoded strings are treated as primitives.  Everything else is not.
  +            myRegister(Constants.SOAP_STRING,     java.lang.String.class,     null, null, true); 
  +            myRegister(Constants.SOAP_BOOLEAN,    java.lang.Boolean.class,    null, null, false);
  +            myRegister(Constants.SOAP_DOUBLE,     java.lang.Double.class,     null, null, false);
  +            myRegister(Constants.SOAP_FLOAT,      java.lang.Float.class,      null, null, false);
  +            myRegister(Constants.SOAP_INT,        java.lang.Integer.class,    null, null, false);
  +            myRegister(Constants.SOAP_INTEGER,    java.math.BigInteger.class, null, null, false);
  +            myRegister(Constants.SOAP_DECIMAL,    java.math.BigDecimal.class, null, null, false);
  +            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.
  +            myRegister(Constants.XSD_STRING,     java.lang.String.class,     null, null, true); 
  +            myRegister(Constants.XSD_BOOLEAN,    java.lang.Boolean.class,    null, null, true);
  +            myRegister(Constants.XSD_DOUBLE,     java.lang.Double.class,     null, null, true);
  +            myRegister(Constants.XSD_FLOAT,      java.lang.Float.class,      null, null, true);
  +            myRegister(Constants.XSD_INT,        java.lang.Integer.class,    null, null, true);
  +            myRegister(Constants.XSD_INTEGER,    java.math.BigInteger.class, null, null, true);
  +            myRegister(Constants.XSD_DECIMAL,    java.math.BigDecimal.class, null, null, true);
  +            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);
  +        }
   
  -        myRegister(Constants.SOAP_STRING,     java.lang.String.class,     null, null); 
  -        myRegister(Constants.SOAP_BOOLEAN,    java.lang.Boolean.class,    null, null);
  -        myRegister(Constants.SOAP_DOUBLE,     java.lang.Double.class,     null, null);
  -        myRegister(Constants.SOAP_FLOAT,      java.lang.Float.class,      null, null);
  -        myRegister(Constants.SOAP_INT,        java.lang.Integer.class,    null, null);
  -        myRegister(Constants.SOAP_INTEGER,    java.math.BigInteger.class, null, null);
  -        myRegister(Constants.SOAP_DECIMAL,    java.math.BigDecimal.class, null, null);
  -        myRegister(Constants.SOAP_LONG,       java.lang.Long.class,       null, null);
  -        myRegister(Constants.SOAP_SHORT,      java.lang.Short.class,      null, null);
  -        myRegister(Constants.SOAP_BYTE,       java.lang.Byte.class,       null, null);
  -
  -        // 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());
       }
   
       /**
  @@ -209,10 +228,7 @@
        * known xmlType namespaces
        */   
       protected void myRegister(QName xmlType, Class javaType,
  -                              SerializerFactory sf, DeserializerFactory df) {
  -        // If the type is truly a primitive, then the serializer can
  -        // be shared.  Otherwise the serializers/deserializers can't be shared.
  -        boolean primitive = (javaType.isPrimitive() || javaType == java.lang.String.class);
  +                              SerializerFactory sf, DeserializerFactory df, boolean primitive) {
   
           // If factories are not specified, use the Simple serializer/deserializer factories.
           if (sf == null && df == null) {
  
  
  
  1.3       +10 -2     xml-axis/java/src/org/apache/axis/encoding/DeserializationContextImpl.java
  
  Index: DeserializationContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializationContextImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DeserializationContextImpl.java	28 Jan 2002 18:23:02 -0000	1.2
  +++ DeserializationContextImpl.java	28 Jan 2002 23:05:41 -0000	1.3
  @@ -313,10 +313,18 @@
       {
           QName typeQName = null;
           
  -        // I am not sure why we are querying the name instead of the type?
           if (typeQName == null) {
  +
  +            // If the element is a SOAP-ENC element, the name of the element is the type.
  +            // If the default type mapping accepts SOAP 1.2, then use then set
  +            // the typeQName to the SOAP-ENC type.
  +            // Else if the default type mapping accepts SOAP 1.1, then 
  +            // convert the SOAP-ENC type to the appropriate XSD Schema Type.
               QName myQName = new QName(namespace, localName);
  -            if (myQName.equals(Constants.SOAP_ARRAY)) {
  +            if (Constants.URI_CURRENT_SOAP_ENC.equals(Constants.URI_SOAP12_ENC) &&
  +                Constants.isSOAP_ENC(namespace)) {
  +                typeQName = myQName;
  +            } else if (myQName.equals(Constants.SOAP_ARRAY)) {
                   typeQName = Constants.SOAP_ARRAY;
               } else if (myQName.equals(Constants.SOAP_STRING)) {
                   typeQName = Constants.XSD_STRING;
  
  
  
  1.2       +17 -1     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SerializationContextImpl.java	26 Jan 2002 02:40:33 -0000	1.1
  +++ SerializationContextImpl.java	28 Jan 2002 23:05:41 -0000	1.2
  @@ -380,7 +380,23 @@
           
           // Note that arrays are not primitives.
           // Also note that java.lang wrapper classes (i.e. java.lang.Integer) are
  -        // not primitives.
  +        // not primitives unless the corresponding type is an xsd type.
  +        QName qName = getQNameForClass(javaType);
  +        if (qName != null && Constants.isSchemaXSD(qName.getNamespaceURI())) {
  +            if (qName.equals(Constants.XSD_BOOLEAN) ||
  +                qName.equals(Constants.XSD_DOUBLE) ||
  +                qName.equals(Constants.XSD_FLOAT) ||
  +                qName.equals(Constants.XSD_INT) ||
  +                qName.equals(Constants.XSD_LONG) ||
  +                qName.equals(Constants.XSD_SHORT) ||
  +                qName.equals(Constants.XSD_BYTE) ||
  +                qName.equals(Constants.XSD_STRING) ||
  +                qName.equals(Constants.XSD_INTEGER) ||
  +                qName.equals(Constants.XSD_DECIMAL)) { 
  +                return true;
  +            }
  +        }
  +
           return false;
       }
   
  
  
  
  1.2       +0 -1      xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java
  
  Index: TypeMappingRegistryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TypeMappingRegistryImpl.java	26 Jan 2002 02:40:33 -0000	1.1
  +++ TypeMappingRegistryImpl.java	28 Jan 2002 23:05:42 -0000	1.2
  @@ -78,7 +78,6 @@
       private HashMap mapTM;          // Type Mappings keyed by the Web Service Namespace URI
       private TypeMapping defaultTM;  // Default Type Mapping 
       
  -    static private TypeMappingRegistry tmr = new TypeMappingRegistryImpl();
       /**
        * Construct TypeMappingRegistry
        */