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/src/org/apache/axis/message SOAPFaultElement.java SOAPSAXHandler.java
Date Thu, 31 May 2001 15:34:48 GMT
gdaniels    01/05/31 08:34:47

  Modified:    java/src/org/apache/axis/message SOAPFaultElement.java
                        SOAPSAXHandler.java
  Log:
  Rough in real support for Faults.
  
  Create SOAPFaultElements when we get faults while parsing.
  
  Parse faults.  To fix this, I added a call to onEndChild() for the current
  elementHandler each time recordDepth comes back to 1.  This allows
  easier writing of deserializers that handle one depth of sub-element
  without using sub-deserializers.
  
  Revision  Changes    Path
  1.3       +31 -7     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SOAPFaultElement.java	2001/05/03 15:35:46	1.2
  +++ SOAPFaultElement.java	2001/05/31 15:34:40	1.3
  @@ -86,17 +86,41 @@
           return new FaultElementFactory();
       }
       
  -    class FaultContentHandler extends DeserializerBase
  +    String currentSubElement;
  +    StringBuffer currentValue;
  +    
  +    public void onStartChild(String namespace, String name, String qName,
  +                             Attributes attributes)
  +        throws SAXException
       {
  -        private boolean passedMyStart = false;
  +        currentSubElement = name;
  +        currentValue = new StringBuffer();
  +    }
  +    
  +    public void characters(char [] chars, int start, int end)
  +    {
  +        currentValue.append(chars, start, end);
  +    }
  +
  +    public void onEndChild(String localName, DeserializerBase deserializer)
  +        throws SAXException
  +    {
  +        if (fault == null)
  +            fault = new AxisFault();
           
  -        public void startElement(String namespace, String name, String qName,
  -                                 Attributes attributes)
  -        {
  -            // *** TBD ***
  +        if (currentSubElement.equals("faultcode")) {
  +            fault.setFaultCode(currentValue.toString());
  +        } else if (currentSubElement.equals("faultstring")) {
  +            fault.setFaultString(currentValue.toString());
  +        } else if (currentSubElement.equals("faultactor")) {
  +            fault.setFaultActor(currentValue.toString());
  +        } else if (currentSubElement.equals("details")) {
  +            // !!! Not supported yet
  +            // fault.setFaultDetails(...);
           }
       }
  -    public DeserializerBase getContentHandler() { return new FaultContentHandler(); }
  +
  +    public DeserializerBase getContentHandler() { return this; }
       
       ///////////////////////////////////////////////////////////////
       
  
  
  
  1.16      +11 -1     xml-axis/java/src/org/apache/axis/message/SOAPSAXHandler.java
  
  Index: SOAPSAXHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPSAXHandler.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SOAPSAXHandler.java	2001/05/30 20:14:06	1.15
  +++ SOAPSAXHandler.java	2001/05/31 15:34:42	1.16
  @@ -127,6 +127,13 @@
                                               Attributes attributes,
                                               DeserializationContext context)
           {
  +            if (localName.equals(Constants.ELEM_FAULT)) {
  +                return SOAPFaultElement.getFactory().createElement(namespace,
  +                                                                   localName,
  +                                                                   attributes,
  +                                                                   context);
  +            }
  +            
               ServiceDescription serviceDesc = context.getServiceDescription();
               if ((serviceDesc != null) && (!serviceDesc.isRPC())) {
                   return new SOAPBodyElement(namespace, localName, attributes, context);
  @@ -161,7 +168,7 @@
           this.context = new DeserializationContext(this,msgContext);
   
           // just testing...
  -        headerRegistry.registerFactory("urn:myNS", "Debug", DebugHeader.getFactory());
  +        headerRegistry.registerFactory(Constants.URI_DEBUG, "Debug", DebugHeader.getFactory());
       }
       
       public int getState()
  @@ -618,6 +625,9 @@
               //System.out.println("  depth is " + recordingDepth);
               
               elementHandler.endElement(namespace, localName, qName);
  +            
  +            if (recordingDepth == 1)
  +                elementHandler.onEndChild(localName, null);
   
               if (recordingDepth == 0) {
                   DeserializerBase oldElementHandler = elementHandler;
  
  
  

Mime
View raw message