axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/test/encoding DataSer.java TestHrefs.java TestSer.java TestString.java
Date Sun, 15 Jul 2001 16:40:17 GMT
gdaniels    01/07/15 09:40:17

  Modified:    java/samples/encoding DataSer.java TestSer.java
               java/samples/proxy client_deploy.xml
               java/src/org/apache/axis Message.java
               java/src/org/apache/axis/client ServiceClient.java
               java/src/org/apache/axis/encoding ArraySerializer.java
                        Base64Serializer.java BeanSerializer.java
                        BooleanDeserializerFactory.java DateSerializer.java
                        DeserializationContext.java Deserializer.java
                        DeserializerFactory.java
                        SOAPTypeMappingRegistry.java
                        TypeMappingRegistry.java
               java/src/org/apache/axis/handlers DebugHandler.java
               java/src/org/apache/axis/message DOMBody.java
                        InputStreamBody.java MessageElement.java
                        RPCElement.java RPCParam.java SAXOutputter.java
                        SOAPBodyElement.java SOAPEnvelope.java
                        SOAPFaultElement.java SOAPHeader.java
               java/src/org/apache/axis/transport/http AxisServlet.java
               java/test/RPCDispatch TestRPC.java
               java/test/encoding DataSer.java TestHrefs.java TestSer.java
                        TestString.java
  Added:       java/src/org/apache/axis/message BodyBuilder.java
                        EnvelopeBuilder.java EnvelopeHandler.java
                        HandlerFactory.java HeaderBuilder.java
                        IDResolver.java RPCHandler.java
                        SAX2EventRecorder.java SOAPHandler.java
                        SimpleHandlerFactory.java SymbolTable.java
  Removed:     java/src/org/apache/axis/encoding DeserializerBase.java
               java/src/org/apache/axis/message DebugHeader.java
                        ElementFactory.java ElementRecorder.java
                        ElementRegistry.java SAXAdapter.java
                        SOAPSAXHandler.java ThreadedSAXAdapter.java
               java/src/org/apache/axis/message/events CharactersEvent.java
                        EndElementEvent.java EndPrefixEvent.java
                        IDElementEvent.java SAXEvent.java
                        StartElementEvent.java StartPrefixEvent.java
  Log:
  Revamp parsing code.
  
  The DeserializationContext class is now the main "outer" SAX handler (what
  SOAPSAXHandler used to be), and it uses a much cleaner recursive
  descent style parse, delegating to SOAPHandlers which decide which
  handlers should be pushed onto a stack.
  
  The BodyBuilder/HeaderBuilder/EnvelopeBuilder handlers take care of
  building up the actual MessageElements inside the SOAPEnvelope.
  The HeaderBuilder is the place where we could consider adding custom
  per-Header parse-time behaviour.
  
  There is now an "IDResolver" interface, which will be used to handle things
  like MIME attachments and URL references eventually - right now the only
  concrete implementation is the LocalIDResolver.
  
  I switched to James' SAX2EventRecorder class, since it provides a clean
  interface to a "master" SAX recording for the whole message, which we've
  talked about needing in various scenarios.  It should also perform pretty
  well, as it builds many less objects than the "object per event" model.
  
  *** JAMES : I had problems getting the SymbolTable to work, so I diked
  out the complex string-management code and simply create a new
  String per symbol - can you take a look at getting the original version to
  work?  (pitfall warning - I had to change the indexes in the characters
  event in the replay() method to account for the String, so the start index
  is always zero at present)
  
  MessageElements are now mostly divorced from the actual deserialization
  process (i.e. they don't have a value member).
  
  *** ALL : to handle deserializing HREF/IDs in an efficient way, we should
  always let the Deserializers "push" values to us (via callbacks or FieldTargets
  or what have you) rather than trying to "pull" the value from the Dser at
  the end of an element.  We might even consider removing the
  Deserializer.getValue() method entirely, to enforce this model.
  
  I'm still not 100% happy with the modularization of the system, but it's better.
  The code needs more comments and cleanup, but I'm checking it in now so
  Sam can have something to test with.
  
  Anyways, everything works on my machine, so let's see how it flies on yours!
  
  Revision  Changes    Path
  1.6       +15 -7     xml-axis/java/samples/encoding/DataSer.java
  
  Index: DataSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/encoding/DataSer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DataSer.java	2001/07/08 14:18:36	1.5
  +++ DataSer.java	2001/07/15 16:40:00	1.6
  @@ -5,9 +5,10 @@
   import java.util.*;
   import java.io.*;
   import org.xml.sax.*;
  +import org.apache.axis.message.SOAPHandler;
   import org.apache.axis.utils.QName;
   
  -public class DataSer extends DeserializerBase implements Serializer
  +public class DataSer extends Deserializer implements Serializer
   {
       public static final String STRINGMEMBER = "stringMember";
       public static final String FLOATMEMBER = "floatMember";
  @@ -15,7 +16,7 @@
       public static final QName myTypeQName = new QName("typeNS", "Data");
       
       public static class DataSerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer(Class cls) {
  +        public Deserializer getDeserializer(Class cls) {
               return new DataSer();
           }
       }
  @@ -37,8 +38,10 @@
       /** DESERIALIZER STUFF - event handlers
        */
       
  -    public void onStartChild(String namespace, String localName,
  -                             String qName, Attributes attributes)
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
           throws SAXException
       {
           QName typeQName = (QName)typesByMemberName.get(localName);
  @@ -46,13 +49,18 @@
               throw new SAXException("Invalid element in Data struct - " + localName);
           
           // These can come in either order.
  -        DeserializerBase dSer = context.getDeserializer(typeQName);
  -        dSer.registerValueTarget(value, localName);
  +        Deserializer dSer = context.getTypeMappingRegistry().
  +                                                   getDeserializer(typeQName);
  +        try {
  +            dSer.registerValueTarget(value, localName);
  +        } catch (NoSuchFieldException e) {
  +            throw new SAXException(e);
  +        }
           
           if (dSer == null)
               throw new SAXException("No deserializer for a " + typeQName + "???");
           
  -        context.pushElementHandler(dSer);
  +        return dSer;
       }
       
       /** SERIALIZER STUFF
  
  
  
  1.9       +2 -2      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestSer.java	2001/06/11 12:30:33	1.8
  +++ TestSer.java	2001/07/15 16:40:00	1.9
  @@ -67,8 +67,8 @@
               TypeMappingRegistry reg = msgContext.getTypeMappingRegistry();
               reg.addDeserializerFactory(dataQName, Data.class, DataSer.getFactory());
               
  -            SAXAdapter adapter = new SAXAdapter(new InputSource(reader), msgContext);
  -            SOAPEnvelope env = adapter.getEnvelope();
  +            DeserializationContext dser = new DeserializationContext(new InputSource(reader), msgContext);
  +            SOAPEnvelope env = dser.getEnvelope();
               env.setMessageType(ServiceDescription.REQUEST);
               
               RPCElement rpcElem = (RPCElement)env.getFirstBody();
  
  
  
  1.2       +1 -1      xml-axis/java/samples/proxy/client_deploy.xml
  
  Index: client_deploy.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/proxy/client_deploy.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- client_deploy.xml	2001/07/10 22:52:38	1.1
  +++ client_deploy.xml	2001/07/15 16:40:01	1.2
  @@ -1,7 +1,7 @@
   <m:clientdeploy xmlns:m="AdminService">
     <handler name="TCPSender" class="samples.transport.tcp.TCPSender"/>
     <handler name="LogIt" class="org.apache.axis.handlers.LogMessage">
  -   <option name="message" value="Hey, I'm here!"/>
  +   <option name="message" value="This message courtesy of the LogMessage Handler!"/>
     </handler>
     <transport name="tcp" pivot="TCPSender" request="LogIt"/>
   </m:clientdeploy>
  
  
  
  1.38      +20 -4     xml-axis/java/src/org/apache/axis/Message.java
  
  Index: Message.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Message.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- Message.java	2001/07/12 15:02:55	1.37
  +++ Message.java	2001/07/15 16:40:01	1.38
  @@ -59,8 +59,10 @@
   
   import org.w3c.dom.* ;
   import org.xml.sax.*;
  +import javax.xml.parsers.SAXParser;
   
   import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.DeserializationContext;
   import org.apache.axis.message.* ;
   import org.apache.axis.utils.Debug ;
   import org.apache.axis.utils.XMLUtils ;
  @@ -175,7 +177,11 @@
           }
           
           if ( currentForm == FORM_BODYINSTREAM ) {
  -            getAsSOAPEnvelope();
  +            try {
  +                getAsSOAPEnvelope();
  +            } catch (Exception e) {
  +                return null;
  +            }
           }
   
           if ( currentForm == FORM_INPUTSTREAM ) {
  @@ -272,7 +278,9 @@
           return( null );
       }
   
  -    public SOAPEnvelope getAsSOAPEnvelope() {
  +    public SOAPEnvelope getAsSOAPEnvelope()
  +        throws AxisFault
  +    {
           Debug.Print( 2, "Enter: Message::getAsSOAPEnvelope; currentForm is "+
                           formNames[currentForm] );
           if ( currentForm == FORM_SOAPENVELOPE )
  @@ -294,9 +302,17 @@
           } else {
               is = new InputSource(new StringReader(getAsString()));
           }
  +        SAXParser parser = XMLUtils.getSAXParser();
  +        DeserializationContext dser = new DeserializationContext(msgContext);
           
  -        SAXAdapter parser = new SAXAdapter(is, msgContext, messageType);
  -        SOAPEnvelope env = parser.getEnvelope();
  +        // This may throw a SAXException
  +        try {
  +            parser.parse(is, dser);
  +        } catch (Exception e) {
  +            throw new AxisFault(e);
  +        }
  +
  +        SOAPEnvelope env = dser.getEnvelope();
           env.setMessageType(messageType);
           
           setCurrentMessage( env, FORM_SOAPENVELOPE );
  
  
  
  1.31      +0 -1      xml-axis/java/src/org/apache/axis/client/ServiceClient.java
  
  Index: ServiceClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/ServiceClient.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- ServiceClient.java	2001/07/10 22:52:48	1.30
  +++ ServiceClient.java	2001/07/15 16:40:02	1.31
  @@ -68,7 +68,6 @@
   import org.apache.axis.encoding.TypeMappingRegistry;
   import org.apache.axis.encoding.DeserializerFactory;
   import org.apache.axis.registries.HandlerRegistry;
  -import org.apache.axis.message.DebugHeader;
   import org.apache.axis.transport.http.HTTPTransport;
   
   import org.w3c.dom.* ;
  
  
  
  1.11      +38 -35    xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java
  
  Index: ArraySerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ArraySerializer.java	2001/07/12 15:03:27	1.10
  +++ ArraySerializer.java	2001/07/15 16:40:02	1.11
  @@ -56,7 +56,7 @@
    */
   
   import org.apache.axis.*;
  -import org.apache.axis.message.*;
  +import org.apache.axis.message.SOAPHandler;
   import org.apache.axis.utils.*;
   import org.xml.sax.*;
   import org.xml.sax.helpers.AttributesImpl;
  @@ -74,9 +74,10 @@
    * @author Glen Daniels (gdaniels@macromedia.com)
    */
   
  -public class ArraySerializer extends DeserializerBase
  +public class ArraySerializer extends Deserializer
       implements ValueReceiver, Serializer
   {
  +    private final static boolean DEBUG_LOG = false;
   
       static Hashtable primitives = new Hashtable();
       static {
  @@ -90,7 +91,7 @@
       }
   
       public static class Factory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer(Class cls) {
  +        public Deserializer getDeserializer(Class cls) {
               return new ArraySerializer();
           }
       }
  @@ -99,12 +100,16 @@
       public QName arrayType = null;
       public int curIndex = 0;
       QName arrayItemType;
  +    int length;
       
  -    public void startElement(String namespace, String localName,
  -                             String qName, Attributes attributes)
  +    public void onStartElement(String namespace, String localName,
  +                             String qName, Attributes attributes,
  +                             DeserializationContext context)
           throws SAXException
       {
  -        super.startElement(namespace, localName, qName, attributes);
  +        if (DEBUG_LOG) {
  +            System.err.println("In ArraySerializer.startElement()");
  +        }
           
           QName arrayTypeValue = context.getQNameFromString(
                                     attributes.getValue(Constants.URI_SOAP_ENC,
  @@ -153,7 +158,7 @@
   
               try
               {
  -                int length = Integer.parseInt(lengthStr);
  +                length = Integer.parseInt(lengthStr);
                   Class componentType = context.getTypeMappingRegistry().
                                                 getClassForQName(arrayItemType);
                   
  @@ -161,14 +166,6 @@
                       throw new SAXException("No component type for " +
                                              arrayItemType);
                   
  -                // Replace wrapper classes with primitive equivalents
  -                /*
  -                Object primitive = primitives.get(componentType);
  -                if (primitive != null) componentType = (Class) primitive;
  -
  -                value = Array.newInstance(componentType, length);
  -                */
  -                
                   value = new Vector(length);
                   ((Vector)value).setSize(length);
   
  @@ -180,39 +177,45 @@
                       lengthStr + "'.");
               }
           }
  +        
  +        if (DEBUG_LOG) {
  +            System.err.println("Out ArraySerializer.startElement()");
  +        }
       }
       
  -    public void onStartChild(String namespace, String localName,
  -                             String qName, Attributes attributes)
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
           throws SAXException
       {
  -        // !!! Check position attribute, type attribute....
  -        QName itemType = context.getTypeFromAttributes(attributes);
  -        /*
  -        if (itemType != null) {
  -        if (!arrayItemType.equals(itemType))
  -        throw new SAXException("Item type (" + itemType + ") didn't match ArrayType (" +
  -        arrayItemType + ")");
  +        if (DEBUG_LOG) {
  +            System.err.println("In ArraySerializer.onStartChild()");
           }
  -        */
  +        
  +        // !!! Check position attribute, type attribute....
  +        QName itemType = context.getTypeFromAttributes(namespace,
  +                                                       localName,
  +                                                       attributes);
           if (itemType == null)
               itemType = arrayItemType;
           
  -        DeserializerBase dSer = context.getDeserializer(itemType);
  +        Deserializer dSer = context.getTypeMappingRegistry().
  +                                        getDeserializer(itemType);
           dSer.registerCallback(this, new Integer(curIndex++));
  -        context.pushElementHandler(dSer);
  -    }
  -    
  -    public void onEndChild(String localName, DeserializerBase deserializer)
  -        throws SAXException
  -    {
  +        
  +        if (DEBUG_LOG) {
  +            System.err.println("Out ArraySerializer.onStartChild()");
  +        }
  +        return dSer;
       }
       
       public void valueReady(Object value, Object hint)
       {
  -        /*
  -        Array.set(this.value, ((Integer)hint).intValue(), value);
  -        */
  +        if (DEBUG_LOG) {
  +            System.err.println("ArraySerializer got value [" + hint +
  +                               "] = " + value);
  +        }
           ((Vector)this.value).set(((Integer)hint).intValue(), value);
       }
   
  
  
  
  1.3       +2 -2      xml-axis/java/src/org/apache/axis/encoding/Base64Serializer.java
  
  Index: Base64Serializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/Base64Serializer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Base64Serializer.java	2001/07/08 14:18:36	1.2
  +++ Base64Serializer.java	2001/07/15 16:40:03	1.3
  @@ -70,7 +70,7 @@
    */
   public class Base64Serializer implements Serializer {
   
  -    static class Base64Deser extends DeserializerBase {
  +    static class Base64Deser extends Deserializer {
           public void characters(char [] chars, int start, int end)
               throws SAXException
           {
  @@ -81,7 +81,7 @@
       static public class Base64DeserializerFactory 
           implements DeserializerFactory 
       {
  -        public DeserializerBase getDeserializer(Class cls) {return new Base64Deser();}
  +        public Deserializer getDeserializer(Class cls) {return new Base64Deser();}
       }
   
       /** 
  
  
  
  1.10      +9 -8      xml-axis/java/src/org/apache/axis/encoding/BeanSerializer.java
  
  Index: BeanSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/BeanSerializer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- BeanSerializer.java	2001/07/12 15:03:30	1.9
  +++ BeanSerializer.java	2001/07/15 16:40:03	1.10
  @@ -64,7 +64,7 @@
   import java.beans.IntrospectionException;
   import java.beans.PropertyDescriptor;
   
  -import org.apache.axis.encoding.*;
  +import org.apache.axis.message.SOAPHandler;
   import org.apache.axis.utils.Debug;
   import org.apache.axis.utils.QName;
   import org.apache.axis.utils.JavaUtils;
  @@ -76,7 +76,7 @@
    *
    * @author Sam Ruby <rubys@us.ibm.com>
    */
  -public class BeanSerializer extends DeserializerBase 
  +public class BeanSerializer extends Deserializer 
       implements Serializer, Serializable 
   {
   
  @@ -150,7 +150,7 @@
       public static class BeanSerFactory implements DeserializerFactory {
           private Hashtable propertyDescriptors = new Hashtable();
   
  -        public DeserializerBase getDeserializer(Class cls) {
  +        public Deserializer getDeserializer(Class cls) {
               PropertyDescriptor [] pd =
                     (PropertyDescriptor [])propertyDescriptors.get(cls);
               
  @@ -217,8 +217,10 @@
        * Deserializer interface called on each child element encountered in
        * the XML stream.
        */
  -    public void onStartChild(String namespace, String localName,
  -                             String qName, Attributes attributes)
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
           throws SAXException
       {
           PropertyDescriptor[] pd = getPd();
  @@ -246,15 +248,14 @@
                                              pd[i].getPropertyType());
   
                   // get the deserializer
  -                DeserializerBase dSer = context.getDeserializer(qn);
  +                Deserializer dSer = tmr.getDeserializer(qn);
                   if (dSer == null)
                       throw new SAXException("No deserializer for " + 
                                              pd[i].getPropertyType());
   
                   // Success!  Register the target and deserializer.
                   dSer.registerValueTarget(new PropertyTarget(value, pd[i]));
  -                context.pushElementHandler(dSer);
  -                return;
  +                return dSer;
               }
           }
   
  
  
  
  1.4       +2 -2      xml-axis/java/src/org/apache/axis/encoding/BooleanDeserializerFactory.java
  
  Index: BooleanDeserializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/BooleanDeserializerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BooleanDeserializerFactory.java	2001/07/08 14:18:37	1.3
  +++ BooleanDeserializerFactory.java	2001/07/15 16:40:03	1.4
  @@ -75,7 +75,7 @@
    */
   public class BooleanDeserializerFactory implements DeserializerFactory {
   
  -    static class BooleanDeser extends DeserializerBase {
  +    static class BooleanDeser extends Deserializer {
           public void characters(char [] chars, int start, int end)
               throws SAXException
           {
  @@ -94,6 +94,6 @@
           }
       }
   
  -    public DeserializerBase getDeserializer(Class cls) { return new BooleanDeser(); }
  +    public Deserializer getDeserializer(Class cls) { return new BooleanDeser(); }
   
   }
  
  
  
  1.7       +1 -1      xml-axis/java/src/org/apache/axis/encoding/DateSerializer.java
  
  Index: DateSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DateSerializer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DateSerializer.java	2001/07/12 15:03:31	1.6
  +++ DateSerializer.java	2001/07/15 16:40:03	1.7
  @@ -159,7 +159,7 @@
       }
   
       static public class DateDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer(Class cls) { return new DateDeser(); }
  +        public Deserializer getDeserializer(Class cls) { return new DateDeser(); }
       }
   
       /** 
  
  
  
  1.15      +396 -44   xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.java
  
  Index: DeserializationContext.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializationContext.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DeserializationContext.java	2001/07/12 15:03:31	1.14
  +++ DeserializationContext.java	2001/07/15 16:40:04	1.15
  @@ -55,61 +55,127 @@
    * <http://www.apache.org/>.
    */
   
  -import org.xml.sax.*;
  +import java.io.*;
   import java.util.*;
  -import org.apache.axis.Constants;
  -import org.apache.axis.encoding.*;
  +import javax.xml.parsers.SAXParser;
  +import org.apache.axis.*;
   import org.apache.axis.message.*;
  +import org.apache.axis.utils.Debug;
  +import org.apache.axis.utils.NSStack;
   import org.apache.axis.utils.QName;
  -import org.apache.axis.MessageContext;
  -import org.apache.axis.encoding.ServiceDescription;
  +import org.apache.axis.utils.XMLUtils;
  +import org.xml.sax.*;
  +import org.xml.sax.helpers.DefaultHandler;
   
  -/** Keeps track of the active typeMappings, element IDs, parser, and
  - * SOAPSAXHandler in an ongoing parse.  Might want to move the
  - * storage for the namespace/prefix mappings into here too...
  - * 
  - * @author Glen Daniels (gdaniels@allaire.com)
  +/** 
  + * @author Glen Daniels (gdaniels@macromedia.com)
    */
   
  -public class DeserializationContext
  +public class DeserializationContext extends DefaultHandler
   {
  -    public SOAPSAXHandler baseHandler;
  -    public Hashtable idMappings = new Hashtable();
  +    private static final boolean DEBUG_LOG = false;
       
  -    private MessageContext msgContext;
  -    private String messageType;
  -
  -    public DeserializationContext(SOAPSAXHandler baseHandler, 
  -                                  MessageContext msgContext,
  -                                  String messageType)
  +    static class LocalIDResolver implements IDResolver
  +    {
  +        HashMap idMap = null;
  +        
  +        public void addIDMapping(String id, Object referent)
  +        {
  +            if (idMap == null)
  +                idMap = new HashMap();
  +            
  +            idMap.put(id, referent);
  +        }
  +        
  +        public Object getReferencedObject(String href)
  +        {
  +            if ((idMap == null) || (href == null))
  +                return null;
  +            return idMap.get(href);
  +        }
  +    }
  +    
  +    private NSStack namespaces = new NSStack();
  +    
  +    private Locator locator;
  +                                             
  +    Stack handlerStack = new Stack();
  +    
  +    SAX2EventRecorder recorder = new SAX2EventRecorder();
  +    public SOAPEnvelope envelope;
  +    
  +    /** A map of IDs -> IDResolvers
  +     */
  +    HashMap idMap;
  +    LocalIDResolver localIDs;
  +    
  +    HashMap fixups;
  +    
  +    static final SOAPHandler nullHandler = new SOAPHandler();
  +    
  +    protected MessageContext msgContext;
  +    
  +    protected HandlerFactory initialFactory;
  +    
  +    protected boolean doneParsing = false;
  +    protected InputSource inputSource = null;
  +        
  +    public DeserializationContext(MessageContext ctx)
       {
  -        this.baseHandler = baseHandler;
  -        this.msgContext  = msgContext;
  -        this.messageType = messageType;
  +        msgContext = ctx;
  +        
  +        envelope = new SOAPEnvelope();
  +        envelope.setRecorder(recorder);
  +        
  +        pushElementHandler(new EnvelopeHandler());
       }
       
  -    public SOAPSAXHandler getSAXHandler()
  +    public DeserializationContext(InputSource is, MessageContext ctx)
       {
  -        return baseHandler;
  +        this(ctx);
  +        inputSource = is;
       }
       
  -    public void pushElementHandler(DeserializerBase handler)
  +    public void parse() throws SAXException
       {
  -        baseHandler.pushElementHandler(handler);    
  +        if (inputSource != null) {
  +            SAXParser parser = XMLUtils.getSAXParser();
  +            try {
  +                parser.parse(inputSource, this);
  +            } catch (IOException e) {
  +                throw new SAXException(e);
  +            }
  +            inputSource = null;
  +        }
       }
       
  -    public String getNamespaceURI(String prefix)
  +    public MessageContext getMessageContext()
  +    {
  +        return msgContext;
  +    }
  +    
  +    public SOAPEnvelope getEnvelope()
  +    {
  +        return envelope;
  +    }
  +    
  +    public SAX2EventRecorder getRecorder()
       {
  -        return (String)baseHandler.getNamespaceURI(prefix);
  +        return recorder;
       }
       
  -    public String getMessageType()
  +    /** Grab a namespace prefix
  +     */
  +    public String getNamespaceURI(String prefix)
       {
  -        return messageType;
  +        return namespaces.getNamespaceURI(prefix);
       }
       
       public QName getQNameFromString(String qNameStr)
       {
  +        if (qNameStr == null)
  +            return null;
  +        
           // OK, this is a QName, so look up the prefix in our current mappings.
           
           int i = qNameStr.indexOf(":");
  @@ -126,8 +192,37 @@
           return new QName(nsURI, qNameStr.substring(i + 1));
       }
       
  -    public QName getTypeFromAttributes(Attributes attrs)
  +    public QName getTypeFromAttributes(String namespace, String localName,
  +                                       Attributes attrs)
       {
  +        QName typeQName = null;
  +        
  +        if (typeQName == null) {
  +            QName myQName = new QName(namespace, localName);
  +            if (myQName.equals(SOAPTypeMappingRegistry.SOAP_ARRAY)) {
  +                typeQName = SOAPTypeMappingRegistry.SOAP_ARRAY;
  +            } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_STRING)) {
  +                typeQName = SOAPTypeMappingRegistry.XSD_STRING;
  +            } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_BOOLEAN)) {
  +                typeQName = SOAPTypeMappingRegistry.XSD_BOOLEAN;
  +            } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_DOUBLE)) {
  +                typeQName = SOAPTypeMappingRegistry.XSD_DOUBLE;
  +            } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_FLOAT)) {
  +                typeQName = SOAPTypeMappingRegistry.XSD_FLOAT;
  +            } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_INT)) {
  +                typeQName = SOAPTypeMappingRegistry.XSD_INT;
  +            } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_LONG)) {
  +                typeQName = SOAPTypeMappingRegistry.XSD_LONG;
  +            } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_SHORT)) {
  +                typeQName = SOAPTypeMappingRegistry.XSD_SHORT;
  +            } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_BYTE)) {
  +                typeQName = SOAPTypeMappingRegistry.XSD_BYTE;
  +            }
  +        }
  +
  +        if (typeQName != null)
  +            return typeQName;
  +        
           if (attrs == null)
               return null;
           
  @@ -138,7 +233,7 @@
           
           if (type == null)
               return null;
  -        
  +
           return getQNameFromString(type);
       }
       
  @@ -152,27 +247,284 @@
           return msgContext.getTypeMappingRegistry();
       }
       
  -    public MessageContext getMessageContext()
  +    public Object getObjectByRef(String href)
       {
  -        return msgContext;
  +        if ((idMap == null) || (href == null))
  +            return null;
  +        
  +        IDResolver resolver = (IDResolver)idMap.get(href);
  +        if (resolver == null)
  +            return null;
  +        
  +        return resolver.getReferencedObject(href);
  +    }
  +    
  +    public void registerFixup(String id, Deserializer dser)
  +    {
  +        if (fixups == null)
  +            fixups = new HashMap();
  +        
  +        fixups.put(id, dser);
  +    }
  +    
  +    public void registerElementByID(String id, MessageElement elem)
  +    {
  +        if (localIDs == null)
  +            localIDs = new LocalIDResolver();
  +        
  +        String absID = "#" + id;
  +        
  +        localIDs.addIDMapping(absID, elem);
  +        
  +        registerResolverForID(absID, localIDs);
  +        
  +        if (fixups != null) {
  +            Deserializer dser = (Deserializer)fixups.get(absID);
  +            if (dser != null) {
  +                elem.setFixupDeserializer(dser);
  +            }
  +        }
  +    }
  +    
  +    public void registerResolverForID(String id, IDResolver resolver)
  +    {
  +        if ((id == null) || (resolver == null)) {
  +            // ??? Throw nullPointerException?
  +            return;
  +        }
  +        
  +        if (idMap == null)
  +            idMap = new HashMap();
  +        
  +        idMap.put(id, resolver);
  +    }
  +    
  +    public int getCurrentRecordPos()
  +    {
  +        if (recorder == null) return -1;
  +        return recorder.getLength() - 1;
  +    }
  +    
  +    /****************************************************************
  +     * Management of sub-handlers (deserializers)
  +     */
  +    
  +    public SOAPHandler getTopHandler()
  +    {
  +        try {
  +            return (SOAPHandler)handlerStack.peek();
  +        } catch (Exception e) {
  +            return null;
  +        }
  +    }
  +    
  +    public void pushElementHandler(SOAPHandler handler)
  +    {
  +        if (DEBUG_LOG) {
  +            System.out.println("Pushing handler " + handler);
  +        }
  +        
  +        handlerStack.push(handler);
  +    }
  +    
  +    /** Replace the handler at the top of the stack.
  +     * 
  +     * This is only used when we have a placeholder Deserializer
  +     * for a referenced object which doesn't know its type until we
  +     * hit the referent.
  +     */
  +    void replaceElementHandler(SOAPHandler handler)
  +    {
  +        handlerStack.pop();
  +        handlerStack.push(handler);
  +    }
  +    
  +    public SOAPHandler popElementHandler()
  +    {
  +        if (!handlerStack.empty()) {
  +            SOAPHandler handler = getTopHandler();
  +            if (DEBUG_LOG) {
  +                System.out.println("Popping handler " + handler);
  +            }
  +            handlerStack.pop();
  +            return handler;
  +        } else {
  +            if (DEBUG_LOG) {
  +                System.out.println("Popping handler...(null)");
  +            }
  +            return null;
  +        }
       }
       
  -    public void registerID(String id, MessageElement element)
  +    /****************************************************************
  +     * SAX event handlers
  +     */
  +    public void startDocument() throws SAXException {
  +        // Should never receive this in the midst of a parse.
  +        if (recorder != null)
  +            recorder.startDocument();
  +    }
  +    
  +    public void endDocument() throws SAXException {
  +        if (DEBUG_LOG) {
  +            System.err.println("EndDocument");
  +        }
  +        if (recorder != null)
  +            recorder.endDocument();
  +    }
  +    
  +    /** Record the current set of prefix mappings in the nsMappings table.
  +     *
  +     * !!! We probably want to have this mapping be associated with the
  +     *     MessageElements, since they may potentially need access to them
  +     *     long after the end of the prefix mapping here.  (example:
  +     *     when we need to record a long string of events scanning forward
  +     *     in the document to find an element with a particular ID.)
  +     */
  +    public void startPrefixMapping(String prefix, String uri)
  +        throws SAXException
       {
  -        // Throw an exception if already registered?
  -        idMappings.put(id, element);
  +        if (recorder != null)
  +            recorder.startPrefixMapping(prefix, uri);
  +        
  +        if (prefix != null) {
  +            namespaces.add(uri, prefix);
  +        } else {
  +            namespaces.add(uri, "");
  +        }
  +       
  +        if (DEBUG_LOG) {
  +            System.err.println("StartPrefixMapping '" + prefix + "'->'" + uri + "'");
  +        }
  +        
  +        SOAPHandler handler = getTopHandler();
  +        if (handler != null)
  +            handler.startPrefixMapping(prefix, uri);
  +    }
  +    
  +    public void endPrefixMapping(String prefix)
  +        throws SAXException
  +    {
  +        if (DEBUG_LOG) {
  +            System.err.println("EndPrefixMapping '" + prefix + "'");
  +        }
  +        
  +        if (recorder != null)
  +            recorder.endPrefixMapping(prefix);
  +        
  +        SOAPHandler handler = getTopHandler();
  +        if (handler != null)
  +            handler.endPrefixMapping(prefix);
       }
       
  -    public MessageElement getElementByID(String id)
  +    public void setDocumentLocator(Locator locator) 
  +    {
  +        if (recorder != null)
  +            recorder.setDocumentLocator(locator);
  +        this.locator = locator;
  +    }
  +
  +    public void characters(char[] p1, int p2, int p3) throws SAXException {
  +        if (recorder != null)
  +            recorder.characters(p1, p2, p3);
  +        if (getTopHandler() != null)
  +            getTopHandler().characters(p1, p2, p3);
  +    }
  +    
  +    public void ignorableWhitespace(char[] p1, int p2, int p3) throws SAXException {
  +        if (recorder != null)
  +            recorder.ignorableWhitespace(p1, p2, p3);
  +        if (getTopHandler() != null)
  +            getTopHandler().ignorableWhitespace(p1, p2, p3);
  +    }
  + 
  +    public void processingInstruction(String p1, String p2) throws SAXException {
  +        // must throw an error since SOAP 1.1 doesn't allow
  +        // processing instructions anywhere in the message
  +        throw new SAXException("Processing instructions are not allowed within SOAP Messages");
  +    }
  +
  +    public void skippedEntity(String p1) throws SAXException {
  +        if (recorder != null)
  +            recorder.skippedEntity(p1);
  +        getTopHandler().skippedEntity(p1);
  +    }
  +
  +    /** This is a big workhorse.  Manage the state of the parser, check for
  +     * basic SOAP compliance (envelope, then optional header, then body, etc).
  +     * 
  +     * This guy also handles monitoring the recording depth if we're recording
  +     * (so we know when to stop), and might eventually do things to help with
  +     * ID/HREF management as well.
  +     * 
  +     */
  +    public void startElement(String namespace, String localName,
  +                             String qName, Attributes attributes)
  +        throws SAXException
       {
  -        return (MessageElement)idMappings.get(id);
  +        SOAPHandler nextHandler = null;
  +
  +        if (DEBUG_LOG) {
  +            System.out.println("startElement ['" + namespace + "' " +
  +                           localName + "]");
  +        }
  +        
  +        namespaces.push();
  +        
  +        if (recorder != null)
  +            recorder.startElement(namespace, localName, qName,
  +                                  attributes);
  +
  +        if (!handlerStack.isEmpty()) {
  +            nextHandler = getTopHandler().onStartChild(namespace,
  +                                                       localName,
  +                                                       attributes,
  +                                                       this);
  +        }
  +        /*else {
  +            nextHandler = initialFactory.getHandler(namespace,
  +                                                localName,
  +                                                attributes,
  +                                                this);
  +        }
  +        */
  +        
  +        if (nextHandler == null)
  +            nextHandler = nullHandler;
  +        
  +        pushElementHandler(nextHandler);
  +        
  +        nextHandler.startElement(namespace, localName, qName,
  +                                 attributes, this);
       }
       
  -    public DeserializerBase getDeserializer(QName qName)
  +    public void endElement(String namespace, String localName, String qName)
  +        throws SAXException
       {
  -        DeserializerBase dSer = getTypeMappingRegistry().getDeserializer(qName);
  -        if (dSer != null)
  -            dSer.setDeserializationContext(this);
  -        return dSer;
  +        if (DEBUG_LOG) {
  +            System.out.println("endElement ['" + namespace + "' " +
  +                           localName + "]");
  +        }
  +        
  +        if (recorder != null)
  +            recorder.endElement(namespace, localName, qName);
  +        
  +        try {
  +            SOAPHandler handler = popElementHandler();
  +            handler.endElement(namespace, localName, this);
  +            
  +            if (!handlerStack.isEmpty()) {
  +                getTopHandler().onEndChild(namespace, localName, this);
  +            } else {
  +                // We should be done!
  +                if (DEBUG_LOG) {
  +                    System.out.println("Done with document!");
  +                }
  +            }
  +            
  +        } catch (SAXException e) {
  +            e.printStackTrace();
  +        }
       }
   }
  +
  
  
  
  1.4       +219 -8    xml-axis/java/src/org/apache/axis/encoding/Deserializer.java
  
  Index: Deserializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/Deserializer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Deserializer.java	2001/04/29 17:25:00	1.3
  +++ Deserializer.java	2001/07/15 16:40:04	1.4
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -55,14 +55,225 @@
   
   package org.apache.axis.encoding;
   
  -//import org.apache.axis.message.MessageElement;
  -import org.w3c.dom.Element;
  +import org.xml.sax.*;
  +import org.xml.sax.helpers.*;
   
  -/**
  - * @author James Snell (jasnell@us.ibm.com)
  +import org.apache.axis.Constants;
  +import org.apache.axis.message.*;
  +import org.apache.axis.utils.QName;
  +
  +import java.util.*;
  +import java.lang.reflect.*;
  +import java.lang.*;
  +
  +/** The Deserializer base class.
  + * 
  + * Still needs some work.
  + * 
  + * @author Glen Daniels (gdaniels@allaire.com)
    */
  -public interface Deserializer { 
  +
  +public class Deserializer extends SOAPHandler
  +{
  +    private static final boolean DEBUG_LOG = false;
  +    
  +    protected Object value = null;
  +    //protected DeserializationContext context = null;
  +    protected boolean isComplete = false;
  +
  +    protected Vector targets = null;
  +    
  +    public Object getValue()
  +    {
  +        return value;
  +    }
  +    public void setValue(Object value)
  +    {
  +        this.value = value;
  +    }
  +
  +    /////////////////////////////////////////////////////////////
  +    //  Reflection-based insertion of values into target objects
  +    //  once deserialization is complete.
  +    //
  +    interface Target {
  +        public void set(Object value) throws SAXException;
  +
  +    }
  +
  +    public static class FieldTarget implements Target {
  +        private Object targetObject;
  +        private Field targetField;
  +
  +        public FieldTarget(Object targetObject, Field targetField)
  +        {
  +            this.targetObject = targetObject;
  +            this.targetField = targetField;
  +        }
  +        
  +        public FieldTarget(Object targetObject, String fieldName)
  +            throws NoSuchFieldException
  +        {
  +            Class cls = targetObject.getClass();
  +            targetField = cls.getField(fieldName);
  +            this.targetObject = targetObject;
  +        }
  +
  +        public void set(Object value) throws SAXException {
  +            try {
  +                targetField.set(targetObject, value);
  +            } catch (IllegalAccessException accEx) {
  +                accEx.printStackTrace();
  +                throw new SAXException(accEx);
  +            } catch (IllegalArgumentException argEx) {
  +                argEx.printStackTrace();
  +                throw new SAXException(argEx);
  +            }
  +        }
  +    }
  +
  +    class CallbackTarget implements Target {
  +        public ValueReceiver target;
  +        public Object hint;
  +        CallbackTarget(ValueReceiver target, Object hint)
  +        {
  +            this.target = target;
  +            this.hint = hint;
  +        }
  +        
  +        public void set(Object value) throws SAXException {
  +            target.valueReady(value, hint);
  +        }
  +    }
  +
  +    public void registerCallback(ValueReceiver target, Object hint)
  +    {
  +        if (target == null)
  +            return;
  +        
  +        registerValueTarget(new CallbackTarget(target, hint));
  +    }
  +    
  +
  +    public void registerValueTarget(Target target)
  +    {
  +        if (targets == null)
  +            targets = new Vector();
  +        
  +        targets.addElement(target);
  +    }
  +    
  +    public void registerValueTarget(Object target, String fieldName)
  +        throws NoSuchFieldException
  +    {
  +        registerValueTarget(new FieldTarget(target, fieldName));
  +    }
  +    
  +    /** Add someone else's targets to our own (see DeserializationContext)
  +     * 
  +     */
  +    public void copyValueTargets(Deserializer other)
  +    {
  +        if ((other == null) || (other.targets == null))
  +            return;
  +        
  +        if (targets == null)
  +            targets = new Vector();
  +        
  +        Enumeration e = other.targets.elements();
  +        while (e.hasMoreElements()) {
  +            targets.addElement(e.nextElement());
  +        }
  +    }
  +    
  +    /** 
  +     * Store the value into the target
  +     */
  +    public void valueComplete() throws SAXException
  +    {
  +        isComplete = true;
  +        
  +        if (targets != null) {
  +            Enumeration e = targets.elements();
  +            while (e.hasMoreElements()) {
  +                Target target = (Target)e.nextElement();
  +                target.set(value);
  +                if (DEBUG_LOG) {
  +                    System.out.println("Set value " + value + " in target " +
  +                                       target);
  +                }
  +            }
  +        }
  +    }
  +    
  +    /** Subclasses override this
  +     */
  +    public void onStartElement(String namespace, String localName,
  +                             String qName, Attributes attributes,
  +                             DeserializationContext context)
  +        throws SAXException
  +    {
  +        // If I'm the base class, try replacing myself with an
  +        // appropriate deserializer gleaned from type info.
  +        if (this.getClass().equals(Deserializer.class)) {
  +            QName type = context.getTypeFromAttributes(namespace,
  +                                                       localName,
  +                                                       attributes);
  +            
  +            // We know we're deserializing, and we can't seem to figure
  +            // out a type... so let's give them a string.
  +            // ??? Is this the right thing to do?
  +            if (type == null)
  +                type = SOAPTypeMappingRegistry.XSD_STRING;
  +            
  +            Deserializer dser = 
  +                       context.getTypeMappingRegistry().getDeserializer(type);
  +            if (dser != null) {
  +                dser.copyValueTargets(this);
  +                context.replaceElementHandler(dser);
  +                // And don't forget to give it the start event...
  +                dser.startElement(namespace, localName, qName,
  +                                  attributes, context);
  +            }
  +        }
  +    }
  +    
  +    public final void startElement(String namespace, String localName,
  +                             String qName, Attributes attributes,
  +                             DeserializationContext context)
  +        throws SAXException
  +    {
  +        String href = attributes.getValue("href");
  +        if (href != null) {
  +            Object ref = context.getObjectByRef(href);
  +            
  +            if (DEBUG_LOG) {
  +                System.out.println("Got " + ref + " for ID " + href);
  +            }
  +            
  +            if (ref == null) {
  +                // Nothing yet... register for later interest.
  +                context.registerFixup(href, this);
  +            }
  +            
  +            if (ref instanceof MessageElement) {
  +                SAX2EventRecorder r = context.recorder;
  +                context.recorder = null;
  +                ((MessageElement)ref).publishContents(context);
  +                context.recorder = r;
  +            }
  +            
  +            // !!! INSERT DEALING WITH ATTACHMENTS STUFF HERE?
  +        } else {
  +            onStartElement(namespace, localName, qName, attributes,
  +                           context);
  +        }
  +    }
       
  -    //public Object deserialize(MessageElement element, TypeMappingRegistry tmr);
  -    public Object deserialize(Element element, TypeMappingRegistry tmr);    
  +    public void endElement(String namespace, String localName,
  +                           DeserializationContext context)
  +        throws SAXException
  +    {
  +        valueComplete();
  +    }
   }
  
  
  
  1.4       +1 -1      xml-axis/java/src/org/apache/axis/encoding/DeserializerFactory.java
  
  Index: DeserializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializerFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DeserializerFactory.java	2001/07/08 14:18:37	1.3
  +++ DeserializerFactory.java	2001/07/15 16:40:04	1.4
  @@ -2,5 +2,5 @@
   
   public interface DeserializerFactory extends java.io.Serializable
   {
  -    public DeserializerBase getDeserializer(Class cls);
  +    public Deserializer getDeserializer(Class cls);
   }
  
  
  
  1.28      +15 -4     xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java
  
  Index: SOAPTypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- SOAPTypeMappingRegistry.java	2001/07/12 15:03:33	1.27
  +++ SOAPTypeMappingRegistry.java	2001/07/15 16:40:04	1.28
  @@ -56,6 +56,7 @@
   package org.apache.axis.encoding;
   
   import org.apache.axis.Constants;
  +import org.apache.axis.message.SOAPHandler;
   import org.apache.axis.utils.QName;
   import org.xml.sax.*;
   
  @@ -104,7 +105,7 @@
       }
       
       public static class ObjDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer(Class cls) { return null; }
  +        public Deserializer getDeserializer(Class cls) { return null; }
       }
       public static class ObjSerializer implements Serializer {
           public void serialize(QName name, Attributes attributes,
  @@ -115,16 +116,26 @@
           }
       }
   
  -    public static abstract class BasicDeser extends DeserializerBase {
  +    public static abstract class BasicDeser extends Deserializer {
           StringBuffer val = new StringBuffer();
           
  +        public SOAPHandler onStartChild(String namespace,
  +                                        String localName,
  +                                        Attributes attributes,
  +                                        DeserializationContext context)
  +            throws SAXException
  +        {
  +            throw new SAXException("Basic deser can't handle structured data!");
  +        }
  +        
           public void characters(char [] chars, int start, int end)
               throws SAXException
           {
               val.append(chars, start, end);
           }
  +        
           public void endElement(String namespace, String localName,
  -                               String qName)
  +                               DeserializationContext context)
               throws SAXException
           {
               try {
  @@ -169,7 +180,7 @@
       }
       
       public static class BasicDeserializerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer(Class cls)
  +        public Deserializer getDeserializer(Class cls)
           {
               return new BasicDeserializer(cls);
           }
  
  
  
  1.20      +1 -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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- TypeMappingRegistry.java	2001/07/12 15:03:34	1.19
  +++ TypeMappingRegistry.java	2001/07/15 16:40:05	1.20
  @@ -173,7 +173,7 @@
           return null;
       }
       
  -    public DeserializerBase getDeserializer(QName qname) {
  +    public Deserializer getDeserializer(QName qname) {
           if (d != null) {
               DeserializerDescriptor desc = (DeserializerDescriptor)d.get(qname);
               if ((desc != null) && (desc.factory != null))
  
  
  
  1.17      +2 -1      xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java
  
  Index: DebugHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/DebugHandler.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DebugHandler.java	2001/07/08 14:18:38	1.16
  +++ DebugHandler.java	2001/07/15 16:40:07	1.17
  @@ -60,7 +60,6 @@
   import org.apache.axis.* ;
   import org.apache.axis.encoding.*;
   import org.apache.axis.utils.* ;
  -import org.apache.axis.message.DebugHeader;
   import org.apache.axis.message.SOAPEnvelope;
   import org.apache.axis.message.SOAPHeader;
   
  @@ -82,6 +81,7 @@
                                                           "Debug");
               
               if (header != null) {
  +                /*
                   int debugVal = 
                         ((Integer)header
                                .getValueAsType(SOAPTypeMappingRegistry.XSD_INT))
  @@ -89,6 +89,7 @@
                   Debug.Print( 1, "Setting debug level to: " + debugVal );
                   Debug.setDebugLevel(debugVal);
                   header.setProcessed(true);
  +                */
               }
           }
           catch( Exception e ) {
  
  
  
  1.3       +1 -1      xml-axis/java/src/org/apache/axis/message/DOMBody.java
  
  Index: DOMBody.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/DOMBody.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DOMBody.java	2001/04/30 05:24:16	1.2
  +++ DOMBody.java	2001/07/15 16:40:07	1.3
  @@ -16,7 +16,7 @@
           this.element = element;
       }
       
  -    public void output(SerializationContext context) throws IOException
  +    public void outputImpl(SerializationContext context) throws IOException
       {
           outputElement(element, context);
       }
  
  
  
  1.2       +1 -1      xml-axis/java/src/org/apache/axis/message/InputStreamBody.java
  
  Index: InputStreamBody.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/InputStreamBody.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InputStreamBody.java	2001/04/27 15:29:47	1.1
  +++ InputStreamBody.java	2001/07/15 16:40:08	1.2
  @@ -14,7 +14,7 @@
           this.inputStream = inputStream;
       }
       
  -    public void output(SerializationContext context) throws IOException
  +    public void outputImpl(SerializationContext context) throws IOException
       {
           try {
               byte[]  buf = new byte[ inputStream.available() ];
  
  
  
  1.32      +94 -251   xml-axis/java/src/org/apache/axis/message/MessageElement.java
  
  Index: MessageElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/MessageElement.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- MessageElement.java	2001/07/12 16:47:56	1.31
  +++ MessageElement.java	2001/07/15 16:40:08	1.32
  @@ -61,16 +61,18 @@
   import org.w3c.dom.*;
   import org.apache.axis.Constants;
   import org.apache.axis.AxisFault;
  +import org.apache.axis.encoding.Deserializer;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.SOAPTypeMappingRegistry;
   import org.apache.axis.MessageContext;
  -import org.apache.axis.message.events.*;
  -import org.apache.axis.encoding.*;
   import org.apache.axis.utils.Debug;
   import org.apache.axis.utils.QName;
   import org.apache.axis.utils.DOM2Writer;
   import java.util.*;
   import java.io.*;
   
  -public class MessageElement extends DeserializerBase
  +public class MessageElement
   {
       private static final boolean DEBUG_LOG = false;
       
  @@ -83,19 +85,20 @@
       protected boolean   isRoot = true;
       protected SOAPEnvelope message = null;
       
  +    protected DeserializationContext context;
  +    
       // The java Object value of this element.  This is either set by
       // deserialization, or by the user creating a message.
       protected QName typeQName = null;
       
       protected Vector qNameAttrs = null;
  -    
  -    // String representation of this element.
  -    protected String stringRep = null;
  -    
  -    protected ElementRecorder recorder = null;
  -    protected DeserializerBase deserializer = null;
  -    protected Boolean deserializing = null;
   
  +    public Hashtable nsDecls = new Hashtable();
  +                                            
  +    protected SAX2EventRecorder recorder = null;
  +    protected int startEventIndex = 0;
  +    protected int endEventIndex = -1;
  +
       /** No-arg constructor for building messages?
        */
       MessageElement()
  @@ -109,96 +112,62 @@
       }
       
       MessageElement(String namespace, String localPart,
  -                    Attributes attributes, DeserializationContext context)
  +                   Attributes attributes, DeserializationContext context)
       {
           if (DEBUG_LOG) {
  -            System.out.println("New MessageElement named " + localPart);
  +            System.out.println("New MessageElement (" + this + ") named " + localPart);
               for (int i = 0; attributes != null && i < attributes.getLength(); i++) {
                   System.out.println("  " + attributes.getQName(i) + " = '" + attributes.getValue(i) + "'");
               }
           }
  -      this.namespaceURI = namespace;
  -      this.name = localPart;
  -      setDeserializationContext(context);
  -
  -      if (attributes == null) {
  -        this.attributes = new AttributesImpl();
  -      } else {
  -        typeQName = context.getTypeFromAttributes(attributes);
  +        this.namespaceURI = namespace;
  +        this.name = localPart;
  +        this.context = context;
  +        this.startEventIndex = context.getCurrentRecordPos();
  +        this.recorder = context.getRecorder();
   
  -        this.attributes = new AttributesImpl(attributes);
  -        String rootVal = attributes.getValue(Constants.URI_SOAP_ENV, Constants.ATTR_ROOT);
  -        if (rootVal != null)
  -            isRoot = rootVal.equals("1");
  -      
  -        id = attributes.getValue(Constants.ATTR_ID);
  -        // Register this ID with the context.....
  -        if (id != null) {
  -            context.registerID(id, this);
  -        }
  +        if (attributes == null) {
  +            this.attributes = new AttributesImpl();
  +        } else {
  +            this.attributes = new AttributesImpl(attributes);
  +            String rootVal = attributes.getValue(Constants.URI_SOAP_ENC, Constants.ATTR_ROOT);
  +            if (rootVal != null)
  +                isRoot = rootVal.equals("1");
               
  -        href = attributes.getValue(Constants.ATTR_HREF);
  -        
  -        // If there's an arrayType attribute, we can pretty well guess that we're an Array???
  -        if (attributes.getValue(Constants.URI_SOAP_ENC, Constants.ATTR_ARRAY_TYPE) != null)
  -          typeQName = SOAPTypeMappingRegistry.SOAP_ARRAY;
  -      }
  -
  -      if (typeQName == null) {
  -          QName myQName = new QName(namespaceURI, name);
  -          if (myQName.equals(SOAPTypeMappingRegistry.SOAP_ARRAY)) {
  -              typeQName = SOAPTypeMappingRegistry.SOAP_ARRAY;
  -          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_STRING)) {
  -              typeQName = SOAPTypeMappingRegistry.XSD_STRING;
  -          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_BOOLEAN)) {
  -              typeQName = SOAPTypeMappingRegistry.XSD_BOOLEAN;
  -          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_DOUBLE)) {
  -              typeQName = SOAPTypeMappingRegistry.XSD_DOUBLE;
  -          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_FLOAT)) {
  -              typeQName = SOAPTypeMappingRegistry.XSD_FLOAT;
  -          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_INT)) {
  -              typeQName = SOAPTypeMappingRegistry.XSD_INT;
  -          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_LONG)) {
  -              typeQName = SOAPTypeMappingRegistry.XSD_LONG;
  -          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_SHORT)) {
  -              typeQName = SOAPTypeMappingRegistry.XSD_SHORT;
  -          } else if (myQName.equals(SOAPTypeMappingRegistry.SOAP_BYTE)) {
  -              typeQName = SOAPTypeMappingRegistry.XSD_BYTE;
  -          }
  -      }
  -      
  -      if (typeQName == null) {
  -          // No type inline, so check service description.
  -          ServiceDescription serviceDesc = context.getServiceDescription();
  -          if (serviceDesc != null) {
  -              setType(serviceDesc.getParamTypeByName(context.getMessageType(),
  -                                                     name));
  -          }
  -      }
  -      
  -      // Look up type and set up an appropriate deserializer
  -      if ((typeQName != null) && isDeserializing()) {
  -          deserializer = context.getDeserializer(typeQName);
  -          if (DEBUG_LOG) {
  -              System.err.println(typeQName + " maps to " + deserializer);
  -          }
  -      }
  -
  +            id = attributes.getValue(Constants.ATTR_ID);
  +            // Register this ID with the context.....
  +            if (id != null) {
  +                context.registerElementByID(id, this);
  +            }
  +            
  +            href = attributes.getValue(Constants.ATTR_HREF);
  +            
  +            // If there's an arrayType attribute, we can pretty well guess that we're an Array???
  +            if (attributes.getValue(Constants.URI_SOAP_ENC, Constants.ATTR_ARRAY_TYPE) != null)
  +                typeQName = SOAPTypeMappingRegistry.SOAP_ARRAY;
  +        }
       }
       
  -    public boolean isDeserializing()
  +    /** !!! TODO : Make sure this handles multiple targets
  +     */
  +    Deserializer fixupDeserializer;
  +    
  +    public void setFixupDeserializer(Deserializer dser)
       {
  -        boolean deser;
  -        if (deserializing == null) {
  -            ServiceDescription s = context.getServiceDescription();
  -            deser = ((s == null) || (s.isRPC()));
  -            deserializing = new Boolean(deser);
  -        } else {
  -            deser = deserializing.booleanValue();
  -        }
  -        return deser;
  +        // !!! Merge targets here if already set?
  +        fixupDeserializer = dser;
  +    }
  +    
  +    public Deserializer getFixupDeserializer()
  +    {
  +        return fixupDeserializer;
       }
       
  +    public void setEndIndex(int endIndex)
  +    {
  +        endEventIndex = endIndex;
  +    }
  +    
       public boolean getRoot() { return isRoot; }
       public String getID() { return id; }
       
  @@ -214,6 +183,15 @@
       public QName getType() { return typeQName; }
       public void setType(QName qName) { typeQName = qName; }
       
  +    public SAX2EventRecorder getRecorder() { return recorder; }
  +    public void setRecorder(SAX2EventRecorder rec) { recorder = rec; }
  +    
  +    public Object getValueAsType(QName type)
  +    {
  +        // !!! TODO : Implement
  +        return null;
  +    }
  +    
       protected static class QNameAttr {
           QName name;
           QName value;
  @@ -241,194 +219,59 @@
           return message;
       }
       
  -    public Element getAsDOM()
  -    {
  -        return null;
  -    }
  -    
       public MessageElement getRealElement()
       {
           if (href == null)
               return this;
           
  -        return context.getElementByID(href.substring(1));
  -    }
  -
  -    public Object getValue()
  -    {
  -        if (value != null) {
  -            if (DEBUG_LOG) {
  -                System.out.println(this + " returning val " + value);
  -            }
  -            return value;
  -        }
  +        Object obj = context.getObjectByRef(href);
  +        if (obj == null)
  +            return null;
           
  -        if (href != null) {
  -            if (DEBUG_LOG) {
  -                System.out.println(this + " looking up ref element " + href);
  -            }
  -            return getRealElement().getValue();
  -        }
  +        if (!(obj instanceof MessageElement))
  +            return null;
           
  -        if (deserializer != null) {
  -            value = deserializer.getValue();
  -            if (DEBUG_LOG) {
  -                System.out.println(this + " returning dser (" + deserializer +
  -                                   ") val=" + value);
  -            }
  -            deserializer = null;
  -        } else {
  -            
  -            // Still not sure about this....
  -            
  -            if (recorder != null) {
  -                try {
  -                    StringWriter writer = new StringWriter();
  -                    SerializationContext ctx = new SerializationContext(writer,
  -                                                                        context.getMessageContext());
  -                    recorder.publishChildrenToHandler(new SAXOutputter(ctx));
  -                    writer.close();
  -                    return writer.toString();
  -                } catch (Exception e) {
  -                    Debug.Print(1, "Exception while stringizing recorded events: " + e);
  -                }
  -            }
  -        }
  -        
  -        if (DEBUG_LOG) {
  -            System.out.println(this + " returning val=" + value);
  -        }
  -        return value;
  +        return (MessageElement)obj;
       }
   
  -    public Object getValueAsType(QName typeQName) throws AxisFault
  -    {
  -        MessageElement realEl = getRealElement();
  -        
  -        if (realEl.typeQName != null) {
  -            if (!realEl.typeQName.equals(typeQName))
  -                throw new AxisFault("Couldn't convert " + realEl.typeQName +
  -                    " to requested type " + typeQName);
  -            return getValue();
  -        }
  -        
  -        DeserializerBase dser = realEl.context.getDeserializer(typeQName);
  -        if (dser == null)
  -            throw new AxisFault("No deserializer for type " + typeQName);
  -        
  -        try {
  -            realEl.publishToHandler(dser);
  -        } catch (SAXException e) {
  -            throw new AxisFault(e);
  -        }
  -        
  -        return dser.getValue();
  -    }
  -    
  -    public DeserializerBase getContentHandler()
  -    {
  -        if (isDeserializing()) {
  -          if (href != null) {
  -            deserializer = context.getElementByID(href.substring(1));
  -            if (deserializer != null)
  -              return deserializer;
  -          }
  -            if (deserializer != null) {
  -                return deserializer;
  -            }
  -        }
  -            
  -        /** !!! Is it possible that we'll do this now, but
  -        * later on we'll figure out the type (via some OOB
  -        * means)?  In that case we want an easy way to
  -        * squirt these SAX events to a deserializer.
  -        */
  -        if (DEBUG_LOG) {
  -            System.err.println("Creating recorder for " + this.getName());
  -        }
  -        recorder = new ElementRecorder();
  -        return recorder;
  -    }
  -    
  -    public void setContentHandler(DeserializerBase handler)
  +    public void publishToHandler(ContentHandler handler) throws SAXException
       {
  -        if (deserializer != null) {
  -            System.err.println("Non-null deser while setting content handler?");
  -        }
  +        if (recorder == null)
  +            throw new SAXException("No event recorder inside element");
           
  -        deserializer = handler;
  +        recorder.replay(startEventIndex, endEventIndex, handler);
       }
       
  -    public void publishToHandler(ContentHandler handler) throws SAXException
  +    public void publishContents(ContentHandler handler) throws SAXException
       {
           if (recorder == null)
               throw new SAXException("No event recorder inside element");
           
  -        recorder.publishToHandler(handler);
  +        recorder.replay(startEventIndex+1, endEventIndex-1, handler);
       }
       
  -    public void output(SerializationContext context) throws IOException
  +    /** This is the public output() method, which will always simply use
  +     * the recorded SAX stream for this element if it is available.  If
  +     * not, this method calls outputImpl() to allow subclasses and
  +     * programmatically created messages to serialize themselves.
  +     * 
  +     * @param context the SerializationContext we will write to.
  +     */
  +    public final void output(SerializationContext context) throws Exception
       {
           context.registerPrefixForURI(prefix, namespaceURI);
  -        //System.out.println("In outputToWriter (" + this.getName() + ")");
  +        //stem.out.println("In output (" + this.getName() + ")");
           if (recorder != null) {
  -            try {
  -                recorder.publishToHandler(new SAXOutputter(context));
  -            } catch (SAXException e) {
  -                Exception ex = e.getException();
  -                if (ex instanceof IOException)
  -                    throw (IOException)ex;
  -                throw new IOException(e.toString());
  -            }
  +            recorder.replay(startEventIndex, endEventIndex, new SAXOutputter(context));
               return;
           }
  -
  -        AttributesImpl attrs;
  -        Object val = getValue();
  -        
  -        if ((val != null) && (typeQName == null))
  -            typeQName = context.getQNameForClass(val.getClass());
           
  -        if (attributes == null) {
  -            attrs = new AttributesImpl();
  -            // Writing a message from memory out to XML...
  -            // !!! How do we set other attributes when serializing??
  -            
  -            ServiceDescription desc = context.getServiceDescription();
  -            if ((desc == null) || desc.getSendTypeAttr()) {
  -                if (typeQName != null) {
  -                    attrs.addAttribute(Constants.URI_CURRENT_SCHEMA_XSI, "type", "xsi:type",
  -                                       "CDATA",
  -                                       context.qName2String(typeQName));
  -                }
  -            }
  -            
  -            /*  Removing this for right now... need to deal with nillable for real!!!
  -            if (val == null)
  -                attrs.addAttribute(Constants.URI_CURRENT_SCHEMA_XSI, "null", "xsi:null",
  -                                   "CDATA", "1");
  -            */
  -        } else {
  -            attrs = attributes;
  -        }
  -        
  -        if (qNameAttrs != null) {
  -            for (int i = 0; i < qNameAttrs.size(); i++) {
  -                QNameAttr attr = (QNameAttr)qNameAttrs.elementAt(i);
  -                attrs.addAttribute(attr.name.getNamespaceURI(),
  -                                   attr.name.getLocalPart(),
  -                                   context.qName2String(attr.name), "CDATA",
  -                                   context.qName2String(attr.value));
  -            }
  -        }
  -        
  -        context.startElement(new QName(getNamespaceURI(), getName()), attrs);
  -
  -            
  -        // Output the value...
  -        if (val != null)
  -            context.writeString(DOM2Writer.normalize(value.toString()));
  -        
  -        context.endElement();
  +        outputImpl(context);
  +    }
  +    
  +    /** Subclasses can override
  +     */
  +    protected void outputImpl(SerializationContext context) throws Exception
  +    {
       }
   }
  
  
  
  1.14      +30 -166   xml-axis/java/src/org/apache/axis/message/RPCElement.java
  
  Index: RPCElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCElement.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- RPCElement.java	2001/07/09 14:15:21	1.13
  +++ RPCElement.java	2001/07/15 16:40:09	1.14
  @@ -1,114 +1,26 @@
   package org.apache.axis.message;
   
  -/*
  - * 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/>.
  - */
  -
  -import org.xml.sax.*;
  -import org.xml.sax.helpers.DefaultHandler;
  -import org.apache.axis.*;
  -import org.apache.axis.encoding.*;
  -import org.apache.axis.utils.*;
  -import org.apache.axis.utils.cache.*;
   import java.util.*;
  -import java.io.*;
  -import java.lang.reflect.*;
  +import org.xml.sax.*;
  +import org.apache.axis.encoding.DeserializationContext;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.ServiceDescription;
  +import org.apache.axis.utils.QName;
   
  -/** An RPC body element.
  - * 
  - * Assumes all sub-elements are parameters (see RPCParam).
  - * 
  - * @author Glen Daniels (gdaniels@macromedia.com)
  - */
   public class RPCElement extends SOAPBodyElement
   {
  -    static class RPCElementFactory implements ElementFactory
  -    {
  -        public MessageElement createElement(String namespace, String localName,
  -                                        Attributes attributes, DeserializationContext context)
  -        {
  -            return new RPCElement(namespace, localName, attributes, context);
  -        }
  -    }
  -    
  -    public static ElementFactory getFactory()
  -    {
  -        return new RPCElementFactory();
  -    }
  -    
  -    public DeserializerBase getContentHandler() { return this; }
  -    
  -    ///////////////////////////////////////////////////////////////
  -    
       protected String methodName;    
       protected Vector params = new Vector();
  -    protected Class  defaultParamTypes[] = null;
       
  -    public RPCElement(String namespace, String localName, Attributes attrs,
  -                      DeserializationContext context)
  +    public RPCElement(String namespace, String localName,
  +                      Attributes attributes, DeserializationContext context)
       {
  -        super(namespace, localName, attrs, context);
  -        this.methodName = localName;
  +        super(namespace, localName, attributes, context);
  +        methodName = localName;
       }
  -
  -    public RPCElement(String namespace, String methodName, Object [] args)
  -    {
  -        this(namespace, methodName, args, null);
  -    }
  -
  -    public RPCElement(String namespace, String methodName, Object [] args,
  -                      ServiceDescription service)
  +    
  +    public RPCElement(String namespace, String methodName,
  +                      Object [] args, ServiceDescription serviceDesc)
       {
           this.setNamespaceURI(namespace);
           this.methodName = methodName;
  @@ -119,80 +31,23 @@
                   addParam((RPCParam)args[i]);
               } else {
                   String name = null;
  -                if (service != null) name = service.getInputParamNameByPos(i);
  +                if (serviceDesc != null)
  +                    name = serviceDesc.getInputParamNameByPos(i);
                   if (name == null) name = "arg" + i;
                   addParam(new RPCParam(name, args[i]));
               }
           }
       }
       
  -    public RPCElement(String methodName)
  +    public RPCElement(String namespace, String methodName,
  +                      Object [] args)
       {
  -        this.methodName = methodName;
  -        this.name = methodName;
  -    }
  -
  -    /** *******************************************************
  -     *  Deserialization
  -     *  *******************************************************
  -     */
  -
  -    private void determineDefaultParams() {
  -        MessageContext msgContext = context.getMessageContext();
  -        Handler service    = msgContext.getServiceHandler();
  -        if (service == null) return;
  -
  -        String  clsName    = (String) service.getOption( "className" );
  -
  -        try {
  -            AxisClassLoader cl     = msgContext.getClassLoader();
  -            JavaClass       jc     = cl.lookup(clsName);
  -            Class           cls    = jc.getJavaClass();
  -
  -            // try to find the method without knowing the number of
  -            // parameters.  If we are successful, we can make better
  -            // decisions about what deserializers to use for parameters
  -            Method method = jc.getMethod(methodName, -1);
  -            if (method != null) defaultParamTypes = method.getParameterTypes();
  -
  -            // in the future, we should add support for runtime information
  -            // from sources like WSDL, based on Handler.getDeploymentData();
  -        } catch (Exception e) {
  -            // oh well, we tried.
  -        }
  -    }
  -
  -    public void onStartChild(String namespace, String name, String qName,
  -                             Attributes attributes)
  -        throws SAXException
  -    {
  -        // Start of an arg...
  -        RPCParam param = new RPCParam(namespace, name, attributes, context);
  -        param.setRPCElement(this);
  -        
  -        // See if we can default xsi:type...
  -        if (params.size()==0) determineDefaultParams();
  -        if (defaultParamTypes!=null && params.size()<defaultParamTypes.length) {
  -            MessageContext msgContext = context.getMessageContext();
  -            TypeMappingRegistry typeMap = msgContext.getTypeMappingRegistry();
  -            param.setType(typeMap.getTypeQName(defaultParamTypes[params.size()]));
  -        }
  - 
  -        params.addElement(param);
  -        
  -        context.pushElementHandler(param.getContentHandler());
  +        this(namespace, methodName, args, null);
       }
  -
  -    public void output(SerializationContext context)
  -        throws IOException
  +    
  +    public RPCElement(String methodName)
       {
  -        context.registerPrefixForURI(prefix, namespaceURI);
  -        context.startElement(new QName(this.getNamespaceURI(), this.getName()), attributes);
  -        Enumeration e = params.elements();
  -        while (e.hasMoreElements()) {
  -            ((RPCParam)e.nextElement()).output(context);
  -        }
  -        context.endElement();
  +        this.methodName = methodName;
       }
       
       public String getMethodName()
  @@ -221,7 +76,16 @@
       
       public void addParam(RPCParam param)
       {
  -        param.setRPCElement(this);
  +        param.setRPCCall(this);
           params.addElement(param);
  +    }
  +
  +    protected void outputImpl(SerializationContext context) throws Exception
  +    {
  +        context.startElement(new QName(namespaceURI,name),attributes);
  +        for (int i = 0; i < params.size(); i++) {
  +            ((RPCParam)params.elementAt(i)).serialize(context);
  +        }
  +        context.endElement();
       }
   }
  
  
  
  1.21      +46 -83    xml-axis/java/src/org/apache/axis/message/RPCParam.java
  
  Index: RPCParam.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCParam.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- RPCParam.java	2001/07/11 01:44:39	1.20
  +++ RPCParam.java	2001/07/15 16:40:09	1.21
  @@ -55,35 +55,37 @@
    * <http://www.apache.org/>.
    */
   
  -import java.io.*;
  -import java.util.*;
  -import org.apache.axis.Constants;
  -import org.apache.axis.encoding.*;
  +import java.lang.reflect.*;
  +import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.utils.QName;
  -import org.xml.sax.*;
  -import org.xml.sax.helpers.AttributesImpl;
  -import org.xml.sax.helpers.DefaultHandler;
  +import java.io.IOException;
   
  -/** An RPC parameter element.
  +/** An RPC parameter
    *
    * @author Glen Daniels (gdaniels@macromedia.com)
    */
  -public class RPCParam extends MessageElement
  +public class RPCParam
   {
       private static boolean DEBUG_LOG = false;
       
       // Who's your daddy?
  -    RPCElement myRPCElement;
  -
  -    /** This constructor is called during XML parsing.
  -     */
  -    public RPCParam(String namespace, String localName, Attributes attrs,
  -                    DeserializationContext context)
  -    {
  -        super(namespace, localName, attrs, context);
  -        name = localName;
  -    }
  +    RPCElement myCall;
       
  +    private String namespaceURI;
  +    private String name;
  +    public Object value;
  +    
  +    private static Field valueField;
  +    static {
  +        Class cls = RPCParam.class;
  +        try {
  +            valueField = cls.getField("value");
  +        } catch (NoSuchFieldException e) {
  +            System.err.println("No value field for RPCParam to use?!? " + e);
  +            System.exit(-1);
  +        }
  +    }
  +
       /** Constructor for building up messages.
        */
       public RPCParam(String name, Object value)
  @@ -99,73 +101,34 @@
           this.value = value;
       }
       
  -    public void setRPCElement(RPCElement element)
  +    public void setRPCCall(RPCElement call)
       {
  -        myRPCElement = element;
  -        // if (namespaceURI==null) namespaceURI=element.getNamespaceURI();
  +        myCall = call;
       }
       
  -    /** !!! This is a little messy... need to think about
  -     * how elements get connected with their envelopes a bit
  -     * more?
  -     */
  -    public SOAPEnvelope getEnvelope()
  +    public Object getValue()
       {
  -        if (myRPCElement != null)
  -            return myRPCElement.getEnvelope();
  -        
  -        return super.getEnvelope();
  -    }
  -    
  -   
  -    public void output(SerializationContext context) throws IOException
  -    {
  -        AttributesImpl attrs;
  -        if (deserializer != null) getValue();
  -        
  -        if (value instanceof ElementRecorder) {
  -            try {
  -                ((ElementRecorder)value).publishToHandler(new SAXOutputter(context));
  -            } catch (SAXException ex) {
  -                throw new IOException(ex.getMessage());
  -            }
  -            return;
  -        } else {
  -            if ((value != null) && (typeQName == null)) {
  -                typeQName = context.getQNameForClass(value.getClass());
  -            }
  -        }
  -        
  -        if (attributes != null) {
  -            // Must be writing a message we parsed earlier, so just put out
  -            // what's already there.
  -            attrs = new AttributesImpl(attributes);
  -        } else {
  -            // Writing a message from memory out to XML...
  -            // !!! How do we set other attributes when serializing??
  -            attrs = new AttributesImpl();
  -            
  -            ServiceDescription desc = context.getServiceDescription();
  -            if ((desc == null) || desc.getSendTypeAttr()) {
  -                
  -                if (typeQName != null) {
  -                    attrs.addAttribute(Constants.URI_CURRENT_SCHEMA_XSI, "type", "xsi:type",
  -                                       "CDATA",
  -                                       context.qName2String(typeQName));
  -                }
  -            }
  -        
  -            if (value == null)
  -                attrs.addAttribute(Constants.URI_CURRENT_SCHEMA_XSI, "null", "xsi:null",
  -                                   "CDATA", "1");
  -        }
  -
  -        // don't try to get typeQName unless value is non-null!
  -        if (typeQName == null && value != null) {
  -            Class clazz = value.getClass();
  -            typeQName = context.getQNameForClass(clazz);
  -        }
  -        
  -        context.serialize(new QName(getNamespaceURI(), getName()), attrs, value);
  +        return value;
  +    }
  +    
  +    public void setValue(Object value)
  +    {
  +        this.value = value;
  +    }
  +    
  +    public String getName()
  +    {
  +        return this.name;
  +    }
  +    
  +    public static Field getValueField()
  +    {
  +        return valueField;
  +    }
  +    
  +    public void serialize(SerializationContext context)
  +        throws IOException
  +    {
  +        context.serialize(new QName(namespaceURI,name), null, value);
       }
   }
  
  
  
  1.3       +3 -1      xml-axis/java/src/org/apache/axis/message/SAXOutputter.java
  
  Index: SAXOutputter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SAXOutputter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SAXOutputter.java	2001/06/13 21:13:13	1.2
  +++ SAXOutputter.java	2001/07/15 16:40:09	1.3
  @@ -22,7 +22,9 @@
       }
       
       public void endDocument() throws SAXException {
  -        System.out.println("SAXOutputter: end document.");
  +        if (DEBUG_LOG) {
  +            System.out.println("SAXOutputter: end document.");
  +        }
       }
       
       public void startPrefixMapping(String p1, String p2) throws SAXException {
  
  
  
  1.6       +4 -2      xml-axis/java/src/org/apache/axis/message/SOAPBodyElement.java
  
  Index: SOAPBodyElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPBodyElement.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SOAPBodyElement.java	2001/07/08 14:18:38	1.5
  +++ SOAPBodyElement.java	2001/07/15 16:40:10	1.6
  @@ -65,8 +65,10 @@
    */
   public class SOAPBodyElement extends MessageElement
   {
  -    public SOAPBodyElement(String namespace, String localPart,
  -                      Attributes attributes, DeserializationContext context)
  +    public SOAPBodyElement(String namespace,
  +                           String localPart,
  +                           Attributes attributes,
  +                           DeserializationContext context)
       {
           super(namespace, localPart, attributes, context);
       }
  
  
  
  1.27      +13 -117   xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java
  
  Index: SOAPEnvelope.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- SOAPEnvelope.java	2001/07/11 20:02:13	1.26
  +++ SOAPEnvelope.java	2001/07/15 16:40:10	1.27
  @@ -64,18 +64,14 @@
   import org.xml.sax.InputSource;
   import org.xml.sax.helpers.AttributesImpl;
   
  -public class SOAPEnvelope
  +public class SOAPEnvelope extends MessageElement
   {
       private static boolean DEBUG_LOG = false;
       
       public Vector headers = new Vector();
       public Vector bodyElements = new Vector();
  -    public Vector independentElements = new Vector();
  -    public Hashtable idMapping = new Hashtable();
  +    public Vector trailers = new Vector();
       public String encodingStyleURI = null;
  -    public Hashtable nsDecls = new Hashtable();
  -                                            
  -    public SOAPSAXHandler handler;
       
       // This is a hint to any service description to tell it what
       // "type" of message we are.  This might be "request", "response",
  @@ -90,14 +86,8 @@
           nsDecls.put(Constants.URI_SOAP_ENV, Constants.NSPREFIX_SOAP_ENV);
           nsDecls.put(Constants.URI_CURRENT_SCHEMA_XSD, Constants.NSPREFIX_SCHEMA_XSD);
           nsDecls.put(Constants.URI_CURRENT_SCHEMA_XSI, Constants.NSPREFIX_SCHEMA_XSI);
  -        handler = null;
       }
       
  -    SOAPEnvelope(SOAPSAXHandler handler)
  -    {
  -        this.handler = handler;
  -    }
  -
       public String getMessageType()
       {
           return messageType;
  @@ -113,35 +103,18 @@
           encodingStyleURI = uri;
       }
       
  -    public String getAsString()
  +    public Vector getBodyElements() throws AxisFault
       {
  -        // !!! NOT IMPLEMENTED YET
  -        return null;
  +        return bodyElements;
       }
       
  -    public Vector getBodyElements() throws AxisFault
  +    public Vector getTrailers()
       {
  -        if ((handler != null) && !handler.hasParsedBody()) {
  -            try {
  -                handler.parseToEnd();
  -            } catch (Exception e) {
  -                throw new AxisFault(e);
  -            }
  -        }
  -        
  -        return bodyElements;
  +        return trailers;
       }
       
       public SOAPBodyElement getFirstBody() throws AxisFault
       {
  -        if ((handler != null) && !handler.hasParsedBody()) {
  -            try {
  -                handler.parseToEnd();
  -            } catch (Exception e) {
  -                throw new AxisFault(e);
  -            }
  -        }
  -        
           if (bodyElements.isEmpty())
               return null;
           
  @@ -150,32 +123,15 @@
       
       public Vector getHeaders() throws AxisFault
       {
  -        if ((handler != null) && !handler.hasParsedHeaders()) {
  -            try {
  -                handler.parseToEnd();
  -            } catch (Exception e) {
  -                throw new AxisFault(e);
  -            }
  -        }
  -        
           return headers;
       }
       
  -    void processID(MessageElement element)
  -    {
  -        String id = element.getID();
  -        if (id != null) {
  -            idMapping.put(id, element);
  -        }
  -    }
  -    
       public void addHeader(SOAPHeader header)
       {
           if (DEBUG_LOG)
               System.out.println("Adding header to message...");
           header.setEnvelope(this);
           headers.addElement(header);
  -        processID(header); // Can headers have IDs?
       }
       
       public void addBodyElement(SOAPBodyElement element)
  @@ -184,7 +140,6 @@
               System.out.println("Adding body element to message...");
           element.setEnvelope(this);
           bodyElements.addElement(element);
  -        processID(element); // Can body elements have IDs?
       }
       
       public void clearBody()
  @@ -193,65 +148,25 @@
               bodyElements.removeAllElements();
       }
       
  -    public void addIndependentElement(MessageElement element)
  +    public void addTrailer(MessageElement element)
       {
           if (DEBUG_LOG)
  -            System.out.println("Adding independent element to message...");
  +            System.out.println("Adding trailer to message...");
           element.setEnvelope(this);
  -        independentElements.addElement(element);
  -        processID(element);
  +        trailers.addElement(element);
       }
   
  -    public void parseToEnd() throws AxisFault
  -    {
  -        if (handler != null)
  -            try {
  -                handler.parseToEnd();
  -            } catch (Exception e) {
  -                throw new AxisFault(e);
  -            }
  -    }
  -    
  -    public MessageElement getElementByID(String id) throws AxisFault
  -    {
  -        MessageElement el = (MessageElement)idMapping.get(id);
  -        if ((el != null) || (handler == null))
  -            return el;  // Got it, or else don't have anything to parse.
  -        
  -        // Must find it...
  -        try {
  -            return handler.parseForID(id);
  -        } catch (Exception e) {
  -            throw new AxisFault(e);
  -        }
  -    }
  -    
       public SOAPHeader getHeaderByName(String namespace, String localPart)
           throws AxisFault
       {
           SOAPHeader header = (SOAPHeader)findElement(headers, namespace, localPart);
           
  -        if ((header == null) && (handler != null))
  -            try {
  -                return handler.parseForHeader(namespace, localPart);
  -            } catch (Exception e) {
  -                throw new AxisFault(e);
  -            }
  -        
           return header;
       }
   
       public SOAPBodyElement getBodyByName(String namespace, String localPart)
           throws AxisFault
       {
  -        if ((handler != null) && !handler.hasParsedBody()) {
  -            try {
  -                return handler.parseForBody(namespace, localPart);
  -            } catch (Exception e) {
  -                throw new AxisFault(e);
  -            }
  -        }
  -        
           return (SOAPBodyElement)findElement(bodyElements, namespace, localPart);
       }
       
  @@ -280,14 +195,6 @@
            * which moves through the headers list (parsing on demand, again),
            * returning only the next one each time.... this is Q&D for now.
            */
  -        if ((handler != null) && !handler.hasParsedHeaders()) {
  -            try {
  -                handler.parse();
  -            } catch (Exception e) {
  -                throw new AxisFault(e);
  -            }
  -        }
  -        
           Vector v = new Vector();
           Enumeration e = headers.elements();
           SOAPHeader header;
  @@ -303,22 +210,11 @@
       
       /** Should make SOAPSerializationException?
        */
  -    public void output(SerializationContext context)
  +    public void outputImpl(SerializationContext context)
           throws Exception
       {
  -        Enumeration enum;
  -        
  -        /** !!! Since we want this as SAX events, we need to
  -         * finish parsing our input stream.  There should be a way
  -         * for us to get the input stream itself, though, if we
  -         * haven't started parsing yet....
  -         */
  -        if ((handler != null) && !handler.hasFinished()) {
  -            handler.parseToEnd();
  -        }
  -        
           // Register namespace prefixes.
  -        enum = nsDecls.keys();
  +        Enumeration enum = nsDecls.keys();
           while (enum.hasMoreElements()) {
               String uri = (String)enum.nextElement();
               context.registerPrefixForURI((String)nsDecls.get(uri), uri);
  @@ -373,8 +269,8 @@
           // Output </SOAP-ENV:Body>
           context.endElement();
           
  -        // Output independent elements
  -        enum = independentElements.elements();
  +        // Output trailers
  +        enum = trailers.elements();
           while (enum.hasMoreElements()) {
               MessageElement element = (MessageElement)enum.nextElement();
               element.output(context);
  
  
  
  1.8       +27 -48    xml-axis/java/src/org/apache/axis/message/SOAPFaultElement.java
  
  Index: SOAPFaultElement.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPFaultElement.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SOAPFaultElement.java	2001/07/09 15:43:31	1.7
  +++ SOAPFaultElement.java	2001/07/15 16:40:10	1.8
  @@ -73,40 +73,22 @@
    */
   public class SOAPFaultElement extends SOAPBodyElement
   {
  -    static class FaultElementFactory implements ElementFactory
  -    {
  -        public MessageElement createElement(String namespace, String localName,
  -                                        Attributes attributes, DeserializationContext context)
  -        {
  -            return new SOAPFaultElement(namespace, localName, attributes, context);
  -        }
  -    }
  -    
  -    public static ElementFactory getFactory()
  -    {
  -        return new FaultElementFactory();
  -    }
  -    
       String currentSubElement;
  -    StringBuffer currentValue;
  +    Deserializer currentDeser;
       
  -    public void onStartChild(String namespace, String name, String qName,
  -                             Attributes attributes)
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String name,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
           throws SAXException
       {
           currentSubElement = name;
  -        currentValue = new StringBuffer();
  +        currentDeser = context.getTypeMappingRegistry().
  +                          getDeserializer(SOAPTypeMappingRegistry.XSD_STRING);
  +        return currentDeser;
       }
       
  -    public void characters(char [] chars, int start, int end)
  -    {
  -        // Only capture characters between StartChild and EndChild (the
  -        // rest, presumably, is ignorable whitespace).
  -        if (currentValue != null)
  -            currentValue.append(chars, start, end);
  -    }
  -
  -    public void onEndChild(String localName, DeserializerBase deserializer)
  +    public void onEndChild(String localName, Deserializer deserializer)
           throws SAXException
       {
           if (fault == null)
  @@ -115,23 +97,19 @@
           if (currentSubElement.equals("faultcode")) {
               fault.setFaultCode(
                         new QFault(
  -                         context.getQNameFromString(currentValue.toString())
  +                         context.getQNameFromString(currentDeser.getValue().toString())
                                   )
                                 );
           } else if (currentSubElement.equals("faultstring")) {
  -            fault.setFaultString(currentValue.toString());
  +            fault.setFaultString(currentDeser.getValue().toString());
           } else if (currentSubElement.equals("faultactor")) {
  -            fault.setFaultActor(currentValue.toString());
  +            fault.setFaultActor(currentDeser.getValue().toString());
           } else if (currentSubElement.equals("details")) {
               // !!! Not supported yet
               // fault.setFaultDetails(...);
           }
  -
  -        currentValue = null;
       }
   
  -    public DeserializerBase getContentHandler() { return this; }
  -    
       ///////////////////////////////////////////////////////////////
       
       protected AxisFault fault;    
  @@ -149,33 +127,34 @@
           name = Constants.ELEM_FAULT;
       }
       
  -    public void output(SerializationContext context)
  +    public void outputImpl(SerializationContext context)
           throws IOException
       {
           context.registerPrefixForURI(prefix, namespaceURI);
           context.startElement(new QName(this.getNamespaceURI(), this.getName()), attributes);
   
           if (fault.getFaultCode() != null) {
  -          MessageElement element = new 
  -            MessageElement(Constants.URI_SOAP_ENV, "faultcode");
  +          context.startElement(new QName(Constants.URI_SOAP_ENV, "faultcode"),
  +                               null);
             QFault code = fault.getFaultCode();
  -          String prefix = context.getPrefixForURI(code.getNamespaceURI());
  -          element.setValue(prefix + ":" + code.getLocalPart());
  -          element.output(context);
  +          context.writeString(context.qName2String(code));
  +          context.endElement();
           }
       
           if (fault.getFaultString() != null) {
  -          MessageElement element = new 
  -            MessageElement(Constants.URI_SOAP_ENV, "faultstring");
  -          element.setValue(fault.getFaultString());
  -          element.output(context);
  +          context.startElement(new QName(Constants.URI_SOAP_ENV,
  +                                         "faultstring"),
  +                               null);
  +          context.writeString(fault.getFaultString());
  +          context.endElement();
           }
       
           if (fault.getFaultActor() != null) {
  -          MessageElement element = new 
  -            MessageElement(Constants.URI_SOAP_ENV, "faultactor");
  -          element.setValue(fault.getFaultActor());
  -          element.output(context);
  +          context.startElement(new QName(Constants.URI_SOAP_ENV,
  +                                         "faultactor"),
  +                               null);
  +          context.writeString(fault.getFaultActor());
  +          context.endElement();
           }
       
           Element[] faultDetails = fault.getFaultDetails();
  
  
  
  1.19      +2 -18     xml-axis/java/src/org/apache/axis/message/SOAPHeader.java
  
  Index: SOAPHeader.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPHeader.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SOAPHeader.java	2001/07/11 16:09:53	1.18
  +++ SOAPHeader.java	2001/07/15 16:40:11	1.19
  @@ -1,3 +1,5 @@
  +package org.apache.axis.message;
  +
   /*
    * The Apache Software License, Version 1.1
    *
  @@ -53,8 +55,6 @@
    * <http://www.apache.org/>.
    */
   
  -package org.apache.axis.message ;
  -
   import java.io.IOException;
   import java.util.* ;
   import org.apache.axis.* ;
  @@ -69,17 +69,6 @@
    * 
    */
   public class SOAPHeader extends MessageElement {
  -    static class HeaderFactory implements ElementFactory {
  -        public MessageElement createElement(String namespace, 
  -                                        String localName,
  -                                        Attributes attributes, 
  -                                        DeserializationContext context)
  -        {
  -            return new SOAPHeader(namespace, localName, attributes, context);
  -        }
  -    }
  -    public static ElementFactory factory() { return new HeaderFactory(); }
  -    
       protected boolean   processed = false;
   
       protected String    actor;
  @@ -125,10 +114,5 @@
   
       public boolean isProcessed() {
           return( processed );
  -    }
  -
  -    public void output(SerializationContext context) throws IOException
  -    {
  -        super.output(context);
       }
   };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/BodyBuilder.java
  
  Index: BodyBuilder.java
  ===================================================================
  package org.apache.axis.message;
  
  /**
   * 
   * @author Glen Daniels (gdaniels@allaire.com)
   */
  
  import org.xml.sax.*;
  import org.xml.sax.helpers.DefaultHandler;
  import org.apache.axis.Constants;
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.encoding.ServiceDescription;
  import org.apache.axis.utils.Debug;
  
  public class BodyBuilder extends SOAPHandler
  {
      private final static boolean DEBUG_LOG = false;
      
      private SOAPBodyElement element;
      boolean gotRPCElement = false;
      boolean isRPCElement = false;
      
      public SOAPHandler onStartChild(String namespace,
                                       String localName,
                                       Attributes attributes,
                                       DeserializationContext context)
          throws SAXException
      {
          if (DEBUG_LOG) {
              System.err.println("In BodyBuilder.onStartChild()");
          }
          SOAPHandler handler = null;
          
          /** We're about to create a body element.  So we really need
           * to know at this point if this is an RPC service or not.  It's
           * possible that no one has set the service up until this point,
           * so if that's the case we should attempt to set it based on the
           * namespace of the first root body element.  Setting the
           * service may (should?) result in setting the service
           * description, which can then tell us what to create.
           */
          boolean isRoot = true;
          String root = attributes.getValue(Constants.URI_SOAP_ENC,
                                          Constants.ATTR_ROOT);
          if ((root != null) && root.equals("0")) isRoot = false;
  
          if (isRoot &&
              context.getMessageContext().getServiceHandler() == null) {
              Debug.Print(2, "Dispatching to body namespace '",
                          namespace, "'");
              context.getMessageContext().setTargetService(namespace);
          }
          
          /** Now we make a plain SOAPBodyElement IF we either:
           * a) have an non-root element, or
           * b) have a non-RPC service
           */
          ServiceDescription serviceDesc = context.getMessageContext().
                                                        getServiceDescription();
          if (!gotRPCElement &&
              isRoot && 
              ((serviceDesc == null) || (serviceDesc.isRPC()))) {
              gotRPCElement = true;
              element = new RPCElement(namespace, localName,
                                       attributes, context);
              handler = new RPCHandler((RPCElement)element);
          } else {
              element = new SOAPBodyElement(namespace, localName,
                                        attributes, context);
              if (element.getFixupDeserializer() != null)
                  handler = element.getFixupDeserializer();
          }
          
          if (DEBUG_LOG) {
              System.err.println("Out BodyBuilder.onStartChild()");
          }
          return handler;
      }
      
      public void onEndChild(String namespace, String localName,
                             DeserializationContext context)
      {
          if (DEBUG_LOG) {
              System.err.println("In BodyBuilder.onEndChild()");
          }
          
          if (element != null) {
              element.setEndIndex(context.getCurrentRecordPos());
              context.envelope.addBodyElement(element);
              element = null;
          }
  
          if (DEBUG_LOG) {
              System.err.println("Out BodyBuilder.onEndChild()");
          }
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/EnvelopeBuilder.java
  
  Index: EnvelopeBuilder.java
  ===================================================================
  package org.apache.axis.message;
  
  /**
   * 
   * @author Glen Daniels (gdaniels@allaire.com)
   */
  
  import org.xml.sax.*;
  import org.xml.sax.helpers.DefaultHandler;
  import org.apache.axis.Constants;
  import org.apache.axis.utils.QName;
  import org.apache.axis.encoding.DeserializationContext;
  
  public class EnvelopeBuilder extends SOAPHandler
  {
      private MessageElement element;
      
      private boolean gotHeader = false;
      private boolean gotBody = false;
      
      private static final QName headerQName = new QName(Constants.URI_SOAP_ENV,
                                                         Constants.ELEM_HEADER);
      private static final QName bodyQName = new QName(Constants.URI_SOAP_ENV,
                                                         Constants.ELEM_BODY);
      
      public void startElement(String namespace, String localName,
                               String qName, Attributes attributes,
                               DeserializationContext context)
          throws SAXException
      {
          if (!namespace.equals(Constants.URI_SOAP_ENV))
              throw new SAXException("Bad envelope namespace " + namespace);
          
          if (!localName.equals(Constants.ELEM_ENVELOPE))
              throw new SAXException("Bad envelope tag " + localName);
      }
      
      public SOAPHandler onStartChild(String namespace, String localName,
                                       Attributes attributes,
                                       DeserializationContext context)
          throws SAXException
      {
          QName thisQName = new QName(namespace, localName);
          if (thisQName.equals(headerQName)) {
              if (gotHeader)
                  throw new SAXException("Only one Header element allowed!");
              
              gotHeader = true;
              return new HeaderBuilder();
          }
          
          if (thisQName.equals(bodyQName)) {
              if (gotBody)
                  throw new SAXException("Only one Body element allowed!");
              
              gotBody = true;
              return new BodyBuilder();
          }
          
          if (!gotBody)
              throw new SAXException("No custom elements allowed at top level "+
                                     "until after the <Body>");
  
          element = new MessageElement(namespace, localName,
                                       attributes, context);
          
          if (element.getFixupDeserializer() != null)
              return element.getFixupDeserializer();
          
          return null;
      }
      
      public void onEndChild(String namespace, String localName,
                             DeserializationContext context)
      {
          if (element != null) {
              element.setEndIndex(context.getCurrentRecordPos());
              context.getEnvelope().addTrailer(element);
          }
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/EnvelopeHandler.java
  
  Index: EnvelopeHandler.java
  ===================================================================
  package org.apache.axis.message;
  
  /**
   * 
   * @author Glen Daniels (gdaniels@allaire.com)
   */
  
  import org.xml.sax.*;
  import org.xml.sax.helpers.DefaultHandler;
  import org.apache.axis.Constants;
  import org.apache.axis.utils.QName;
  import org.apache.axis.encoding.DeserializationContext;
  
  public class EnvelopeHandler extends SOAPHandler
  {
      public SOAPHandler onStartChild(String namespace, String localName,
                                       Attributes attributes,
                                       DeserializationContext context)
          throws SAXException
      {
          return new EnvelopeBuilder();
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/HandlerFactory.java
  
  Index: HandlerFactory.java
  ===================================================================
  package org.apache.axis.message;
  
  /*
   * 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/>.
   */
  
  import org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  import org.apache.axis.encoding.DeserializationContext;
  
  /** A simple handler factory interface
   * 
   * @author Glen Daniels (gdaniels@macromedia.com)
   */
  public interface HandlerFactory
  {
      public SOAPHandler getHandler(String namespace,
                                    String localName,
                                    Attributes attributes,
                                    DeserializationContext context)
          throws SAXException;
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/HeaderBuilder.java
  
  Index: HeaderBuilder.java
  ===================================================================
  package org.apache.axis.message;
  
  /**
   * 
   * @author Glen Daniels (gdaniels@allaire.com)
   */
  
  import org.xml.sax.*;
  import org.xml.sax.helpers.DefaultHandler;
  import org.apache.axis.encoding.DeserializationContext;
  
  public class HeaderBuilder extends SOAPHandler
  {
      private SOAPHeader header;
      
      public SOAPHandler onStartChild(String namespace,
                               String localName,
                               Attributes attributes,
                               DeserializationContext context)
          throws SAXException
      {
          header = new SOAPHeader(namespace, localName,
                                             attributes, context);
          return null;
      }
      
      public void onEndChild(String namespace, String localName,
                             DeserializationContext context)
      {
          System.out.println("header is " + header);
          System.out.println("context is " + context);
          
          header.setEndIndex(context.getCurrentRecordPos());
         
          context.envelope.addHeader(header);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/IDResolver.java
  
  Index: IDResolver.java
  ===================================================================
  package org.apache.axis.message;
  
  /** 
   * 
   * @author Glen Daniels (gdaniels@allaire.com)
   */
  
  public interface IDResolver
  {
      public Object getReferencedObject(String href);
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/RPCHandler.java
  
  Index: RPCHandler.java
  ===================================================================
  package org.apache.axis.message;
  
  /**
   * 
   * @author Glen Daniels (gdaniels@allaire.com)
   */
  
  import java.lang.reflect.*;
  import java.util.*;
  import org.xml.sax.*;
  import org.xml.sax.helpers.DefaultHandler;
  import org.apache.axis.*;
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.encoding.Deserializer;
  import org.apache.axis.encoding.TypeMappingRegistry;
  import org.apache.axis.encoding.ServiceDescription;
  import org.apache.axis.utils.QName;
  import org.apache.axis.utils.AxisClassLoader;
  import org.apache.axis.utils.cache.*;
  
  public class RPCHandler extends SOAPHandler
  {
      private final static boolean DEBUG_LOG = false;
      
      private RPCElement call;
      private RPCParam currentParam;
  
      protected Class  defaultParamTypes[] = null;
      
      public RPCHandler(RPCElement call)
          throws SAXException
      {
          this.call = call;
      }
      
      private void determineDefaultParams(String methodName,
                                          DeserializationContext context) {
          MessageContext msgContext = context.getMessageContext();
          Handler service    = msgContext.getServiceHandler();
          if (service == null) return;
  
          String  clsName    = (String) service.getOption( "className" );
  
          try {
              AxisClassLoader cl     = msgContext.getClassLoader();
              JavaClass       jc     = cl.lookup(clsName);
              Class           cls    = jc.getJavaClass();
  
              // try to find the method without knowing the number of
              // parameters.  If we are successful, we can make better
              // decisions about what deserializers to use for parameters
              Method method = jc.getMethod(methodName, -1);
              if (method != null) defaultParamTypes = method.getParameterTypes();
              
              // !!! This should be smart enough to deal with overloaded
              // methods - we should really be keeping a list of all of
              // the possibilities, then moving down the list to keep
              // matching as we deserialize params....
              //
  
              // in the future, we should add support for runtime information
              // from sources like WSDL, based on Handler.getDeploymentData();
          } catch (Exception e) {
              // oh well, we tried.
          }
      }
  
      public SOAPHandler onStartChild(String namespace, String localName,
                               Attributes attributes,
                               DeserializationContext context)
          throws SAXException
      {
          /** Potential optimizations:
           * 
           * - Cache typeMappingRegistry
           * - Cache service description
           */
          ServiceDescription serviceDesc = context.getMessageContext().
                                                  getServiceDescription();
          
          if (DEBUG_LOG) {
              System.err.println("In RPCHandler.onStartChild()");
          }
          
          Vector params = call.getParams();
          if (serviceDesc == null && params.isEmpty()) {
              determineDefaultParams(localName, context);
          }
          
          // This is a param.
          currentParam = new RPCParam(namespace, localName, null);
          call.addParam(currentParam);
          
          QName type = context.getTypeFromAttributes(namespace,
                                                     localName,
                                                     attributes);
          if (DEBUG_LOG) {
              System.err.println("Type from attrs was " + type);
          }
          
          // xsi:type always overrides everything else
          if (type == null) {
              // but if we don't find one, see if the ServiceDescription
              // might shed some light...
              if (serviceDesc != null) {
                  type = serviceDesc.getInputParamTypeByName(localName);
              }
              
              // and if we still don't know, check the introspected types
              if (type==null && defaultParamTypes!=null && 
                  params.size()<defaultParamTypes.length) {
                  TypeMappingRegistry typeMap = context.
                                                    getTypeMappingRegistry();
                  type = typeMap.getTypeQName(
                                           defaultParamTypes[params.size()]);
              }
          }
          
          Deserializer dser;
          if (type != null) {
              dser = context.getTypeMappingRegistry().getDeserializer(type);
          } else {
              dser = new Deserializer();
          }
          
          if (dser == null) {
              throw new SAXException("Deserializing param '" + localName +
                  "' : Couldn't find deserializer for type " + type);
          }
          
          dser.registerValueTarget(
                                   new Deserializer.FieldTarget(currentParam,
                                                                    RPCParam.getValueField()));
          
          if (DEBUG_LOG) {
              System.out.println("Out RPCHandler.onStartChild()");
          }
          return dser;
      }
      
      public void endElement(String namespace, String localName,
                             DeserializationContext context)
          throws SAXException
      {
          if (DEBUG_LOG) {
              System.out.println("Setting MessageContext property in " +
                                 "RPCHandler.endElement().");
          }
          context.getMessageContext().setProperty("RPC", call);
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/SAX2EventRecorder.java
  
  Index: SAX2EventRecorder.java
  ===================================================================
  package org.apache.axis.message;
  
  import org.xml.sax.ContentHandler;
  import org.xml.sax.SAXException;
  import org.xml.sax.helpers.AttributesImpl;
  
  /**
   * This class records SAX2 Events and allows
   * the events to be replayed by start and stop index
   */
  public class SAX2EventRecorder { 
      
      private static final byte STATE_SET_DOCUMENT_LOCATOR = 0;
      private static final byte STATE_START_DOCUMENT = 1;
      private static final byte STATE_END_DOCUMENT = 2;
      private static final byte STATE_START_PREFIX_MAPPING = 3;
      private static final byte STATE_END_PREFIX_MAPPING = 4;
      private static final byte STATE_START_ELEMENT = 5;
      private static final byte STATE_END_ELEMENT = 6;
      private static final byte STATE_CHARACTERS = 7;
      private static final byte STATE_IGNORABLE_WHITESPACE = 8;
      private static final byte STATE_PROCESSING_INSTRUCTION = 9;
      private static final byte STATE_SKIPPED_ENTITY = 10;
  
      org.xml.sax.Locator locator;
      intArrayVector events = new intArrayVector();
      Object[] attrs = new Object[20];
      int numattrs = 0;
      SymbolTable st = new SymbolTable();
      
      public void clear() {
          locator = null;
          events = new intArrayVector();
          attrs = new Object[20];
          numattrs = 0;
          st = new SymbolTable();
      }
      public int getLength()
      {
          return events.getLength();
      }
      
      public int setDocumentLocator(org.xml.sax.Locator p1) {
          locator = p1;
          return events.add(STATE_SET_DOCUMENT_LOCATOR, 0,0,0,0);
      }
      public int startDocument() {
          return events.add(STATE_START_DOCUMENT, 0,0,0,0);
      }
      public int endDocument() {
          return events.add(STATE_END_DOCUMENT, 0,0,0,0);
      }
      public int startPrefixMapping(String p1, String p2) {
          return events.add(STATE_START_PREFIX_MAPPING, st.addSymbol(p1), st.addSymbol(p2), 0,0);
      }
      public int endPrefixMapping(String p1) {
          return events.add(STATE_END_PREFIX_MAPPING, st.addSymbol(p1),0,0,0);
      }
      public int startElement(String p1, String p2, String p3, org.xml.sax.Attributes p4) {
          if (numattrs == attrs.length) {
              Object[] nattrs = new Object[numattrs * 2];
              System.arraycopy(attrs, 0, nattrs, 0, numattrs);
              attrs = nattrs;
          }
          
          attrs[numattrs++] = new AttributesImpl(p4);
          return events.add(STATE_START_ELEMENT, st.addSymbol(p1), st.addSymbol(p2), st.addSymbol(p3), numattrs-1);
      }
      public int endElement(String p1, String p2, String p3) {
          return events.add(STATE_END_ELEMENT, st.addSymbol(p1), st.addSymbol(p2), st.addSymbol(p3),0);
      }
      public int characters(char[] p1, int p2, int p3) {
          /*
          return events.add(STATE_CHARACTERS, st.addSymbol(p1, p2, p3), p2, p3, 0);
          */
          return events.add(STATE_CHARACTERS, st.addSymbol(p1, p2, p3), 0, p3, 0);        
      }
      public int ignorableWhitespace(char[] p1, int p2, int p3) {
          return events.add(STATE_IGNORABLE_WHITESPACE, st.addSymbol(p1, p2, p3), p2, p3, 0);
      }
      public int processingInstruction(String p1, String p2) {
          return events.add(STATE_PROCESSING_INSTRUCTION, st.addSymbol(p1), st.addSymbol(p2), 0,0);
      }
      public int skippedEntity(String p1) {
          return events.add(STATE_SKIPPED_ENTITY, st.addSymbol(p1), 0,0,0);
      }
      
      public void replay(ContentHandler handler) throws SAXException {
          replay(0, events.getLength() - 1, handler);
      }
      
      public void replay(int start, int stop, ContentHandler handler) throws SAXException {
          // Special case : play the whole thing for [0, -1]
          if ((start == 0) && (stop == -1)) {
              replay(handler);
              return;
          }
          
          if (stop + 1 > events.getLength() ||
              stop < start) {
              return; // should throw an error here
          }        
          for (int n = start; n <= stop; n++) {
              switch(events.get(n,0)) {
              case STATE_SET_DOCUMENT_LOCATOR:
                  handler.setDocumentLocator(locator);
                  break;
              case STATE_START_DOCUMENT:
                  handler.startDocument();
                  break;
              case STATE_END_DOCUMENT:
                  handler.endDocument();
                  break;
              case STATE_START_PREFIX_MAPPING:
                  handler.startPrefixMapping(st.getSymbol(events.get(n, 1)),
                                             st.getSymbol(events.get(n, 2)));
                  break;
              case STATE_END_PREFIX_MAPPING:
                  handler.endPrefixMapping(st.getSymbol(events.get(n, 1)));
                  break;
              case STATE_START_ELEMENT:
                  int attrIdx = events.get(n,4);
                  
                  handler.startElement(st.getSymbol(events.get(n,1)), 
                                       st.getSymbol(events.get(n,2)),
                                       st.getSymbol(events.get(n,3)),
                                       (org.xml.sax.Attributes)attrs[events.get(n,4)]);
                  break;
              case STATE_END_ELEMENT:
                  handler.endElement(st.getSymbol(events.get(n,1)), 
                                     st.getSymbol(events.get(n,2)),
                                     st.getSymbol(events.get(n,3)));
                  break;
              case STATE_CHARACTERS:
                  handler.characters(st.getSymbol(events.get(n,1)).toCharArray(), 
                                     events.get(n,2),
                                     events.get(n,3));
                  break;
              case STATE_IGNORABLE_WHITESPACE:
                  handler.characters(st.getSymbol(events.get(n,1)).toCharArray(), 
                                     events.get(n,2),
                                     events.get(n,3));
                  break;
              case STATE_PROCESSING_INSTRUCTION:
                  handler.processingInstruction(st.getSymbol(events.get(n,1)),
                                                st.getSymbol(events.get(n,2)));
                  break;
              case STATE_SKIPPED_ENTITY:
                  handler.skippedEntity(st.getSymbol(events.get(n,1)));
                  break;
              }
          }
      }
      
  /////////////////////////////////////////////
      class intArrayVector {
          private int RECORD_SIZE = 5;
          private int currentSize = 0;
          private int[] intarray = new int[50 * RECORD_SIZE];  // default to 50 5 field records
          
          public int add(int p1, int p2, int p3, int p4, int p5) {
              if (currentSize == intarray.length) {
                  int[] newarray = new int[currentSize * 2];
                  System.arraycopy(intarray, 0, newarray, 0, currentSize);
                  intarray = newarray;
              }
              int pos = currentSize / RECORD_SIZE;
              intarray[currentSize++] = p1;
              intarray[currentSize++] = p2;
              intarray[currentSize++] = p3;
              intarray[currentSize++] = p4;
              intarray[currentSize++] = p5;
              return pos;
          }
  
          public int[] get(int pos) {
              int[] ints = {intarray[(pos * 5)], 
                            intarray[(pos * 5)+1],
                            intarray[(pos * 5)+2],
                            intarray[(pos * 5)+3],
                            intarray[(pos * 5)+4]};
              return ints;
          }
          
          public int get(int pos, int fld) {
              return intarray[(pos * RECORD_SIZE) + fld];
          }
      
          public int getLength() {
              return (currentSize / RECORD_SIZE);
          }
      }
  /////////////////////////////////////////////
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/SOAPHandler.java
  
  Index: SOAPHandler.java
  ===================================================================
  package org.apache.axis.message;
  
  /* Copyright (c) 2000, Allaire Corp.
   * 
   * All rights reserved.
   */
  
  /** A <code>SOAPHandler</code>
   * 
   * @author Glen Daniels (gdaniels@allaire.com)
   */
  
  import org.xml.sax.helpers.DefaultHandler;
  import org.xml.sax.*;
  import org.apache.axis.encoding.DeserializationContext;
  
  public class SOAPHandler extends DefaultHandler
  {
      public void startElement(String namespace, String localName,
                               String qName, Attributes attributes,
                               DeserializationContext context)
          throws SAXException
      {
      }
      
      public void endElement(String namespace, String localName,
                             DeserializationContext context)
          throws SAXException
      {
      }
      
      public SOAPHandler onStartChild(String namespace, String localName,
                               Attributes attributes,
                               DeserializationContext context)
          throws SAXException
      {
          return null;
      }
      
      public void onEndChild(String namespace, String localName,
                             DeserializationContext context)
          throws SAXException
      {
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/SimpleHandlerFactory.java
  
  Index: SimpleHandlerFactory.java
  ===================================================================
  package org.apache.axis.message;
  
  /** A <code>SimpleHandlerFactory</code>
   * 
   * @author Glen Daniels (gdaniels@allaire.com)
   */
  import java.util.*;
  import java.lang.reflect.*;
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.utils.QName;
  import org.xml.sax.*;
  
  public class SimpleHandlerFactory implements HandlerFactory
  {
      HashMap map = new HashMap();
      SOAPHandler defaultHandler;
      
      public void addHandlerForQName(QName qName, Class cls)
      {
          map.put(qName, cls);
      }
      
      public void addDefaultHandler(SOAPHandler handler)
      {
          defaultHandler = handler;
      }
      
      public void removeDefaultHandler()
      {
          defaultHandler = null;
      }
      
      public SOAPHandler getHandler(String namespace,
                                    String localName,
                                    Attributes attributes,
                                    DeserializationContext context)
          throws SAXException
      {
          SOAPHandler handler = null;
          QName qName = new QName(namespace, localName);
          Class cls = (Class)map.get(qName);
  
          if (cls != null) {
              try {
                  handler = (SOAPHandler)cls.newInstance();
              } catch (Exception e) {
                  throw new SAXException("Coudldn't create class " + cls.getName());
              }
          }
          
          if (handler == null)
              handler = defaultHandler;
          
          if (handler == null)
              throw new SAXException("No handler for QName " + qName);
          return handler;
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  package org.apache.axis.message;
  
  import java.util.ArrayList;
  
  /**
   * This was swiped from xerces2, I stripped the comments
   * out to make it easier for me to see what was going on,
   * I'll add them back in later
   */
  public class SymbolTable {
  
      protected static final int TABLE_SIZE = 101;
      protected Entry[] fBuckets = new Entry[TABLE_SIZE];
      public SymbolTable() {}
      
      public ArrayList list = new ArrayList();
      
      public String getSymbol(int bucket) {
          return (String)list.get(bucket);
          /*
          return fBuckets[bucket].symbol;
          */
      }
      
      public int addSymbol(String symbol) {
          int ret = list.indexOf(symbol);
          if (ret == -1) {
              list.add(symbol);
              ret = list.size() - 1;
          }
          return ret;
          /*
          int bucket = hash(symbol) % TABLE_SIZE;
          int n = 0;
          OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
              n++;
              int length = symbol.length();
              if (length == entry.characters.length) {
                  for (int i = 0; i < length; i++) {
                      if (symbol.charAt(i) != entry.characters[i]) {
                          continue OUTER;
                      }
                  }
                  return bucket;
              }
          }
          Entry entry = new Entry(symbol, fBuckets[bucket]);
          fBuckets[bucket] = entry;
          return bucket;
          */
      }
      public int addSymbol(char[] buffer, int offset, int length) {
          return addSymbol(new String(buffer, offset, length));
          /*
          int bucket = hash(buffer, offset, length) % TABLE_SIZE;
          int n = 0;
          OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
              n++;
              if (length == entry.characters.length) {
                  for (int i = 0; i < length; i++) {
                      if (buffer[offset + i] != entry.characters[i]) {
                          continue OUTER;
                      }
                  }
                  return bucket;
              }
          }
          Entry entry = new Entry(buffer, offset, length, fBuckets[bucket]);
          fBuckets[bucket] = entry;
          return bucket;
          */
      }
      public int hash(String symbol) {
          int code = 0;
          int length = symbol.length();
          for (int i = 0; i < length; i++) {
              code = code * 37 + symbol.charAt(i);
          }
          return code & 0x7FFFFFF;
      }
      public int hash(char[] buffer, int offset, int length) {
          int code = 0;
          for (int i = 0; i < length; i++) {
              code = code * 37 + buffer[offset + i];
          }
          return code & 0x7FFFFFF;
      }
      protected static final class Entry {
          public String symbol;
          public char[] characters;
          public Entry next;
          public Entry(String symbol, Entry next) {
              this.symbol = symbol;
              characters = new char[symbol.length()];
              symbol.getChars(0, characters.length, characters, 0);
              this.next = next;
          }
          public Entry(char[] ch, int offset, int length, Entry next) {
              characters = new char[length];
              System.arraycopy(ch, offset, characters, 0, length);
              symbol = new String(characters);
              this.next = next;
          }
      }
  }
  
  
  
  1.31      +7 -3      xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
  
  Index: AxisServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- AxisServlet.java	2001/07/12 15:04:37	1.30
  +++ AxisServlet.java	2001/07/15 16:40:15	1.31
  @@ -184,9 +184,13 @@
                   msg = new Message((AxisFault)e);
                   msgContext.setResponseMessage(msg);
               } else {
  -                SOAPEnvelope env = msg.getAsSOAPEnvelope();
  -                env.clearBody();
  -                env.addBodyElement(new SOAPFaultElement((AxisFault)e));
  +                try {
  +                    SOAPEnvelope env = msg.getAsSOAPEnvelope();
  +                    env.clearBody();
  +                    env.addBodyElement(new SOAPFaultElement((AxisFault)e));
  +                } catch (AxisFault af) {
  +                    // Should never reach here!
  +                }
               }
           }
   
  
  
  
  1.16      +1 -1      xml-axis/java/test/RPCDispatch/TestRPC.java
  
  Index: TestRPC.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestRPC.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TestRPC.java	2001/07/10 03:58:39	1.15
  +++ TestRPC.java	2001/07/15 16:40:15	1.16
  @@ -61,7 +61,7 @@
           // Create the message context
           MessageContext msgContext = new MessageContext(engine);
           DeserializationContext deserContext =
  -            new DeserializationContext(null, msgContext, null);
  +            new DeserializationContext(msgContext);
   
           // Set the dispatch either by SOAPAction or methodNS
           String methodNS = null;
  
  
  
  1.3       +21 -8     xml-axis/java/test/encoding/DataSer.java
  
  Index: DataSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/DataSer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DataSer.java	2001/07/08 14:18:39	1.2
  +++ DataSer.java	2001/07/15 16:40:16	1.3
  @@ -5,15 +5,17 @@
   import java.util.*;
   import java.io.*;
   import org.xml.sax.*;
  +import org.apache.axis.message.SOAPHandler;
  +import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.QName;
   
  -public class DataSer extends DeserializerBase implements Serializer
  +public class DataSer extends Deserializer implements Serializer
   {
       public static final String STRINGMEMBER = "stringMember";
       public static final String FLOATMEMBER = "floatMember";
       
       public static class DataSerFactory implements DeserializerFactory {
  -        public DeserializerBase getDeserializer(Class cls) {
  +        public Deserializer getDeserializer(Class cls) {
               return new DataSer();
           }
       }
  @@ -34,24 +36,35 @@
       /** DESERIALIZER STUFF - event handlers
        */
       
  -    public void onStartChild(String namespace, String localName,
  -                             String qName, Attributes attributes)
  +    public SOAPHandler onStartChild(String namespace,
  +                                    String localName,
  +                                    Attributes attributes,
  +                                    DeserializationContext context)
           throws SAXException
       {
           QName typeQName = (QName)typesByMemberName.get(localName);
           if (typeQName == null)
  -            throw new SAXException("Invalid element in Data struct - " + localName);
  +            throw new SAXException("Invalid element in Data struct - " +
  +                                   localName);
           
           // These can come in either order.
  -        DeserializerBase dSer = context.getDeserializer(typeQName);
  +        Deserializer dSer = context.getTypeMappingRegistry().
  +                                                     getDeserializer(typeQName);
           
           if (dSer == null)
               throw new SAXException("No deserializer for a " + typeQName + "???");
           
  -        context.pushElementHandler(dSer);
  +        try {
  +            dSer.registerValueTarget(new Deserializer.FieldTarget(value,
  +                                                                  localName));
  +        } catch (NoSuchFieldException e) {
  +            throw new SAXException(e);
  +        }
  +        
  +        return dSer;
       }
       
  -    public void onEndChild(String localName, DeserializerBase deserializer)
  +    public void onEndChild(String localName, Deserializer deserializer)
           throws SAXException
       {
           if (STRINGMEMBER.equals(localName)) {
  
  
  
  1.9       +4 -6      xml-axis/java/test/encoding/TestHrefs.java
  
  Index: TestHrefs.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestHrefs.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestHrefs.java	2001/07/13 05:19:15	1.8
  +++ TestHrefs.java	2001/07/15 16:40:16	1.9
  @@ -48,14 +48,13 @@
                 "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
                 "xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" " +
                 "xmlns:xsi=\"" + NS_XSI + "\" " +
  -              "xmlns:xsd=\"" + NS_XSD + "\">\n";
  -        
  -        messageParts = new String [] {
  +              "xmlns:xsd=\"" + NS_XSD + "\">\n" +
                 "<soap:Body>\n" +
                   "<methodResult xmlns=\"http://tempuri.org/\">\n" +
                    "<reference href=\"#1\"/>\n" +
  -                "</methodResult>\n",
  -
  +                "</methodResult>\n";
  +        
  +        messageParts = new String [] {
                 "</soap:Body>\n",
           
                "</soap:Envelope>\n" };
  @@ -97,7 +96,6 @@
               "<result root=\"0\" id=\"1\" xsi:type=\"xsd:string\">abc</result>";
           deserialize(result, "abc", 0);
           deserialize(result, "abc", 1);
  -        deserialize(result, "abc", 2);
       }
   
       /*
  
  
  
  1.6       +4 -3      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestSer.java	2001/06/11 12:31:21	1.5
  +++ TestSer.java	2001/07/15 16:40:16	1.6
  @@ -48,11 +48,12 @@
           
           StringReader reader = new StringReader(msgString);
           
  -        SAXAdapter adapter = new SAXAdapter(new InputSource(reader), msgContext);
  -        reg = adapter.getContext().getTypeMappingRegistry();
  +        DeserializationContext dser = new DeserializationContext(new InputSource(reader), msgContext);
  +        reg = dser.getTypeMappingRegistry();
           reg.addDeserializerFactory(dataQName, Data.class, DataSer.getFactory());
  +        dser.parse();
           
  -        SOAPEnvelope env = adapter.getEnvelope();
  +        SOAPEnvelope env = dser.getEnvelope();
           RPCElement rpcElem = (RPCElement)env.getFirstBody();
           RPCParam struct = rpcElem.getParam("struct");
           assertNotNull("No <struct> param", struct);
  
  
  
  1.6       +4 -2      xml-axis/java/test/encoding/TestString.java
  
  Index: TestString.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestString.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestString.java	2001/07/01 12:58:54	1.5
  +++ TestString.java	2001/07/15 16:40:16	1.6
  @@ -38,8 +38,10 @@
           
           StringReader reader = new StringReader(msgString);
           
  -        SAXAdapter adapter = new SAXAdapter(new InputSource(reader), msgContext);
  -        SOAPEnvelope env = adapter.getEnvelope();
  +        DeserializationContext dser = new DeserializationContext(new InputSource(reader), msgContext);
  +        dser.parse();
  +        
  +        SOAPEnvelope env = dser.getEnvelope();
           RPCElement rpcElem = (RPCElement)env.getFirstBody();
           RPCParam output = rpcElem.getParam("testParam");
           assertNotNull("No <testParam> param", output);
  
  
  

Mime
View raw message