axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: xml-axis/java/test/wsdl/sequence SequenceTest.wsdl SequenceTestServiceTestCase.java SequenceTestSoapBindingImpl.java
Date Fri, 01 Feb 2002 22:08:27 GMT
scheu       02/02/01 14:08:27

  Modified:    java/samples/encoding TestSer.java
               java/src/javax/xml/rpc/encoding TypeMapping.java
                        TypeMappingRegistry.java
               java/src/org/apache/axis/client Call.java
               java/src/org/apache/axis/deployment/wsdd WSDDDeployment.java
                        WSDDService.java
               java/src/org/apache/axis/encoding
                        DefaultTypeMappingImpl.java TypeMapping.java
                        TypeMappingImpl.java TypeMappingRegistry.java
                        TypeMappingRegistryImpl.java
               java/src/org/apache/axis/providers/java JavaProvider.java
               java/src/org/apache/axis/wsdl/fromJava Emitter.java
                        Types.java
               java/src/org/apache/axis/wsdl/toJava Emitter.java
               java/test/RPCDispatch TestSerializedRPC.java
               java/test/encoding TestSer.java
               java/test/wsdl/sequence SequenceTest.wsdl
                        SequenceTestServiceTestCase.java
                        SequenceTestSoapBindingImpl.java
  Added:       java/src/org/apache/axis/encoding
                        DefaultSOAP12TypeMappingImpl.java
                        TypeMappingDelegate.java
  Log:
  The following TypeMapping related changes were made:
  
   - Changed the TypeMapping interfaces to match new signatures/semantics
     of JSR 101 version 0.7.
  
   - The DefaultTypeMappingImpl contains the xsd/soap mappings to
     serialize and deserialize SOAP 1.1 types.  In addition it
     contains enough information to deserialize SOAP 1.2 items
     that may come off the wire.
     Added the DefaultSOAP12TypeMappingImpl.java which supports
     serializing and deserializing SOAP 1.2 types over the wire (for example
     will flow a soapenc:int over the wire if the class is a java.lang.Integer).
     This new type mapping contains only the new mappings and
     delegates to DefaultTypeMappingImpl to get the SOAP 1.1 stuff.
     (Note that the Axis runtime uses the DefaultTypeMapping because
     it needs to flow SOAP 1.1 over the wire.  The DefaultSOA12TypeMappingImpl
     is needed by the emitters.)
  
   - Updated the TypeMappingRegistryImpl to make it more flexible
     for delegation purposes.
  
   - The Default TypeMappings are singletons and should not
     be changed after construction.  Now these objects throw exceptions
     if an attempt is made to change them.  Found a couple testcases
     that were doing the wrong thing and changed them.
  
   - Changed Java2WSDL to generate JAX-RPC soapenc primitives for
     wrapper class references.  This is done by using the
     DefaultSOAP12TypeMappingRegistry during processing. (This problem
     was discovered by Russell Butek.)  Made a slight change to
     the sequence test to ensure that a soapenc:int roundtrips correctly.
  
   - Made changes to reduce line length to 79 characters or less.
  
  Revision  Changes    Path
  1.20      +1 -1      xml-axis/java/samples/encoding/TestSer.java
  
  Index: TestSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/encoding/TestSer.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- TestSer.java	26 Jan 2002 02:52:38 -0000	1.19
  +++ TestSer.java	1 Feb 2002 22:08:25 -0000	1.20
  @@ -58,7 +58,7 @@
                   TypeMapping tm = (TypeMapping) reg.getTypeMapping(Constants.URI_SOAP_ENC);
                   if (tm == null) {
                       tm = (TypeMapping) reg.createTypeMapping();
  -                    reg.register(tm, new String[] {Constants.URI_SOAP_ENC});
  +                    reg.register(Constants.URI_CURRENT_SOAP_ENC, tm);
                   }
                   tm.register(Data.class, dataQName, new DataSerFactory(), new DataDeserFactory());
   
  
  
  
  1.8       +29 -11    xml-axis/java/src/javax/xml/rpc/encoding/TypeMapping.java
  
  Index: TypeMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/javax/xml/rpc/encoding/TypeMapping.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TypeMapping.java	16 Jan 2002 16:41:36 -0000	1.7
  +++ TypeMapping.java	1 Feb 2002 22:08:25 -0000	1.8
  @@ -65,26 +65,38 @@
    * 
    * For its supported encoding styles and XML schema namespaces, 
    * a TypeMapping instance maintains a set of tuples of 
  - * the type {Java type, SerializerFactory, DeserializerFactory, XML data type}. 
  + * the type
  + * {Java type, SerializerFactory, DeserializerFactory, XML data type}. 
    *
    * @version 0.6
    */
   public interface TypeMapping {
   
       /**
  -     * Gets the list of encoding styles supported by this TypeMapping object.
  +     * Gets the list of encoding styles supported by this TypeMapping.
        *
        * @return  String[] of namespace URIs for the supported encoding 
        * styles and XML schema namespaces.
        */
  -    public String[] getSupportedEncodings();
  +    public String[] getSupportedNamespaces();
   
       /**
  -     * Sets the list of encoding styles supported by this TypeMapping object.
  +     * Sets the list of encoding styles supported by this
  +     * TypeMapping.
        *
        * @param namespaceURIs String[] of namespace URI's                
        */
  -    public void setSupportedEncodings(String[] namespaceURIs);
  +    public void setSupportedNamespaces(String[] namespaceURIs);
  +
  +    /**
  +     * isRegistered returns true if the [javaType, xmlType]
  +     * pair is registered.
  +     * @param javaType - Class of the Java type
  +     * @param xmlType - Qualified name of the XML data type
  +     * @return: false if either javaType or xmlType is null
  +     * or if the pair is not specifically registered.
  +     */
  +    public boolean isRegistered(Class javaType, QName xmlType);
   
       /**
        * Registers SerializerFactory and DeserializerFactory for a 
  @@ -112,7 +124,8 @@
        *
        * @throws JAXRPCException - If there is no registered SerializerFactory 
        * for this pair of Java type and XML data type 
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * java.lang.IllegalArgumentException - If invalid or unsupported
  +     * XML/Java type is specified
        */
       public SerializerFactory getSerializer(Class javaType, QName xmlType)
           throws JAXRPCException;
  @@ -128,7 +141,8 @@
        *
        * @throws JAXRPCException - If there is no registered DeserializerFactory
        * for this pair of Java type and  XML data type 
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * java.lang.IllegalArgumentException -
  +     * If invalid or unsupported XML/Java type is specified
        */
       public DeserializerFactory getDeserializer(Class javaType, QName xmlType)
           throws JAXRPCException;
  @@ -140,8 +154,10 @@
        * @param javaType - Class of the Java type
        * @param xmlType - Qualified name of the XML data type
        *
  -     * @throws JAXRPCException - If there is error in removing the registered SerializerFactory 
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * @throws JAXRPCException - If there is error 
  +     * in removing the registered SerializerFactory 
  +     * java.lang.IllegalArgumentException -
  +     * If invalid or unsupported XML/Java type is specified
        */
       public void removeSerializer(Class javaType, QName xmlType)
           throws JAXRPCException;
  @@ -153,8 +169,10 @@
        * @param javaType - Class of the Java type
        * @param xmlType - Qualified name of the XML data type
        *
  -     * @throws JAXRPCException - If there is error in removing the registered DeserializerFactory
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * @throws JAXRPCException - If there is error in removing 
  +     * the registered DeserializerFactory
  +     * java.lang.IllegalArgumentException -
  +     * If invalid or unsupported XML/Java type is specified
        */
       public void removeDeserializer(Class javaType, QName xmlType)
           throws JAXRPCException;
  
  
  
  1.10      +21 -12    xml-axis/java/src/javax/xml/rpc/encoding/TypeMappingRegistry.java
  
  Index: TypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/javax/xml/rpc/encoding/TypeMappingRegistry.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TypeMappingRegistry.java	31 Jan 2002 03:26:08 -0000	1.9
  +++ TypeMappingRegistry.java	1 Feb 2002 22:08:25 -0000	1.10
  @@ -63,7 +63,7 @@
    * defines a registry for TypeMapping instances for 
    * the different encoding styles. 
    *
  - * @version 0.6
  + * @version 0.7
    */
   public interface TypeMappingRegistry extends java.io.Serializable {
   
  @@ -71,16 +71,17 @@
        * The method register adds a TypeMapping instance for a specific 
        * namespace                        
        *
  +     * @param namespaceURI
        * @param mapping - TypeMapping for specific type namespaces
  -     * @param namespaceURIs
        *
        * @throws JAXRPCException - If there is any error in the registration
        * of the TypeMapping for the specified namespace URI
        * java.lang.IllegalArgumentException - if an invalid namespace URI is specified
        */
  -    public void register(TypeMapping mapping, String[] namespaceURIs)
  +    public void register(String namespace, TypeMapping maping)
           throws JAXRPCException;
   
  +
       /**
        * The method register adds a default TypeMapping instance.  If a specific
        * TypeMapping is not found, the default TypeMapping is used.  
  @@ -95,6 +96,12 @@
           throws JAXRPCException;
   
       /**
  +     * Return the default TypeMapping
  +     * @return TypeMapping or null
  +     **/
  +    public javax.xml.rpc.encoding.TypeMapping getDefaultTypeMapping();
  +
  +    /**
        * Gets the TypeMapping namespace.  If not found, the default TypeMapping 
        * is returned.
        *
  @@ -104,12 +111,20 @@
       public TypeMapping getTypeMapping(String namespaceURI);
   
       /**
  -     * Removes the TypeMapping for the namespace.
  +     * Unregisters the TypeMapping for the namespace.
        *
        * @param namespaceURI - The namespace URI
        * @return The registered TypeMapping or null.
        */
  -    public TypeMapping removeTypeMapping(String namespaceURI);
  +    public TypeMapping unregisterTypeMapping(String namespaceURI);
  +
  +    /**
  +     * Remove TypeMapping by unregistering it from all namespaces.
  +     *
  +     * @param mapping - The mapping to remove
  +     * @return true if found and removed.  false if not found
  +     */
  +    public boolean removeTypeMapping(TypeMapping namespaceURI);
   
   
       /**
  @@ -124,19 +139,13 @@
        *
        * @return String[] containing names of all registered namespace URIs
        */
  -    public String[] getSupportedNamespaces();
  +    public String[] getRegisteredNamespaces();
   
   
       /**
        * Removes all registered TypeMappings from the registery                   
        */
       public void clear(String namespaceURI);
  -
  -    /**
  -     * Return the default TypeMapping
  -     * @return TypeMapping or null
  -     **/
  -    public javax.xml.rpc.encoding.TypeMapping getDefaultTypeMapping();
   
   }
   
  
  
  
  1.66      +3 -3      xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- Call.java	31 Jan 2002 03:26:08 -0000	1.65
  +++ Call.java	1 Feb 2002 22:08:25 -0000	1.66
  @@ -1095,10 +1095,10 @@
           try {
               if (tm == null || tm == defaultTM ) {
                   tm = (TypeMapping) tmr.createTypeMapping();
  -                tm.setSupportedEncodings(new String[] {Constants.URI_CURRENT_SOAP_ENC});
  -                tmr.register(tm, new String[] {Constants.URI_CURRENT_SOAP_ENC});
  +                tm.setSupportedNamespaces(new String[] {Constants.URI_CURRENT_SOAP_ENC});
  +                tmr.register(Constants.URI_CURRENT_SOAP_ENC, tm);
               }
  -            if (!force && tm.getClassForQName(xmlType) != null) 
  +            if (!force && tm.isRegistered(javaType, xmlType)) 
                   return;
   
               // Register the information
  
  
  
  1.21      +2 -2      xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java
  
  Index: WSDDDeployment.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WSDDDeployment.java	31 Jan 2002 21:10:32 -0000	1.20
  +++ WSDDDeployment.java	1 Feb 2002 22:08:25 -0000	1.21
  @@ -269,8 +269,8 @@
                   if (mapping.getEncodingStyle() == null) {
                       namespace = Constants.URI_CURRENT_SOAP_ENC;
                   }
  -                tm.setSupportedEncodings(new String[] {namespace});
  -                tmr.register(tm, new String[] {namespace});
  +                tm.setSupportedNamespaces(new String[] {namespace});
  +                tmr.register(namespace, tm);
               }
   
               SerializerFactory   ser   = null;
  
  
  
  1.35      +2 -2      xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
  
  Index: WSDDService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- WSDDService.java	31 Jan 2002 03:26:08 -0000	1.34
  +++ WSDDService.java	1 Feb 2002 22:08:25 -0000	1.35
  @@ -278,8 +278,8 @@
                   if (mapping.getEncodingStyle() == null) {
                       namespace = Constants.URI_CURRENT_SOAP_ENC;
                   }
  -                tm.setSupportedEncodings(new String[] {namespace});
  -                tmr.register(tm, new String[] {namespace});
  +                tm.setSupportedNamespaces(new String[] {namespace});
  +                tmr.register(namespace, tm);
               }
               
               SerializerFactory   ser   = null;
  
  
  
  1.7       +187 -116  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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultTypeMappingImpl.java	1 Feb 2002 04:38:18 -0000	1.6
  +++ DefaultTypeMappingImpl.java	1 Feb 2002 22:08:25 -0000	1.7
  @@ -89,7 +89,8 @@
    * @author Rich Scheuerle (scheu@us.ibm.com)
    * 
    * This is the implementation of the axis Default TypeMapping (which extends
  - * the JAX-RPC TypeMapping interface).
  + * the JAX-RPC TypeMapping interface) for SOAP 1.1.  If you want the JAX-RPC
  + * SOAP 1.2 Type Mapping the use DefaultJAXRPCTypeMapping.
    * 
    * A TypeMapping is obtained from the singleton TypeMappingRegistry using
    * the namespace of the webservice.  The TypeMapping contains the tuples
  @@ -120,126 +121,163 @@
           return tm;
       }
   
  -    private DefaultTypeMappingImpl() {
  +    protected DefaultTypeMappingImpl() {
           super(null);
           delegate = null;
   
           // Notes:
  -        // 1) If the soap11Ser flag is set, then the SOAP 1.1 format is sent
  -        //    over the wire.  Otherwise SOAP 1.2 format is used over the wire.
  -        // 2) The registration statements are order dependent.  The last one
  -        //    wins.  So if two javaTypes of String are registered, the serializer
  -        //    factory for the last one registered will be chosen.  Likewise
  +        // 1) The registration statements are order dependent.  The last one
  +        //    wins.  So if two javaTypes of String are registered, the 
  +        //    ser factory for the last one registered will be chosen.  Likewise
           //    if two javaTypes for XSD_DATE are registered, the deserializer 
           //    factory for the last one registered will be chosen.
  -        // 3) Even if the SOAP 1.1 format is used over the wire, an 
  +        // 2) Even if the SOAP 1.1 format is used over the wire, an 
           //    attempt is made to receive SOAP 1.2 format from the wire.
           //    This is the reason why the soap encoded primitives are 
           //    registered without serializers.
  -        boolean soap11Ser =  Constants.URI_CURRENT_SOAP_ENC.equals(Constants.URI_SOAP_ENC);
  -
  -        // SOAP Encoded strings are treated as primitives.  Everything else is not.
  -        // Note that only deserializing is supported if we are flowing SOAP 1.1 over the wire
  -        myRegister(Constants.SOAP_STRING,     java.lang.String.class,     null, null, true, soap11Ser); 
  -        myRegister(Constants.SOAP_BOOLEAN,    java.lang.Boolean.class,    null, null, false, soap11Ser);
  -        myRegister(Constants.SOAP_DOUBLE,     java.lang.Double.class,     null, null, false, soap11Ser);
  -        myRegister(Constants.SOAP_FLOAT,      java.lang.Float.class,      null, null, false, soap11Ser);
  -        myRegister(Constants.SOAP_INT,        java.lang.Integer.class,    null, null, false, soap11Ser);
  -        myRegister(Constants.SOAP_INTEGER,    java.math.BigInteger.class, null, null, false, soap11Ser);
  -        myRegister(Constants.SOAP_DECIMAL,    java.math.BigDecimal.class, null, null, false, soap11Ser);
  -        myRegister(Constants.SOAP_LONG,       java.lang.Long.class,       null, null, false, soap11Ser);
  -        myRegister(Constants.SOAP_SHORT,      java.lang.Short.class,      null, null, false, soap11Ser);
  -        myRegister(Constants.SOAP_BYTE,       java.lang.Byte.class,       null, null, false, soap11Ser);
   
  +        // SOAP Encoded strings are treated as primitives. 
  +        // Everything else is not.
  +        // Note that only deserializing is supported since we are flowing
  +        // SOAP 1.1 over the wire.
  +        myRegister(Constants.SOAP_STRING,     java.lang.String.class,   
  +                   null, null, true,  true); 
  +        myRegister(Constants.SOAP_BOOLEAN,    java.lang.Boolean.class, 
  +                   null, null, false, true);
  +        myRegister(Constants.SOAP_DOUBLE,     java.lang.Double.class,  
  +                   null, null, false, true);
  +        myRegister(Constants.SOAP_FLOAT,      java.lang.Float.class,  
  +                   null, null, false, true);
  +        myRegister(Constants.SOAP_INT,        java.lang.Integer.class,   
  +                   null, null, false, true);
  +        myRegister(Constants.SOAP_INTEGER,    java.math.BigInteger.class,
  +                   null, null, false, true);
  +        myRegister(Constants.SOAP_DECIMAL,    java.math.BigDecimal.class,
  +                   null, null, false, true);
  +        myRegister(Constants.SOAP_LONG,       java.lang.Long.class,     
  +                   null, null, false, true);
  +        myRegister(Constants.SOAP_SHORT,      java.lang.Short.class,   
  +                   null, null, false, true);
  +        myRegister(Constants.SOAP_BYTE,       java.lang.Byte.class,     
  +                   null, null, false, true);
   
           // SOAP 1.1
           // byte[] -ser-> XSD_BASE64
           // Byte[] -ser-> array of Byte
           // XSD_BASE64 -deser-> byte[]
           // SOAP_BASE64 -deser->byte[]
  -        //
  -        // SOAP 1.2
  -        // byte[] -ser-> XSD_BASE64
  -        // Byte[] -ser-> SOAP_BASE64
  -        // XSD_BASE64 -deser-> byte[]
  -        // SOAP_BASE64 -deser->Byte[]
  -        if (soap11Ser) {
  -            myRegister(Constants.SOAP_BASE64,     byte[].class, 
  -                       new Base64SerializerFactory(byte[].class,Constants.SOAP_BASE64 ),
  -                       new Base64DeserializerFactory(byte[].class,Constants.SOAP_BASE64),
  -                       true, true);      
  -            myRegister(Constants.SOAP_ARRAY,     java.lang.Byte[].class,       
  -                       new ArraySerializerFactory(),
  -                       new ArrayDeserializerFactory(),true);
  -        } else {
  -            myRegister(Constants.SOAP_BASE64,     java.lang.Byte[].class,     
  -                       new Base64SerializerFactory(java.lang.Byte[].class,Constants.SOAP_BASE64 ),
  -                       new Base64DeserializerFactory(java.lang.Byte[].class, Constants.SOAP_BASE64),
  -                       true);
  -        }
  +        myRegister(Constants.SOAP_BASE64,     byte[].class, 
  +                   new Base64SerializerFactory(byte[].class,
  +                                               Constants.SOAP_BASE64 ),
  +                   new Base64DeserializerFactory(byte[].class,
  +                                                 Constants.SOAP_BASE64),
  +                   true, true);      
  +        myRegister(Constants.SOAP_ARRAY,     java.lang.Byte[].class,       
  +                   new ArraySerializerFactory(),
  +                   new ArrayDeserializerFactory(),true);
           myRegister(Constants.XSD_BASE64,     byte[].class,                                   
  -                   new Base64SerializerFactory(byte[].class,Constants.XSD_BASE64 ),
  -                   new Base64DeserializerFactory(byte[].class,Constants.XSD_BASE64),true);
  -
  -
  -        if (soap11Ser) {
  -            // If SOAP 1.1 over the wire, then map wrapper classes to XSD primitives.
  -            // 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);
  -        }
  +                   new Base64SerializerFactory(byte[].class,
  +                                               Constants.XSD_BASE64 ),
  +                   new Base64DeserializerFactory(byte[].class,
  +                                           Constants.XSD_BASE64),true);
  +
  +
  +        // If SOAP 1.1 over the wire, map wrapper classes to XSD primitives.
  +        // 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);
   
           // The XSD Primitives are mapped to java primitives.
  -        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_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),true);
  -        myRegister(Constants.XSD_ANYTYPE,    java.lang.Object.class,     null, null, false);
  -
  -        // The xsd primitive for date has changed through the various namespace versions.
  -        // XSD_DATE is the current one, which is why it is registered after the other two
  +        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_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),
  +                   true);
  +        myRegister(Constants.XSD_ANYTYPE,    java.lang.Object.class,  
  +                   null, null, false);
  +
  +        // The xsd primitive for date has changed through the various 
  +        // namespace versions.
  +        // XSD_DATE is the current one, which is why it is 
  +        // registered after the other two
           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),true);
  +                   new DateSerializerFactory(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),true);
  +                   new DateSerializerFactory(java.util.Date.class, 
  +                                             Constants.XSD_DATE3),
  +                   new DateDeserializerFactory(java.util.Date.class,
  +                                               Constants.XSD_DATE3),
  +                   true);
           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),true);
  +                   new DateSerializerFactory(java.util.Date.class,
  +                                             Constants.XSD_DATE),
  +                   new DateDeserializerFactory(java.util.Date.class,
  +                                               Constants.XSD_DATE),
  +                   true);
           myRegister(Constants.XSD_HEXBIN,     Hex.class,   
                      new HexSerializerFactory(),
                      new HexDeserializerFactory(),true);
   
  -        // Use the Map Serialization for both Hashtables, Map and HashMap objects
  +        // Use the Map Serialization for Hashtables, Map and HashMap
           // The SOAP_MAP will be deserialized into a HashMap
           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), false);
  +                   new MapSerializerFactory(java.util.Hashtable.class,
  +                                            Constants.SOAP_MAP),
  +                   new MapDeserializerFactory(java.util.Hashtable.class,
  +                                              Constants.SOAP_MAP), 
  +                   false);
           myRegister(Constants.SOAP_MAP,       java.util.Map.class,    
  -                   new MapSerializerFactory(java.util.Map.class,Constants.SOAP_MAP),
  -                   new MapDeserializerFactory(java.util.Map.class,Constants.SOAP_MAP), false);
  +                   new MapSerializerFactory(java.util.Map.class,
  +                                            Constants.SOAP_MAP),
  +                   new MapDeserializerFactory(java.util.Map.class,
  +                                              Constants.SOAP_MAP), 
  +                   false);
           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), false);
  +                   new MapSerializerFactory(java.util.HashMap.class,
  +                                            Constants.SOAP_MAP),
  +                   new MapDeserializerFactory(java.util.HashMap.class,
  +                                              Constants.SOAP_MAP), 
  +                   false);
   
           // Use the Element Serializeration for elements
           myRegister(Constants.SOAP_ELEMENT,   org.w3c.dom.Element.class,    
  @@ -247,19 +285,25 @@
                      new ElementDeserializerFactory(), false);
           myRegister(Constants.SOAP_VECTOR,    java.util.Vector.class,             
                      null,
  -                   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.
  -        // Internally the runtime uses ArrayList objects to hold arrays...which is 
  -        // the reason that ArrayList is associated with SOAP_ARRAY.  In addition, handle
  -        // all objects that implement the List interface as a SOAP_ARRAY
  +                   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.
  +        // Internally the runtime uses ArrayList objects to hold arrays...
  +        // which is the reason that ArrayList is associated with SOAP_ARRAY.  
  +        // In addition, handle all objects that implement the List interface
  +        //as a SOAP_ARRAY
           myRegister(Constants.SOAP_ARRAY,     java.util.List.class,               
                      new ArraySerializerFactory(),
  -                   new ArrayDeserializerFactory(), false);
  +                   new ArrayDeserializerFactory(), 
  +                   false);
           myRegister(Constants.SOAP_ARRAY,     java.util.ArrayList.class,               
                      new ArraySerializerFactory(),
  -                   new ArrayDeserializerFactory(), false);
  +                   new ArrayDeserializerFactory(), 
  +                   false);
       }
   
       /**
  @@ -267,26 +311,29 @@
        * known xmlType namespaces
        * @param xmlType is the QName type
        * @param javaType is the java type
  -     * @param sf is the serializer factory (if null, the simple factory is used)
  -     * @param df is the deserializer factory (if null, the simple factory is used)
  -     * @param primitive indicates whether the item is a primitive (allows for sharing of serializers)
  +     * @param sf is the ser factory (if null, the simple factory is used)
  +     * @param df is the deser factory (if null, the simple factory is used)
  +     * @param primitive indicates whether serializers can be shared
        * @param onlyDeserFactory indicates if only deserialization is desired.
        */   
       protected void myRegister(QName xmlType, Class javaType,
  -                              SerializerFactory sf, DeserializerFactory df, boolean primitive) {
  +                              SerializerFactory sf, DeserializerFactory df,
  +                              boolean primitive) {
           myRegister(xmlType, javaType, sf, df, primitive, false);
       }
       protected void myRegister(QName xmlType, Class javaType,
                                 SerializerFactory sf, DeserializerFactory df, 
                                 boolean primitive, boolean onlyDeserFactory) {
   
  -        // If factories are not specified, use the Simple serializer/deserializer factories.
  +        // If factories are not specified, use the Simple ser/deser factories.
           if (sf == null && df == null) {
               if (!onlyDeserFactory) {
                   if (primitive) {
  -                    sf = new SimplePrimitiveSerializerFactory(javaType, xmlType);
  +                    sf = new SimplePrimitiveSerializerFactory(javaType,
  +                                                              xmlType);
                   } else {
  -                    sf = new SimpleNonPrimitiveSerializerFactory(javaType, xmlType);
  +                    sf = new SimpleNonPrimitiveSerializerFactory(javaType,
  +                                                                 xmlType);
                   }
               }
               df = new SimpleDeserializerFactory(javaType, xmlType);
  @@ -297,21 +344,25 @@
           
           // Register all known flavors of the namespace.
           try {
  -            if (xmlType.getNamespaceURI().equals(Constants.URI_CURRENT_SCHEMA_XSD)) {
  +            if (xmlType.getNamespaceURI().equals(
  +                       Constants.URI_CURRENT_SCHEMA_XSD)) {
                   for (int i=0; i < Constants.URIS_SCHEMA_XSD.length; i++) {
  -                    QName qName = new QName(Constants.URIS_SCHEMA_XSD[i], xmlType.getLocalPart());
  -                    register(javaType, qName, sf, df);
  +                    QName qName = new QName(Constants.URIS_SCHEMA_XSD[i],
  +                                            xmlType.getLocalPart());
  +                    super.register(javaType, qName, sf, df);
                   }
               }
  -            else if (xmlType.getNamespaceURI().equals(Constants.URI_CURRENT_SOAP_ENC)) {
  +            else if (xmlType.getNamespaceURI().equals(
  +                       Constants.URI_CURRENT_SOAP_ENC)) {
                   for (int i=0; i < Constants.URIS_SOAP_ENC.length; i++) {
  -                    QName qName = new QName(Constants.URIS_SOAP_ENC[i], xmlType.getLocalPart());
  -                    register(javaType, qName, sf, df);
  +                    QName qName = new QName(Constants.URIS_SOAP_ENC[i],
  +                                            xmlType.getLocalPart());
  +                    super.register(javaType, qName, sf, df);
                   }
               }
  -            // Register with the specified xmlType.  This is the prefered mapping and
  -            // the last registered mapping wins.
  -            register(javaType, xmlType, sf, df);
  +            // Register with the specified xmlType. 
  +            // This is the prefered mapping and the last registed one wins
  +            super.register(javaType, xmlType, sf, df);
           } catch (Exception e) {}
       }
   
  @@ -331,5 +382,25 @@
               xmlType = Constants.SOAP_ARRAY;
           }
           return xmlType;
  +    }
  +
  +    // Don't allow anyone to muck with the default type mapping because
  +    // it is a singleton used for the whole system.
  +    public void register(Class javaType, QName xmlType, 
  +                         javax.xml.rpc.encoding.SerializerFactory sf,
  +                         javax.xml.rpc.encoding.DeserializerFactory dsf) 
  +        throws JAXRPCException {        
  +
  +        throw new JAXRPCException();
  +    }
  +    public void removeSerializer(Class javaType, QName xmlType)
  +        throws JAXRPCException {
  +        throw new JAXRPCException();
  +    }
  +    public void removeDeserializer(Class javaType, QName xmlType)
  +        throws JAXRPCException {
  +        throw new JAXRPCException();
  +    }
  +    public void setSupportedNamespaces(String[] namespaceURIs) {
       }
   }
  
  
  
  1.3       +15 -5     xml-axis/java/src/org/apache/axis/encoding/TypeMapping.java
  
  Index: TypeMapping.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/TypeMapping.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TypeMapping.java	31 Jan 2002 03:26:09 -0000	1.2
  +++ TypeMapping.java	1 Feb 2002 22:08:26 -0000	1.3
  @@ -66,7 +66,8 @@
   /**
    * This interface describes the AXIS TypeMapping.
    */
  -public interface TypeMapping extends javax.xml.rpc.encoding.TypeMapping {
  +public interface TypeMapping 
  +    extends javax.xml.rpc.encoding.TypeMapping {
   
       /**
        * setDelegate sets the new Delegate TypeMapping
  @@ -74,6 +75,11 @@
       public void setDelegate(TypeMapping delegate);
   
       /**
  +     * getDelegate gets the new Delegate TypeMapping
  +     */
  +    public TypeMapping getDelegate();
  +
  +    /**
        * Gets the SerializerFactory registered for the specified pair
        * of Java type and XML data type.
        *
  @@ -83,9 +89,11 @@
        *
        * @throws JAXRPCException - If there is no registered SerializerFactory 
        * for this pair of Java type and XML data type 
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * java.lang.IllegalArgumentException  
  +     * If invalid or unsupported XML/Java type is specified
        */
  -    public SerializerFactory getSerializer(Class javaType)  throws JAXRPCException;
  +    public SerializerFactory getSerializer(Class javaType) 
  +        throws JAXRPCException;
   
       /**
        * Gets the DeserializerFactory registered for the specified pair 
  @@ -98,9 +106,11 @@
        *
        * @throws JAXRPCException - If there is no registered DeserializerFactory
        * for this pair of Java type and  XML data type 
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * java.lang.IllegalArgumentException - 
  +     * If invalid or unsupported XML/Java type is specified
        */
  -    public DeserializerFactory getDeserializer(QName xmlType)  throws JAXRPCException;
  +    public DeserializerFactory getDeserializer(QName xmlType) 
  +        throws JAXRPCException;
   
       /**
        * Gets the QName for the type mapped to Class.
  
  
  
  1.5       +66 -18    xml-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java
  
  Index: TypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TypeMappingImpl.java	31 Jan 2002 21:01:32 -0000	1.4
  +++ TypeMappingImpl.java	1 Feb 2002 22:08:26 -0000	1.5
  @@ -80,9 +80,10 @@
    * information for each of these will be accessed via the TypeMapping.
    *
    * Because every web service uses the soap, schema, wsdl primitives, we could 
  - * pre-populate the TypeMapping with these standard tuples.  Instead, if requested
  - * namespace/class matches is not found in the TypeMapping but matches one these
  - * known primitives, the request is delegated to the Default TypeMapping or another TypeMapping
  + * pre-populate the TypeMapping with these standard tuples.  Instead, 
  + * if the namespace/class matches is not found in the TypeMapping 
  + * the request is delegated to the 
  + * Default TypeMapping or another TypeMapping
    * 
    */
   public class TypeMappingImpl implements TypeMapping { 
  @@ -141,6 +142,13 @@
           this.delegate = delegate;
       }
   
  +    /**
  +     * getDelegate gets the new Delegate TypeMapping
  +     */
  +    public TypeMapping getDelegate() {
  +        return delegate;
  +    }
  +
       /********* JAX-RPC Compliant Method Definitions *****************/
       
       /**
  @@ -149,7 +157,7 @@
        * @return  String[] of namespace URIs for the supported encoding 
        * styles and XML schema namespaces.
        */
  -    public String[] getSupportedEncodings() {
  +    public String[] getSupportedNamespaces() {
           return (String[]) namespaces.toArray();
       }
   
  @@ -160,7 +168,7 @@
        *
        * @param namespaceURIs String[] of namespace URI's                
        */
  -    public void setSupportedEncodings(String[] namespaceURIs) {
  +    public void setSupportedNamespaces(String[] namespaceURIs) {
           namespaces.clear();
           for (int i =0; i< namespaceURIs.length; i++) {
               if (!namespaces.contains(namespaceURIs[i])) {
  @@ -168,6 +176,33 @@
               }
           }
       }
  +
  +    /**
  +     * isRegistered returns true if the [javaType, xmlType]
  +     * pair is registered.
  +     * @param javaType - Class of the Java type
  +     * @param xmlType - Qualified name of the XML data type
  +     * @return: false if either javaType or xmlType is null
  +     * or if the pair is not specifically registered.
  +     * For example if called with (java.lang.String[], soapenc:Array)
  +     * this routine will return false because this pair is
  +     * probably not specifically registered.
  +     * However if getSerializer is called with the same pair,
  +     * the default TypeMapping will use extra logic to find
  +     * a serializer (i.e. array serializer)
  +     */
  +    public boolean isRegistered(Class javaType, QName xmlType) {
  +        if (javaType == null || xmlType == null) {
  +            return false;
  +        }
  +        if (pair2SF.keySet().contains(new Pair(javaType, xmlType))) {
  +            return true;
  +        }
  +        if (delegate != null) {
  +            return delegate.isRegistered(javaType, xmlType);
  +        }
  +        return false;
  +    }
       
       /**
        * Registers SerializerFactory and DeserializerFactory for a 
  @@ -182,7 +217,8 @@
        */
       public void register(Class javaType, QName xmlType, 
                            javax.xml.rpc.encoding.SerializerFactory sf,
  -                         javax.xml.rpc.encoding.DeserializerFactory dsf) throws JAXRPCException {        
  +                         javax.xml.rpc.encoding.DeserializerFactory dsf) 
  +        throws JAXRPCException {        
   
           //if (xmlType.getNamespaceURI() == null ||
           //    xmlType.getNamespaceURI().equals("") ||
  @@ -218,9 +254,11 @@
        *
        * @throws JAXRPCException - If there is no registered SerializerFactory 
        * for this pair of Java type and XML data type 
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * java.lang.IllegalArgumentException -
  +     * If invalid or unsupported XML/Java type is specified
        */
  -    public javax.xml.rpc.encoding.SerializerFactory getSerializer(Class javaType, QName xmlType)
  +    public javax.xml.rpc.encoding.SerializerFactory 
  +        getSerializer(Class javaType, QName xmlType)
           throws JAXRPCException
       {
           SerializerFactory sf = null;
  @@ -245,11 +283,13 @@
               }
           }
           if (sf == null && delegate != null) {
  -            sf = (SerializerFactory) delegate.getSerializer(javaType, xmlType);
  +            sf = (SerializerFactory) 
  +                delegate.getSerializer(javaType, xmlType);
           }
           return sf;
       }
  -    public javax.xml.rpc.encoding.SerializerFactory getSerializer(Class javaType) 
  +    public javax.xml.rpc.encoding.SerializerFactory 
  +        getSerializer(Class javaType) 
           throws JAXRPCException 
       {
           return getSerializer(javaType, null);
  @@ -266,9 +306,11 @@
        *
        * @throws JAXRPCException - If there is no registered DeserializerFactory
        * for this pair of Java type and  XML data type 
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * java.lang.IllegalArgumentException - 
  +     * If invalid or unsupported XML/Java type is specified
        */
  -    public javax.xml.rpc.encoding.DeserializerFactory getDeserializer(Class javaType, QName xmlType)
  +    public javax.xml.rpc.encoding.DeserializerFactory
  +        getDeserializer(Class javaType, QName xmlType)
           throws JAXRPCException {
           DeserializerFactory df = null;
           Pair pair = new Pair(javaType, xmlType);
  @@ -279,11 +321,13 @@
               df = (DeserializerFactory) pair2DF.get(pair);
           } 
           if (df == null && delegate != null) {
  -            df = (DeserializerFactory) delegate.getDeserializer(javaType, xmlType);
  +            df = (DeserializerFactory) 
  +                delegate.getDeserializer(javaType, xmlType);
           }
           return df;
       }
  -    public javax.xml.rpc.encoding.DeserializerFactory getDeserializer(QName xmlType)
  +    public javax.xml.rpc.encoding.DeserializerFactory 
  +        getDeserializer(QName xmlType)
           throws JAXRPCException {
           return getDeserializer(null, xmlType);
       }
  @@ -295,8 +339,10 @@
        * @param javaType - Class of the Java type
        * @param xmlType - Qualified name of the XML data type
        *
  -     * @throws JAXRPCException - If there is error in removing the registered SerializerFactory 
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * @throws JAXRPCException - If there is error in 
  +     * removing the registered SerializerFactory 
  +     * java.lang.IllegalArgumentException - 
  +     * If invalid or unsupported XML/Java type is specified
        */
       public void removeSerializer(Class javaType, QName xmlType)
           throws JAXRPCException {
  @@ -311,8 +357,10 @@
        * @param javaType - Class of the Java type
        * @param xmlType - Qualified name of the XML data type
        *
  -     * @throws JAXRPCException - If there is error in removing the registered DeserializerFactory
  -     * java.lang.IllegalArgumentException - If invalid or unsupported XML/Java type is specified
  +     * @throws JAXRPCException - If there is error in 
  +     * removing the registered DeserializerFactory
  +     * java.lang.IllegalArgumentException - 
  +     * If invalid or unsupported XML/Java type is specified
        */
       public void removeDeserializer(Class javaType, QName xmlType)
           throws JAXRPCException {
  
  
  
  1.50      +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.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- TypeMappingRegistry.java	31 Jan 2002 03:26:09 -0000	1.49
  +++ TypeMappingRegistry.java	1 Feb 2002 22:08:26 -0000	1.50
  @@ -59,7 +59,8 @@
   /**
    * This interface describes the AXIS TypeMappingRegistry.
    */
  -public interface TypeMappingRegistry extends javax.xml.rpc.encoding.TypeMappingRegistry {
  +public interface TypeMappingRegistry 
  +    extends javax.xml.rpc.encoding.TypeMappingRegistry {
       /**
        * delegate
        *
  
  
  
  1.5       +191 -40   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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TypeMappingRegistryImpl.java	31 Jan 2002 03:26:09 -0000	1.4
  +++ TypeMappingRegistryImpl.java	1 Feb 2002 22:08:26 -0000	1.5
  @@ -72,18 +72,114 @@
    * @author Sam Ruby (rubys@us.ibm.com)
    * Re-written for JAX-RPC Compliance by
    * @author Rich Scheuerle (scheu@us.ibm.com
  + *
  + * The TypeMappingRegistry keeps track of the individual TypeMappings.
  + * 
  + * The TypeMappingRegistry for axis contains a default type mapping
  + * that is set for either SOAP 1.1 or SOAP 1.2
  + * The default type mapping is a singleton used for the entire
  + * runtime and should not have anything new registered in it.
  + *
  + * Instead the new TypeMappings for the deploy and service are
  + * made in a separate TypeMapping which is identified by
  + * the soap encoding.  These new TypeMappings delegate back to 
  + * the default type mapping when information is not found.
  + *
  + * So logically we have:
  + *
  + *         TMR
  + *         | |  
  + *         | +---------------> DefaultTM 
  + *         |                      ^
  + *         |                      |
  + *         +----> TM --delegate---+
  + *
  + *
  + * But in the implementation, the TMR references
  + * "delegate" TypeMappings (TM') which then reference the actual TM's
  + *
  + * So the picture is really:
  + *         TMR
  + *         | |  
  + *         | +-----------TM'------> DefaultTM 
  + *         |              ^
  + *         |              |
  + *         +-TM'-> TM ----+
  + *
  + * This extra indirection is necessary because the user may want to 
  + * change the default type mapping.  In such cases, the TMR
  + * just needs to adjust the TM' for the DefaultTM, and all of the
  + * other TMs will properly delegate to the new one.  Here's the picture:
  + *
  + *         TMR
  + *         | |  
  + *         | +-----------TM'--+     DefaultTM 
  + *         |              ^   |
  + *         |              |   +---> New User Defined Default TM
  + *         +-TM'-> TM ----+
  + *
  + * The other reason that it is necessary is when a deploy
  + * has a TMR, and then TMR's are defined for the individual services
  + * in such cases the delegate() method is invoked on the service
  + * to delegate to the deploy TMR
  + *
  + *       Deploy TMR
  + *         | |  
  + *         | +-----------TM'------> DefaultTM 
  + *         |              ^
  + *         |              |
  + *         +-TM'-> TM ----+
  + *
  + *       Service TMR
  + *         | |  
  + *         | +-----------TM'------> DefaultTM 
  + *         |              ^
  + *         |              |
  + *         +-TM'-> TM ----+
  + *
  + *    ServiceTMR.delegate(DeployTMR)
  + *
  + *       Deploy TMR
  + *         | |  
  + *         | +------------TM'------> DefaultTM 
  + *         |              ^ ^ 
  + *         |              | |
  + *         +-TM'-> TM ----+ |
  + *           ^              |
  + *   +-------+              |
  + *   |                      |
  + *   |   Service TMR        |
  + *   |     | |              |
  + *   |     | +----------TM'-+               
  + *   |     |              
  + *   |     |              
  + *   |     +-TM'-> TM +
  + *   |                |
  + *   +----------------+
  + *
  + * So now the service uses the DefaultTM of the Deploy TMR, and
  + * the Service TM properly delegates to the deploy's TM.  And
  + * if either the deploy defaultTM or TMs change, the links are not broken.
    */
   public class TypeMappingRegistryImpl implements TypeMappingRegistry { 
       
  -    private HashMap mapTM;          // Type Mappings keyed by the Web Service Namespace URI
  -    private TypeMapping defaultTM;  // Default Type Mapping 
  -    
  +    private HashMap mapTM;          // Type Mappings keyed with Namespace URI
  +    private TypeMapping defaultDelTM;  // Delegate to default Type Mapping 
  +
  +
  +
       /**
        * Construct TypeMappingRegistry
        */
       public TypeMappingRegistryImpl() {
           mapTM = new HashMap();
  -        defaultTM = DefaultTypeMappingImpl.create();
  +        if (Constants.URI_CURRENT_SOAP_ENC.equals(Constants.URI_SOAP_ENC)) {
  +            defaultDelTM = 
  +                new TypeMappingImpl(DefaultTypeMappingImpl.create()); 
  +        } else {
  +            defaultDelTM = 
  +                new TypeMappingImpl(DefaultSOAP12TypeMappingImpl.create()); 
  +        }
       }
       
       /**
  @@ -93,25 +189,27 @@
        * their corresponding types in the secondary TMR.
        */
       public void delegate(TypeMappingRegistry secondaryTMR) {
  -        if (secondaryTMR != null && secondaryTMR != this) {
  -            if (defaultTM != null) {
  -                defaultTM = (TypeMapping) secondaryTMR.getDefaultTypeMapping();
  -            }
  +
  +        if (secondaryTMR == null || secondaryTMR == this) {
  +            return;
           }
  -        String[]  keys = secondaryTMR.getSupportedNamespaces();
  +        String[]  keys = secondaryTMR.getRegisteredNamespaces();
           if (keys != null) {
               for(int i=0; i < keys.length; i++) {
                   try {
                       String nsURI = keys[i];
  -                    TypeMapping tm = (TypeMapping) mapTM.get(nsURI);
  -                    if (tm == null) {
  +                    TypeMapping tm = (TypeMapping) getTypeMapping(nsURI);
  +                    if (tm == null || tm == getDefaultTypeMapping() ) {
                           tm = (TypeMapping) createTypeMapping();
  -                        tm.setSupportedEncodings(new String[] { nsURI });
  -                        mapTM.put(nsURI, tm);
  +                        tm.setSupportedNamespaces(new String[] { nsURI });
  +                        register(nsURI, tm);
                       }
                       
                       if (tm != null) {
  -                        TypeMapping del = (TypeMapping) secondaryTMR.getTypeMapping(nsURI);
  +                        // Get the secondaryTMR's TM'
  +                        TypeMapping del = (TypeMapping)
  +                            ((TypeMappingRegistryImpl)
  +                             secondaryTMR).mapTM.get(nsURI);
                           tm.setDelegate(del);
                       }
                       
  @@ -119,6 +217,12 @@
                   }
               }
           }
  +        // Change our defaultDelTM to delegate to the one in 
  +        // the secondaryTMR
  +        if (defaultDelTM != null) {
  +            defaultDelTM.setDelegate(
  +            ((TypeMappingRegistryImpl)secondaryTMR).defaultDelTM);
  +        }
           
       }            
               
  @@ -130,25 +234,34 @@
        * The method register adds a TypeMapping instance for a specific 
        * namespace                 
        *
  +     * @param namespaceURI 
        * @param mapping - TypeMapping for specific namespaces
  -     * @param namespaceURIs 
        *
        * @throws JAXRPCException - If there is any error in the registration
        * of the TypeMapping for the specified namespace URI
  -     * java.lang.IllegalArgumentException - if an invalid namespace URI is specified
  +     * java.lang.IllegalArgumentException -
  +     * if an invalid namespace URI is specified
        */
  -    public void register(javax.xml.rpc.encoding.TypeMapping mapping, String[] namespaceURIs)
  +    public void register(String namespaceURI,
  +                         javax.xml.rpc.encoding.TypeMapping mapping)
           throws JAXRPCException {
           if (mapping == null || 
               !(mapping instanceof TypeMapping)) {
               throw new IllegalArgumentException();
           } 
  -        for (int i = 0; i < namespaceURIs.length; i++) {
  -            if (namespaceURIs[i] == null) {
  -                throw new java.lang.IllegalArgumentException();
  -            }
  -            mapTM.put(namespaceURIs[i], mapping);
  -        }            
  +        if (namespaceURI == null) {
  +            throw new java.lang.IllegalArgumentException();
  +        }
  +        // Get or create a TypeMappingDelegate and set it to 
  +        // delegate to the new mapping.
  +        TypeMappingDelegate del = (TypeMappingDelegate)
  +            mapTM.get(namespaceURI);
  +        if (del == null) {
  +            del = new TypeMappingDelegate((TypeMapping) mapping);
  +            mapTM.put(namespaceURI, del);
  +        } else {
  +            del.setDelegate((TypeMapping) mapping);
  +        }
       }
       
       /**
  @@ -157,50 +270,86 @@
        *
        * @param mapping - TypeMapping for specific type namespaces
        *
  -     * java.lang.IllegalArgumentException - if an invalid namespace URI is specified
  +     * java.lang.IllegalArgumentException - 
  +     * if an invalid namespace URI is specified
        */
       public void registerDefault(javax.xml.rpc.encoding.TypeMapping mapping) {
           if (mapping == null || 
  -            !(mapping instanceof TypeMapping)) {
  +            !(mapping instanceof TypeMapping) ||
  +            // Don't allow this call after the delegate() method since
  +            // the TMR's TypeMappings will be using the default type mapping
  +            // of the secondary TMR.
  +            defaultDelTM.getDelegate() instanceof TypeMappingDelegate) {
               throw new IllegalArgumentException();
           }
  -        defaultTM = (TypeMapping) mapping;
  +        defaultDelTM.setDelegate((TypeMapping) mapping);
       }
           
       /**
  -     * Gets the TypeMapping for the namespace.  If not found, the default TypeMapping 
  -     * is returned.
  +     * Gets the TypeMapping for the namespace.  If not found, the default
  +     * TypeMapping is returned.
        *
        * @param namespaceURI - The namespace URI of a Web Service
  -     * @return The registered TypeMapping (which may be the default TypeMapping) or null.
  +     * @return The registered TypeMapping 
  +     * (which may be the default TypeMapping) or null.
        */
  -    public javax.xml.rpc.encoding.TypeMapping getTypeMapping(String namespaceURI) {
  -        TypeMapping tm = (TypeMapping) mapTM.get(namespaceURI);
  +    public javax.xml.rpc.encoding.TypeMapping 
  +        getTypeMapping(String namespaceURI) {
  +        TypeMapping del = (TypeMapping) mapTM.get(namespaceURI);
  +        TypeMapping tm = null;
  +        if (del != null) {
  +            tm = del.getDelegate();
  +        }
           if (tm == null) {
  -            tm = defaultTM;
  +            tm = (TypeMapping)getDefaultTypeMapping();
           }
           return tm;
       }
   
       /**
  -     * Removes the TypeMapping for the namespace.
  +     * Unregisters the TypeMapping for the namespace.
        *
        * @param namespaceURI - The namespace URI
        * @return The registered TypeMapping .
        */
  -    public javax.xml.rpc.encoding.TypeMapping removeTypeMapping(String namespaceURI) {
  -        TypeMapping tm = (TypeMapping) mapTM.remove(namespaceURI);
  +    public javax.xml.rpc.encoding.TypeMapping 
  +        unregisterTypeMapping(String namespaceURI) {
  +        TypeMapping del = (TypeMapping) mapTM.get(namespaceURI);
  +        TypeMapping tm = null;
  +        if (del != null) {
  +            tm = del.getDelegate();
  +            del.setDelegate(null);
  +        }
           return tm;
       }
   
  +    /**
  +     * Removes the TypeMapping for the namespace.
  +     *
  +     * @param typeMapping- The type mapping   to remove
  +     * @return true if found and removed
  +     */
  +    public boolean removeTypeMapping(
  +                                     javax.xml.rpc.encoding.TypeMapping mapping) {
  +        String[] ns = getRegisteredNamespaces();
  +        boolean rc = false;
  +        for (int i=0; i < ns.length; i++) {
  +            if (getTypeMapping(ns[i]) == mapping) {
  +                rc = true;
  +                unregisterTypeMapping(ns[i]);
  +            }
  +        }
  +        return rc;
  +    }
   
       /**
  -     * Creates a new empty TypeMapping object for the specified encoding style or XML schema namespace.
  +     * Creates a new empty TypeMapping object for the specified
  +     * encoding style or XML schema namespace.
        *
        * @return An empty generic TypeMapping object
        */
       public javax.xml.rpc.encoding.TypeMapping createTypeMapping() {
  -        return new TypeMappingImpl(defaultTM);
  +        return new TypeMappingImpl(defaultDelTM);
       }
           
   
  @@ -209,7 +358,7 @@
        *
        * @return String[] containing names of all registered namespace URIs
        */
  -    public String[] getSupportedNamespaces() {
  +    public String[] getRegisteredNamespaces() {
           java.util.Set s = mapTM.keySet(); 
           if (s != null) { 
               String[] rc = new String[s.size()];
  @@ -231,13 +380,15 @@
           mapTM.clear();
       }
   
  -     /********* End JAX-RPC Compliant Method Definitions *****************/
  -
       /**
        * Return the default TypeMapping
        * @return TypeMapping or null
        **/
       public javax.xml.rpc.encoding.TypeMapping getDefaultTypeMapping() {
  +        TypeMapping defaultTM = defaultDelTM;
  +        while(defaultTM != null && defaultTM instanceof TypeMappingDelegate) {
  +            defaultTM = defaultTM.getDelegate();
  +        }
           return defaultTM;
       }
   
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/DefaultSOAP12TypeMappingImpl.java
  
  Index: DefaultSOAP12TypeMappingImpl.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.encoding;
  
  import org.apache.axis.Constants;
  
  import javax.xml.rpc.namespace.QName;
  import javax.xml.rpc.JAXRPCException;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  import org.apache.axis.encoding.ser.ArraySerializerFactory;
  import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
  import org.apache.axis.encoding.ser.BeanSerializerFactory;
  import org.apache.axis.encoding.ser.BeanDeserializerFactory;
  import org.apache.axis.encoding.ser.DateSerializerFactory;
  import org.apache.axis.encoding.ser.DateDeserializerFactory;
  import org.apache.axis.encoding.ser.Base64SerializerFactory;
  import org.apache.axis.encoding.ser.Base64DeserializerFactory;
  import org.apache.axis.encoding.ser.MapSerializerFactory;
  import org.apache.axis.encoding.ser.MapDeserializerFactory;
  import org.apache.axis.encoding.ser.HexSerializerFactory;
  import org.apache.axis.encoding.ser.HexDeserializerFactory;
  import org.apache.axis.encoding.ser.ElementSerializerFactory;
  import org.apache.axis.encoding.ser.ElementDeserializerFactory;
  import org.apache.axis.encoding.ser.VectorDeserializerFactory;
  import org.apache.axis.encoding.ser.SimpleDeserializerFactory;
  import org.apache.axis.encoding.ser.SimplePrimitiveSerializerFactory;
  import org.apache.axis.encoding.ser.SimpleNonPrimitiveSerializerFactory;
  import java.util.Vector;
  import java.util.Hashtable;
  import java.util.List;
  
  /**
   * @author Rich Scheuerle (scheu@us.ibm.com)
   * 
   * This is the implementation of the axis Default JAX-RPC SOAP 1.2 TypeMapping
   * See DefaultTypeMapping for more information.
   * 
   */
  public class DefaultSOAP12TypeMappingImpl extends DefaultTypeMappingImpl { 
      
      private static DefaultSOAP12TypeMappingImpl tm = null;
      /**
       * Construct TypeMapping
       */
      public static TypeMapping create() {
          if (tm == null) {
              tm = new DefaultSOAP12TypeMappingImpl();
          }
          return tm;
      }
  
      protected DefaultSOAP12TypeMappingImpl() {
          super();
          // This default type mapping only contains the SOAP 1.2 differences.
          // delegate to the DefaultTypeMapping as necessary.
          delegate = DefaultTypeMappingImpl.create();
  
          // Notes:
          // 1) The registration statements are order dependent.  The last one
          //    wins.  So if two javaTypes of String are registered, the 
          //    ser factory for the last one registered will be chosen.  Likewise
          //    if two javaTypes for XSD_DATE are registered, the deserializer 
          //    factory for the last one registered will be chosen.
          // 2) Even if the SOAP 1.1 format is used over the wire, an 
          //    attempt is made to receive SOAP 1.2 format from the wire.
          //    This is the reason why the soap encoded primitives are 
          //    registered without serializers.
  
          // 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);
  
          // SOAP 1.2
          // byte[] -ser-> XSD_BASE64
          // Byte[] -ser-> SOAP_BASE64
          // XSD_BASE64 -deser-> byte[]
          // SOAP_BASE64 -deser->Byte[]
          myRegister(Constants.SOAP_BASE64,     java.lang.Byte[].class,     
                     new Base64SerializerFactory(java.lang.Byte[].class,
                                                 Constants.SOAP_BASE64 ),
                     new Base64DeserializerFactory(java.lang.Byte[].class, 
                                                   Constants.SOAP_BASE64),
                     true);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/encoding/TypeMappingDelegate.java
  
  Index: TypeMappingDelegate.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.encoding;
  
  import org.apache.axis.Constants;
  
  import javax.xml.rpc.namespace.QName;
  import javax.xml.rpc.JAXRPCException;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  /**
   * @author Rich Scheuerle (scheu@us.ibm.com)
   * 
   * The TypeMapping delegate is used to simply delegate to 
   * the indicated type mapping.  It is used by the TypeMappingRegistry
   * to assist with chaining.
   * 
   */
  class TypeMappingDelegate extends TypeMappingImpl { 
  
      /**
       * Construct TypeMapping
       */
      TypeMappingDelegate(TypeMapping delegate) {
          super(delegate);
      }
  
  
      /********* JAX-RPC Compliant Method Definitions *****************/
  
      // Delegate or throw an exception
      
      public String[] getSupportedNamespaces() {
          if (delegate != null)
              return delegate.getSupportedNamespaces();
          return null;
      }
  
      public void setSupportedNamespaces(String[] namespaceURIs) {
          if (delegate != null)
              delegate.setSupportedNamespaces(namespaceURIs);
      }
      
      public void register(Class javaType, QName xmlType, 
                           javax.xml.rpc.encoding.SerializerFactory sf,
                           javax.xml.rpc.encoding.DeserializerFactory dsf)
          throws JAXRPCException {        
  
          throw new JAXRPCException();
      }
      
      public javax.xml.rpc.encoding.SerializerFactory 
          getSerializer(Class javaType, QName xmlType)
          throws JAXRPCException
      {
          if (delegate != null)
              return delegate.getSerializer(javaType, xmlType);
          return null;
      }
      public javax.xml.rpc.encoding.SerializerFactory
          getSerializer(Class javaType) 
          throws JAXRPCException 
      {
          if (delegate != null)
              return delegate.getSerializer(javaType);
          return null;
      }
  
      public javax.xml.rpc.encoding.DeserializerFactory
          getDeserializer(Class javaType, QName xmlType)
          throws JAXRPCException {
          if (delegate != null)
              return delegate.getDeserializer(javaType, xmlType);
          return null;
      }
      public javax.xml.rpc.encoding.DeserializerFactory 
          getDeserializer(QName xmlType)
          throws JAXRPCException {
          if (delegate != null)
              return delegate.getDeserializer(xmlType);
          return null;
      }
  
      public void removeSerializer(Class javaType, QName xmlType)
          throws JAXRPCException {
          throw new JAXRPCException();
      }
  
      public void removeDeserializer(Class javaType, QName xmlType)
          throws JAXRPCException {
          throw new JAXRPCException();
      }
  
     public boolean isRegistered(Class javaType, QName xmlType) {
         if (delegate != null)
             delegate.isRegistered(javaType, xmlType);
         return false;
     }
  
      /********* End JAX-RPC Compliant Method Definitions *****************/
       
      /**
       * Gets the QName for the type mapped to Class.
       * @param javaType class or type
       * @return xmlType qname or null
       */
      public QName getTypeQName(Class javaType) {
          if (delegate != null)
              return delegate.getTypeQName(javaType);
          return null;
      }
      
      /**
       * Gets the Class mapped to QName.
       * @param xmlType qname or null
       * @return javaType class or type
       */
      public Class getClassForQName(QName xmlType) {
          if (delegate != null)
              return delegate.getClassForQName(xmlType);
          return null;
      }
  }
  
  
  
  1.33      +6 -1      xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
  
  Index: JavaProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- JavaProvider.java	15 Jan 2002 17:23:00 -0000	1.32
  +++ JavaProvider.java	1 Feb 2002 22:08:26 -0000	1.33
  @@ -67,6 +67,8 @@
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.cache.JavaClass;
   import org.apache.axis.wsdl.fromJava.Emitter;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.Constants;
   import org.apache.log4j.Category;
   import org.w3c.dom.Document;
   
  @@ -309,7 +311,10 @@
               emitter.setAllowedMethods(allowedMethods);
               emitter.setIntfNamespace(url);
               emitter.setLocationUrl(url);
  -            emitter.setReg(msgContext.getTypeMappingRegistry());
  +            emitter.setTypeMapping((TypeMapping)msgContext.getTypeMappingRegistry().
  +                                   getTypeMapping(Constants.URI_CURRENT_SOAP_ENC));
  +            emitter.setDefaultTypeMapping((TypeMapping)msgContext.getTypeMappingRegistry().
  +                                          getDefaultTypeMapping());
               Document  doc = emitter.emit(Emitter.MODE_ALL);
   
               msgContext.setProperty("WSDL", doc);
  
  
  
  1.11      +132 -68   xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Emitter.java	26 Jan 2002 02:41:51 -0000	1.10
  +++ Emitter.java	1 Feb 2002 22:08:26 -0000	1.11
  @@ -68,8 +68,9 @@
   
   import org.apache.axis.Constants;
   import org.apache.axis.MessageContext;
  -import org.apache.axis.encoding.TypeMappingRegistry;
  -import org.apache.axis.encoding.TypeMappingRegistryImpl;
  +import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.encoding.DefaultTypeMappingImpl;
  +import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl;
   import org.apache.axis.utils.XMLUtils;
   import org.w3c.dom.Document;
   
  @@ -117,7 +118,7 @@
       public static final int MODE_IMPLEMENTATION = 2;
   
       private Class cls;
  -    private Class implCls;                 // Optional class that is an implementation of cls
  +    private Class implCls;                 // Optional implementation class
       private Vector allowedMethods = null;  // Names of methods to consider
       private boolean useInheritedMethods = false;
       private String intfNS;          
  @@ -127,18 +128,19 @@
       private String serviceName;
       private String targetService = null;
       private String description;
  -    private TypeMappingRegistry reg = null;
  +    private TypeMapping tm = null;        // Registered type mapping
  +    private TypeMapping defaultTM = null; // Default TM 
       private Namespaces namespaces;
   
       private ArrayList encodingList;
       private Types types;
       private String clsName;
       
  -    private Java2WSDLFactory factory;  // Factory for obtaining user provided extensions.
  +    private Java2WSDLFactory factory;  // Factory for obtaining user extensions
   
       /**
        * Construct Emitter.                                            
  -     * Set the contextual information using set* methods at the end of the class.
  +     * Set the contextual information using set* methods
        * Invoke emit to emit the code
        */
       public Emitter () {
  @@ -167,13 +169,16 @@
           }
   
           // Write out the interface def      
  -        Document doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(intf);
  +        Document doc = WSDLFactory.newInstance().
  +            newWSDLWriter().getDocument(intf);
           types.insertTypesFragment(doc);
  -        XMLUtils.PrettyDocumentToStream(doc, new FileOutputStream(new File(filename1)));
  +        XMLUtils.PrettyDocumentToStream(doc, 
  +                    new FileOutputStream(new File(filename1)));
   
           // Write out the implementation def 
           doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(impl);
  -        XMLUtils.PrettyDocumentToStream(doc, new FileOutputStream(new File(filename2)));
  +        XMLUtils.PrettyDocumentToStream(doc, 
  +                    new FileOutputStream(new File(filename2)));
       }
   
       /**
  @@ -187,8 +192,8 @@
       }
   
       /**
  -     * Generates a WSDL document for a given <code>Class</code>. The sections of
  -     * the WSDL generated are controlled by the mode parameter 
  +     * Generates a WSDL document for a given <code>Class</code>. 
  +     * The WSDL generated is controlled by the mode parameter 
        * mode 0: All
        * mode 1: Interface
        * mode 2: Implementation
  @@ -203,17 +208,20 @@
           switch (mode) {
               case MODE_ALL:
                   def = getWSDL();
  -                doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(def);
  +                doc = WSDLFactory.newInstance().
  +                    newWSDLWriter().getDocument(def);
                   types.insertTypesFragment(doc);
                   break;
               case MODE_INTERFACE:
                   def = getIntfWSDL();
  -                doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(def);
  +                doc = WSDLFactory.newInstance().
  +                    newWSDLWriter().getDocument(def);
                   types.insertTypesFragment(doc);
                   break;
               case MODE_IMPLEMENTATION:
                   def = getImplWSDL();
  -                doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(def);
  +                doc = WSDLFactory.newInstance().
  +                    newWSDLWriter().getDocument(def);
                   break;
               default:
                   throw new Exception ("unrecognized output WSDL mode"); 
  @@ -224,8 +232,8 @@
       }
   
       /**
  -     * Generates a String containing the WSDL for a given <code>Class</code>. The sections of
  -     * the WSDL generated are controlled by the mode parameter 
  +     * Generates a String containing the WSDL for a given <code>Class</code>.
  +     * The WSDL generated is controlled by the mode parameter 
        * mode 0: All
        * mode 1: Interface
        * mode 2: Implementation
  @@ -242,8 +250,8 @@
       }
   
       /**
  -     * Generates a WSDL document for a given <code>Class</code>. The sections of
  -     * the WSDL generated are controlled by the mode parameter 
  +     * Generates a WSDL document for a given <code>Class</code>.
  +     * The WSDL generated is controlled by the mode parameter 
        * mode 0: All
        * mode 1: Interface
        * mode 2: Implementation
  @@ -271,11 +279,13 @@
               }
           }
               
  -        XMLUtils.PrettyDocumentToStream(doc, new FileOutputStream(new File(filename)));
  +        XMLUtils.PrettyDocumentToStream(doc, 
  +          new FileOutputStream(new File(filename)));
       }
   
       /**
  -     * Get a Full WSDL <code>Definition</code> for the current configuration parameters
  +     * Get a Full WSDL <code>Definition</code> for the current
  +     * configuration parameters
        *
        * @return WSDL <code>Definition</code>
        * @throws Exception
  @@ -289,7 +299,7 @@
   
           // Write interface header
           writeDefinitions(def, intfNS);
  -        types = new Types(def, reg, namespaces, intfNS, factory);
  +        types = new Types(def, tm, defaultTM, namespaces, intfNS, factory);
           Binding binding = writeBinding(def, true);
           writePortType(def, binding);
           writeService(def, binding);
  @@ -297,7 +307,8 @@
       }
   
      /**
  -     * Get a interface WSDL <code>Definition</code> for the current configuration parameters
  +     * Get a interface WSDL <code>Definition</code> for the
  +     * current configuration parameters
        *
        * @return WSDL <code>Definition</code>
        * @throws Exception
  @@ -311,14 +322,15 @@
   
           // Write interface header
           writeDefinitions(def, intfNS);
  -        types = new Types(def, reg, namespaces, intfNS, factory);
  +        types = new Types(def, tm, defaultTM, namespaces, intfNS, factory);
           Binding binding = writeBinding(def, true);
           writePortType(def, binding);
           return def;
       }
   
      /**
  -     * Get implementation WSDL <code>Definition</code> for the current configuration parameters
  +     * Get implementation WSDL <code>Definition</code> for the
  +     * current configuration parameters
        *
        * @return WSDL <code>Definition</code>
        * @throws Exception
  @@ -333,12 +345,13 @@
           // Write interface header
           writeDefinitions(def, implNS);
           writeImport(def, intfNS, importUrl);
  -        Binding binding = writeBinding(def, false); // Don't write binding to def
  +        Binding binding = writeBinding(def, false); // Don't add binding to def
           writeService(def, binding);
           return def;
       }
       /**
  -     * Invoked prior to building a definition to ensure parms and data are set up.      
  +     * Invoked prior to building a definition to ensure parms
  +     * and data are set up.      
        * @throws Exception
        */
       private void init() throws Exception {
  @@ -367,8 +380,13 @@
               encodingList = new ArrayList();
               encodingList.add(Constants.URI_CURRENT_SOAP_ENC);
               
  -            if (reg == null) {
  -                reg = new TypeMappingRegistryImpl();
  +
  +            // We want to produce valid SOAP 1.2 JAX-RPC 
  +            // translations, so make sure that the default type mapping
  +            // is for SOAP 1.2.
  +            if (defaultTM == null ||
  +                defaultTM instanceof DefaultTypeMappingImpl) {
  +                defaultTM = DefaultSOAP12TypeMappingImpl.create();
               }
   
               if (intfNS == null) 
  @@ -388,7 +406,8 @@
        * @param tns  target namespace
        * @throws Exception
        */
  -    private void writeDefinitions(Definition def, String tns) throws Exception {
  +    private void writeDefinitions(Definition def, String tns)
  +        throws Exception {
           def.setTargetNamespace(tns);
   
           def.addNamespace("intf", intfNS);
  @@ -423,7 +442,8 @@
        * @param loc  target location 
        * @throws Exception
        */
  -    private void writeImport(Definition def, String tns, String loc) throws Exception {
  +    private void writeImport(Definition def, String tns, String loc)
  +        throws Exception {
           Import imp = def.createImport();
   
           imp.setNamespaceURI(tns);
  @@ -439,10 +459,12 @@
        * @param add  true if binding should be added to the def
        * @throws Exception
        */
  -    private Binding writeBinding(Definition def, boolean add) throws Exception {
  +    private Binding writeBinding(Definition def, boolean add)
  +        throws Exception {
           Binding binding = def.createBinding();
           binding.setUndefined(false);
  -        binding.setQName(new javax.wsdl.QName(intfNS, getServiceName() + "SoapBinding"));
  +        binding.setQName(
  +          new javax.wsdl.QName(intfNS, getServiceName() + "SoapBinding"));
   
           SOAPBinding soapBinding = new SOAPBindingImpl();
           soapBinding.setStyle("rpc");
  @@ -467,7 +489,8 @@
   
           Service service = def.createService();
   
  -        service.setQName(new javax.wsdl.QName(implNS, getServiceName()+"Service"));
  +        service.setQName(
  +           new javax.wsdl.QName(implNS, getServiceName()+"Service"));
           def.addService(service);
   
           Port port = def.createPort();
  @@ -491,7 +514,8 @@
        * @param binding                        
        * @throws Exception
        */
  -    private void writePortType(Definition def, Binding binding) throws Exception{
  +    private void writePortType(Definition def, Binding binding) 
  +        throws Exception{
   
           PortType portType = def.createPortType();
           portType.setUndefined(false);
  @@ -499,12 +523,17 @@
           // PortType name is the name of the class being processed
           portType.setQName(new javax.wsdl.QName(intfNS, clsName));
   
  -        // Get a ClassRep representing the portType class, and get the list of MethodRep
  -        // objects representing the methods that should be contained in the portType.
  +        // Get a ClassRep representing the portType class,
  +        // and get the list of MethodRep
  +        // objects representing the methods that should
  +        // be contained in the portType.
           // This allows users to provide their own method/parameter mapping.
  -        BuilderPortTypeClassRep builder = factory.getBuilderPortTypeClassRep();
  -        ClassRep classRep = builder.build(cls, useInheritedMethods, implCls);
  -        Vector methods = builder.getResolvedMethods(classRep, allowedMethods);
  +        BuilderPortTypeClassRep builder = 
  +           factory.getBuilderPortTypeClassRep();
  +        ClassRep classRep = 
  +           builder.build(cls, useInheritedMethods, implCls);
  +        Vector methods = 
  +           builder.getResolvedMethods(classRep, allowedMethods);
   
           for(int i=0; i<methods.size(); i++) {
               MethodRep method = (MethodRep) methods.elementAt(i);
  @@ -525,7 +554,8 @@
        * @param method (A MethodRep object)                       
        * @throws Exception
        */
  -    private void writeMessages(Definition def, Operation oper, MethodRep method) throws Exception{
  +    private void writeMessages(Definition def, Operation oper, 
  +                               MethodRep method) throws Exception{
           Input input = def.createInput();
   
           Message msg = writeRequestMessage(def, method);
  @@ -544,8 +574,10 @@
           // Set the parameter ordering using the parameter names
           Vector names = new Vector();
           for (int i=0; i<method.getParameters().size(); i++) {
  -            ParamRep parameter = (ParamRep) method.getParameters().elementAt(i);
  -            if ((i == 0) && MessageContext.class.equals(parameter.getType())) {
  +            ParamRep parameter = (ParamRep) 
  +                method.getParameters().elementAt(i);
  +            if ((i == 0) && 
  +                MessageContext.class.equals(parameter.getType())) {
                   continue;
               }
               names.add(parameter.getName());
  @@ -562,7 +594,9 @@
        * @param operName                        
        * @throws Exception
        */
  -    private Operation writeOperation(Definition def, Binding binding, String operName) {
  +    private Operation writeOperation(Definition def, 
  +                                     Binding binding, 
  +                                     String operName) {
           Operation oper = def.createOperation();
           oper.setName(operName);
           oper.setUndefined(false);
  @@ -577,7 +611,9 @@
        * @param oper                        
        * @throws Exception
        */
  -    private void writeBindingOperation (Definition def, Binding binding, Operation oper) {
  +    private void writeBindingOperation (Definition def, 
  +                                        Binding binding, 
  +                                        Operation oper) {
           BindingOperation bindingOper = def.createBindingOperation();
           BindingInput bindingInput = def.createBindingInput();
           BindingOutput bindingOutput = def.createBindingOutput();
  @@ -612,7 +648,8 @@
        * @param method (a MethodRep object)       
        * @throws Exception
        */
  -    private Message writeRequestMessage(Definition def, MethodRep method) throws Exception
  +    private Message writeRequestMessage(Definition def,
  +                                        MethodRep method) throws Exception
       {
           Message msg = def.createMessage();
   
  @@ -627,7 +664,8 @@
               ParamRep parameter = (ParamRep) parameters.elementAt(i);
               // If the first param is a MessageContext, Axis will
               // generate it for us - it shouldn't be in the WSDL.
  -            if ((i == 0) && MessageContext.class.equals(parameter.getType())) {
  +            if ((i == 0) && 
  +                MessageContext.class.equals(parameter.getType())) {
                   continue;
               }
               writePartToMessage(def, msg, true,parameter); 
  @@ -642,7 +680,8 @@
        * @param method   
        * @throws Exception
        */
  -    private Message writeResponseMessage(Definition def, MethodRep method) throws Exception
  +    private Message writeResponseMessage(Definition def, 
  +                                         MethodRep method) throws Exception
       {
           Message msg = def.createMessage();
   
  @@ -661,7 +700,8 @@
               ParamRep parameter = (ParamRep) parameters.elementAt(i);
               // If the first param is a MessageContext, Axis will
               // generate it for us - it shouldn't be in the WSDL.
  -            if ((i == 0) && MessageContext.class.equals(parameter.getType())) {
  +            if ((i == 0) && 
  +                MessageContext.class.equals(parameter.getType())) {
                   continue;
               }
               writePartToMessage(def, msg, false,parameter); 
  @@ -678,7 +718,9 @@
        * @return The parameter name added or null
        * @throws Exception
        */
  -    public String writePartToMessage(Definition def, Message msg, boolean request,
  +    public String writePartToMessage(Definition def, 
  +                                     Message msg,
  +                                     boolean request,
                                        ParamRep param) throws Exception
       {
           // Return if this is a void type
  @@ -721,7 +763,8 @@
           // Check the make sure there isn't a message with this name already
           int messageNumber = 1;
           while (def.getMessage(qName) != null) {
  -            StringBuffer namebuf = new StringBuffer(methodName.concat(suffix));
  +            StringBuffer namebuf = 
  +                new StringBuffer(methodName.concat(suffix));
               namebuf.append(messageNumber);
               qName = new javax.wsdl.QName(intfNS, namebuf.toString());
               messageNumber++;
  @@ -761,29 +804,32 @@
   
           // Strip off \ and / from serviceName
           if (serviceName.lastIndexOf('/') > 0) {
  -            serviceName = serviceName.substring(serviceName.lastIndexOf('/') + 1);
  +            serviceName = 
  +              serviceName.substring(serviceName.lastIndexOf('/') + 1);
           } else if (serviceName.lastIndexOf('\\') > 0) {
  -            serviceName = serviceName.substring(serviceName.lastIndexOf('\\') + 1);
  +            serviceName = 
  +              serviceName.substring(serviceName.lastIndexOf('\\') + 1);
           } 
   
           // Get the constructors of the class
  -        java.lang.reflect.Constructor[] constructors = cls.getDeclaredConstructors();
  +        java.lang.reflect.Constructor[] constructors = 
  +          cls.getDeclaredConstructors();
           Class intf = null;
           for (int i=0; i<constructors.length && intf == null; i++) {
               Class[] parms = constructors[i].getParameterTypes();
  -            // If the constructor has a single parameter that is an interface which
  +            // If the constructor has a single parameter 
  +            // that is an interface which
               // matches the serviceName, then use this as the interface class.
               if (parms.length == 1 &&
                   parms[0].isInterface() &&
                   parms[0].getName() != null &&
  -                Types.getLocalNameFromFullName(parms[0].getName()).equals(serviceName)) {
  +                Types.getLocalNameFromFullName(
  +                    parms[0].getName()).equals(serviceName)) {
                   intf = parms[0];
               }
           }
           if (intf != null) {
               setCls(intf);
  -
  -            // Try to find an implementation or skeleton to use for the impl class.
               if (implCls == null) {
                   setImplCls(cls);
               }
  @@ -840,7 +886,8 @@
        */
       public void setFactory(String className) {
           try {
  -            factory = (Java2WSDLFactory) Class.forName(className).newInstance();
  +            factory = (Java2WSDLFactory) 
  +                Class.forName(className).newInstance();
           }
           catch (Exception ex) {
               ex.printStackTrace();
  @@ -975,8 +1022,10 @@
       }
   
       /**
  -     * Set the String representation of the interface location URL for importing
  -     * @param locationUrl the String representation of the interface location URL for importing
  +     * Set the String representation of the interface location URL 
  +     * for importing
  +     * @param locationUrl the String representation of the interface
  +     * location URL for importing
        */
       public void setImportUrl(String importUrl) {
           this.importUrl = importUrl;
  @@ -1031,19 +1080,34 @@
       }
   
       /**
  -     * Returns the <code>TypeMappingRegistry</code> used by the service
  -     * @return the <code>TypeMappingRegistry</code> used by the service
  +     * Returns the <code>TypeMapping</code> used by the service
  +     * @return the <code>TypeMapping</code> used by the service
        */
  -    public TypeMappingRegistry getReg() {
  -        return reg;
  +    public TypeMapping getTypeMapping() {
  +        return tm;
       }
   
       /**
  -     * Sets the <code>TypeMappingRegistry</code> used by the service
  -     * @param reg the <code>TypeMappingRegistry</code> used by the service
  +     * Sets the <code>TypeMapping</code> used by the service
  +     * @param tm the <code>TypeMapping</code> used by the service
        */
  -    public void setReg(TypeMappingRegistry reg) {
  -        this.reg = reg;
  +    public void setTypeMapping(TypeMapping tm) {
  +        this.tm = tm;
       }
   
  +    /**
  +     * Returns the default <code>TypeMapping</code> used by the service
  +     * @return the default <code>TypeMapping</code> used by the service
  +     */
  +    public TypeMapping getDefaultTypeMapping() {
  +        return defaultTM;
  +    }
  +
  +    /**
  +     * Sets the default <code>TypeMapping</code> used by the service
  +     * @param defaultTM the default <code>TypeMapping</code> used by the service
  +     */
  +    public void setDefaultTypeMapping(TypeMapping defaultTM) {
  +        this.defaultTM = defaultTM;
  +    }
   }
  
  
  
  1.12      +25 -8     xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java
  
  Index: Types.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Types.java	26 Jan 2002 02:41:51 -0000	1.11
  +++ Types.java	1 Feb 2002 22:08:26 -0000	1.12
  @@ -57,7 +57,6 @@
   package org.apache.axis.wsdl.fromJava;
   
   import org.apache.axis.Constants;
  -import org.apache.axis.encoding.TypeMappingRegistry;
   import org.apache.axis.encoding.TypeMapping;
   import org.apache.axis.utils.XMLUtils;
   
  @@ -101,6 +100,7 @@
       Definition def;
       Namespaces namespaces = null;
       TypeMapping tm;
  +    TypeMapping defaultTM;
       String targetNamespace;
       Element wsdlTypesElem = null;
       HashMap schemaTypes = null;
  @@ -113,21 +113,22 @@
        * provides the context for the streamed node within the WSDL document
        * @param def WSDL Definition Element to declare namespaces
        * @param doc Document element of the WSDL used to create child elements
  -     * @param reg TypeMappingRegistry to handle known types
  +     * @param tm TypeMappingRegistry to handle known types
  +     * @param defaultTM default TM                          
        * @param namespaces user defined or autogenerated namespace and prefix maps
        * @param targetNamespace targetNamespace of the document
        * @param factory Java2WSDLFactory                          
        */
       public Types(Definition def, 
  -                 TypeMappingRegistry reg, 
  +                 TypeMapping tm,
  +                 TypeMapping defaultTM,   
                    Namespaces namespaces, 
                    String targetNamespace,
                    Java2WSDLFactory factory) {
           this.def = def;
           createDocumentFragment();
  -        if (reg != null) {
  -            tm = (TypeMapping) reg.getTypeMapping(Constants.URI_CURRENT_SOAP_ENC);
  -        }
  +        this.tm = tm;
  +        this.defaultTM = defaultTM;
           this.namespaces = namespaces;
           this.targetNamespace = targetNamespace;
           schemaElementNames = new HashMap();
  @@ -216,8 +217,24 @@
                                                             localPart);
               } 
           } else {
  -            // Get the QName from the registry, or create our own.
  -            qName = tm.getTypeQName(type);
  +            // Get the QName from the type mapping or create our own.
  +            javax.xml.rpc.namespace.QName dQName = null;
  +            if (defaultTM != null) {
  +                dQName = defaultTM.getTypeQName(type);
  +            }
  +            if (tm != null) {
  +                qName = tm.getTypeQName(type);
  +            }
  +            if (qName == null) {
  +                qName = dQName;
  +            } else if (qName != null && qName != dQName) {
  +                // If the TM and default TM resulted in different
  +                // names, choose qName unless it is a schema namespace.
  +                // (i.e. prefer soapenc primitives over schema primitives)
  +                if (Constants.isSchemaXSD(qName.getNamespaceURI())) {
  +                    qName = dQName;
  +                }
  +            }
               if (qName == null) {
                   String pkg = getPackageNameFromFullName(type.getName());
                   String lcl = getLocalNameFromFullName(type.getName());
  
  
  
  1.14      +1 -0      xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Emitter.java	28 Jan 2002 16:26:37 -0000	1.13
  +++ Emitter.java	1 Feb 2002 22:08:26 -0000	1.14
  @@ -91,6 +91,7 @@
    *
    * @author Russell Butek (butek@us.ibm.com)
    * @author Tom Jordahl (tjordahl@macromedia.com)
  + * @author Rich Scheuerle (scheu@us.ibm.com)
    * @author Steve Graham (sggraham@us.ibm.com)
    */
   public class Emitter {
  
  
  
  1.25      +10 -9     xml-axis/java/test/RPCDispatch/TestSerializedRPC.java
  
  Index: TestSerializedRPC.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestSerializedRPC.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- TestSerializedRPC.java	28 Jan 2002 18:23:02 -0000	1.24
  +++ TestSerializedRPC.java	1 Feb 2002 22:08:26 -0000	1.25
  @@ -88,6 +88,7 @@
           String msgStr = header + bodyElemHead + bodyStr +
                           bodyElemFoot + footer;
           msgContext.setRequestMessage(new Message(msgStr));
  +        msgContext.setTypeMappingRegistry(engine.getTypeMappingRegistry());
           
           // Invoke the Axis engine
           try {
  @@ -141,10 +142,10 @@
           BeanDeserializerFactory df = new BeanDeserializerFactory(javaType, xmlType);
   
           TypeMappingRegistry tmr = engine.getTypeMappingRegistry();
  -        TypeMapping tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_SOAP_ENC);
  -        if (tm == null) {
  +        TypeMapping tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_CURRENT_SOAP_ENC);
  +        if (tm == null || tm == tmr.getDefaultTypeMapping()) {
               tm = (TypeMapping) tmr.createTypeMapping();
  -            tmr.register(tm, new String[] {Constants.URI_SOAP_ENC});
  +            tmr.register(Constants.URI_CURRENT_SOAP_ENC, tm);
           }
           tm.register(javaType, xmlType, sf, df);
           
  @@ -166,10 +167,10 @@
           BeanDeserializerFactory df = new BeanDeserializerFactory(javaType, xmlType);
   
           TypeMappingRegistry tmr = engine.getTypeMappingRegistry();
  -        TypeMapping tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_SOAP_ENC);
  -        if (tm == null) {
  +        TypeMapping tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_CURRENT_SOAP_ENC);
  +        if (tm == null || tm == tmr.getDefaultTypeMapping()) {
               tm = (TypeMapping) tmr.createTypeMapping();
  -            tmr.register(tm, new String[] {Constants.URI_SOAP_ENC});
  +            tmr.register(Constants.URI_CURRENT_SOAP_ENC, tm);
           }
           tm.register(javaType, xmlType, sf, df);
           
  @@ -191,10 +192,10 @@
           BeanDeserializerFactory df = new BeanDeserializerFactory(javaType, xmlType);
   
           TypeMappingRegistry tmr = engine.getTypeMappingRegistry();
  -        TypeMapping tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_SOAP_ENC);
  -        if (tm == null) {
  +        TypeMapping tm = (TypeMapping) tmr.getTypeMapping(Constants.URI_CURRENT_SOAP_ENC);
  +        if (tm == null || tm == tmr.getDefaultTypeMapping()) {
               tm = (TypeMapping) tmr.createTypeMapping();
  -            tmr.register(tm, new String[] {Constants.URI_SOAP_ENC});
  +            tmr.register(Constants.URI_CURRENT_SOAP_ENC, tm);
           }
           tm.register(javaType, xmlType, sf, df);
           
  
  
  
  1.19      +5 -5      xml-axis/java/test/encoding/TestSer.java
  
  Index: TestSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestSer.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TestSer.java	26 Jan 2002 02:52:38 -0000	1.18
  +++ TestSer.java	1 Feb 2002 22:08:26 -0000	1.19
  @@ -65,12 +65,12 @@
           SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
           context.setDoMultiRefs(multiref);
           
  +        // Create a TypeMapping and register the specialized Type Mapping
           TypeMappingRegistry reg = context.getTypeMappingRegistry();
  -        TypeMapping tm = (TypeMapping) reg.getTypeMapping(Constants.URI_SOAP_ENC);
  -        if (tm == null) {
  -            tm = (TypeMapping) reg.createTypeMapping();
  -            reg.register(tm, new String[] {Constants.URI_SOAP_ENC});
  -        }
  +        TypeMapping tm = (TypeMapping) reg.createTypeMapping();
  +        tm.setSupportedNamespaces(new String[] {Constants.URI_CURRENT_SOAP_ENC});
  +        reg.register(Constants.URI_CURRENT_SOAP_ENC, tm);
  +
           QName dataQName = new QName("typeNS", "Data");
           tm.register(Data.class, dataQName, new DataSerFactory(), new DataDeserFactory());
   
  
  
  
  1.2       +1 -1      xml-axis/java/test/wsdl/sequence/SequenceTest.wsdl
  
  Index: SequenceTest.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/sequence/SequenceTest.wsdl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SequenceTest.wsdl	4 Jan 2002 19:09:41 -0000	1.1
  +++ SequenceTest.wsdl	1 Feb 2002 22:08:26 -0000	1.2
  @@ -36,7 +36,7 @@
     </message>
   
     <message name="testSequenceResponse">
  -    <part name="rc" type="xsd:int"/>
  +    <part name="rc" type="soapenc:int"/>
     </message>
   
     <!-- port type declns -->
  
  
  
  1.3       +3 -2      xml-axis/java/test/wsdl/sequence/SequenceTestServiceTestCase.java
  
  Index: SequenceTestServiceTestCase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/sequence/SequenceTestServiceTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SequenceTestServiceTestCase.java	24 Jan 2002 17:01:39 -0000	1.2
  +++ SequenceTestServiceTestCase.java	1 Feb 2002 22:08:26 -0000	1.3
  @@ -21,9 +21,10 @@
           }
           assertTrue("binding is null", binding != null);
           try {
  -            int value = -3;
  +            Integer value = null;
               value = binding.testSequence(new test.wsdl.sequence.SequenceInfo());
  -            assertTrue("Test Sequence Failed="+value , (value == 0));
  +            assertTrue("Test Sequence Failed="+value,             (value != null));
  +            assertTrue("Test Sequence Failed="+value.intValue() , (value.intValue() == 0));
           } catch (java.rmi.RemoteException re) {
               throw new junit.framework.AssertionFailedError("Remote Exception caught: " + re );
           }
  
  
  
  1.2       +9 -9      xml-axis/java/test/wsdl/sequence/SequenceTestSoapBindingImpl.java
  
  Index: SequenceTestSoapBindingImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/sequence/SequenceTestSoapBindingImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SequenceTestSoapBindingImpl.java	4 Jan 2002 19:09:41 -0000	1.1
  +++ SequenceTestSoapBindingImpl.java	1 Feb 2002 22:08:26 -0000	1.2
  @@ -8,28 +8,28 @@
   import java.util.Vector;
   
   public class SequenceTestSoapBindingImpl implements test.wsdl.sequence.SequenceTestPortType {
  -    public int testSequence(test.wsdl.sequence.SequenceInfo info) throws java.rmi.RemoteException {
  +    public Integer testSequence(test.wsdl.sequence.SequenceInfo info) throws java.rmi.RemoteException {
           Vector v = info.order();
           if (v == null || v.size() != 6) 
  -            return -100;
  +            return new Integer(-100);
           if (!((String)v.elementAt(0)).equals("zero")) {
  -            return -1;
  +            return new Integer(-1);
           }
           if (!((String)v.elementAt(1)).equals("one")) {
  -            return -2;
  +            return new Integer(-2);
           }
           if (!((String)v.elementAt(2)).equals("two")) {
  -            return -3;
  +            return new Integer(-3);
           }
           if (!((String)v.elementAt(3)).equals("three")) {
  -            return -4;
  +            return new Integer(-4);
           }
           if (!((String)v.elementAt(4)).equals("four")) {
  -            return -5;
  +            return new Integer(-5);
           }
           if (!((String)v.elementAt(5)).equals("five")) {
  -            return -6;
  +            return new Integer(-6);
           }
  -        return 0; // Success
  +        return new Integer(0); // Success
       }
   }
  
  
  

Mime
View raw message