You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by sn...@apache.org on 2002/11/19 15:34:36 UTC

cvs commit: xml-soap/java/src/org/apache/soap Body.java Fault.java Header.java

snichol     2002/11/19 06:34:36

  Modified:    java/src/org/apache/soap Body.java Fault.java Header.java
  Log:
  Add/edit javadocs.  Improve toString.
  
  Revision  Changes    Path
  1.12      +4 -4      xml-soap/java/src/org/apache/soap/Body.java
  
  Index: Body.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/Body.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Body.java	18 Nov 2002 21:52:05 -0000	1.11
  +++ Body.java	19 Nov 2002 14:34:36 -0000	1.12
  @@ -78,7 +78,7 @@
    */
   public class Body
   {
  -  // Body entries are Element or Bean
  +  // Body entries are Element or Bean (typically RPC Response or Call)
     private Vector           bodyEntries = null;
     // Attributes from XML element
     private AttributeHandler attrHandler = null;
  @@ -133,7 +133,7 @@
     }
   
     /**
  -   * Sets the body entries, which are of type Element or Bean.
  +   * Sets the body entries, which are of type Element or Bean (RPC Call or Response).
      */
     public void setBodyEntries(Vector bodyEntries)
     {
  @@ -141,7 +141,7 @@
     }
   
     /**
  -   * Gets the body entries, which are of type Element or Bean.
  +   * Gets the body entries, which are of type Element or Bean (RPC Call or Response).
      */
     public Vector getBodyEntries()
     {
  @@ -279,7 +279,7 @@
   
         for (int i = 0; i < bodyEntries.size(); i++)
         {
  -        pw.println("[(" + i + ")=" + bodyEntries.elementAt(i) + "]");
  +        pw.println("[(" + i + ")=" + DOM2Writer.nodeToString((Element) bodyEntries.elementAt(i)) + "]");
         }
       }
   
  
  
  
  1.13      +63 -0     xml-soap/java/src/org/apache/soap/Fault.java
  
  Index: Fault.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/Fault.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Fault.java	18 Nov 2002 21:52:05 -0000	1.12
  +++ Fault.java	19 Nov 2002 14:34:36 -0000	1.13
  @@ -81,88 +81,145 @@
     private String           faultCode     = null;
     private String           faultString   = null;
     private String           faultActorURI = null;
  +  // Detail entries are Element or Parameter
     private Vector           detailEntries = null;
  +  // Fault entries are Element
     private Vector           faultEntries  = null;
  +  // Attributes from XML element
     private AttributeHandler attrHandler   = new AttributeHandler();
   
  +  /**
  +   * Default constructor.  Typically used for incoming faults.
  +   */
     public Fault() {}
   
  +  /**
  +   * Constructor that specifies a SOAP exception.  Typically used
  +   * for outgoing faults.
  +   *
  +   * @param _soapException The SOAP exception.
  +   */
     public Fault(SOAPException _soapException)
     {
       faultCode = _soapException.getFaultCode();
       faultString = _soapException.getMessage();
     }
   
  +  /**
  +   * Sets an XML element attribute.
  +   */
     public void setAttribute(QName attrQName, String value)
     {
       attrHandler.setAttribute(attrQName, value);
     }
   
  +  /**
  +   * Gets an XML element attribute.
  +   */
     public String getAttribute(QName attrQName)
     {
       return attrHandler.getAttribute(attrQName);
     }
   
  +  /**
  +   * Removes an XML element attribute.
  +   */
     public void removeAttribute(QName attrQName)
     {
       attrHandler.removeAttribute(attrQName);
     }
   
  +  /**
  +   * Sets a namespace prefix/URI for an XML element attribute.
  +   */
     public void declareNamespace(String nsPrefix, String namespaceURI)
     {
       attrHandler.declareNamespace(nsPrefix, namespaceURI);
     }
   
  +  /**
  +   * Sets the fault code.
  +   */
     public void setFaultCode(String faultCode)
     {
       this.faultCode = faultCode;
     }
   
  +  /**
  +   * Gets the fault code.
  +   */
     public String getFaultCode()
     {
       return faultCode;
     }
   
  +  /**
  +   * Sets the fault string.
  +   */
     public void setFaultString(String faultString)
     {
       this.faultString = faultString;
     }
   
  +  /**
  +   * Gets the fault string.
  +   */
     public String getFaultString()
     {
       return faultString;
     }
   
  +  /**
  +   * Sets the fault actor URI.
  +   */
     public void setFaultActorURI(String faultActorURI)
     {
       this.faultActorURI = faultActorURI;
     }
   
  +  /**
  +   * Gets the fault actor URI.
  +   */
     public String getFaultActorURI()
     {
       return faultActorURI;
     }
   
  +  /**
  +   * Sets the detail entries (type Element or Parameter).
  +   */
     public void setDetailEntries(Vector detailEntries)
     {
       this.detailEntries = detailEntries;
     }
   
  +  /**
  +   * Gets the detail entries (type Element or Parameter).
  +   */
     public Vector getDetailEntries()
     {
       return detailEntries;
     }
   
  +  /**
  +   * Sets the fault entries (type Element).
  +   */
     public void setFaultEntries(Vector faultEntries)
     {
       this.faultEntries = faultEntries;
     }
   
  +  /**
  +   * Gets the fault entries (type Element).
  +   */
     public Vector getFaultEntries()
     {
       return faultEntries;
     }
   
  +  /**
  +   * Marshalls the Fault as XML.
  +   */
     public void marshall(String inScopeEncStyle, Writer sink, NSStack nsStack,
                          XMLJavaMappingRegistry xjmr, SOAPContext ctx)
       throws IllegalArgumentException, IOException
  @@ -287,6 +344,9 @@
       nsStack.popScope();
     }
   
  +  /**
  +   * Unmarshalls the fault from XML.
  +   */
     public static Fault unmarshall(String inScopeEncStyle, Node src,
                                    XMLJavaMappingRegistry xjmr, SOAPContext ctx)
       throws IllegalArgumentException
  @@ -444,6 +504,9 @@
       return fault;
     }
   
  +  /**
  +   * Gets this fault as a string.
  +   */
     public String toString()
     {
       StringWriter sw = new StringWriter();
  
  
  
  1.7       +34 -8     xml-soap/java/src/org/apache/soap/Header.java
  
  Index: Header.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/Header.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Header.java	18 Nov 2002 21:52:05 -0000	1.6
  +++ Header.java	19 Nov 2002 14:34:36 -0000	1.7
  @@ -74,39 +74,62 @@
    */
   public class Header
   {
  +  // Header entries have type Element */
     private Vector           headerEntries = null;
  +  // Attributes from XML element
     private AttributeHandler attrHandler   = new AttributeHandler();
   
  +  /**
  +   * Sets an XML element attribute.
  +   */
     public void setAttribute(QName attrQName, String value)
     {
       attrHandler.setAttribute(attrQName, value);
     }
   
  +  /**
  +   * Gets an XML element attribute.
  +   */
     public String getAttribute(QName attrQName)
     {
       return attrHandler.getAttribute(attrQName);
     }
   
  +  /**
  +   * Removes an XML element attribute.
  +   */
     public void removeAttribute(QName attrQName)
     {
       attrHandler.removeAttribute(attrQName);
     }
   
  +  /**
  +   * Sets a namespace prefix/URI for an XML element attribute.
  +   */
     public void declareNamespace(String nsPrefix, String namespaceURI)
     {
       attrHandler.declareNamespace(nsPrefix, namespaceURI);
     }
   
  +  /**
  +   * Sets the header entries, which are of type Element.
  +   */
     public void setHeaderEntries(Vector headerEntries)
     {
       this.headerEntries = headerEntries;
     }
   
  +  /**
  +   * Gets the header entries, which are of type Element.
  +   */
     public Vector getHeaderEntries()
     {
       return headerEntries;
     }
   
  +  /**
  +   * Marshalls the Header as XML.
  +   */
     public void marshall(Writer sink, NSStack nsStack,
                          XMLJavaMappingRegistry xjmr, SOAPContext ctx)
       throws IllegalArgumentException, IOException
  @@ -148,6 +171,9 @@
       nsStack.popScope();
     }
   
  +  /**
  +   * Unmarshalls the header from XML.
  +   */
     public static Header unmarshall(Node src, SOAPContext ctx)
       throws IllegalArgumentException
     {
  @@ -170,28 +196,28 @@
       return header;
     }
   
  +  /**
  +   * Gets this header as a string.
  +   */
     public String toString()
     {
       StringWriter sw = new StringWriter();
       PrintWriter pw = new PrintWriter(sw);
   
       pw.print("[Attributes=" + attrHandler + "] " +
  -             "[HeaderEntries={");
  +             "[HeaderEntries=");
   
       if (headerEntries != null)
       {
  +      pw.println();
  +
         for (int i = 0; i < headerEntries.size(); i++)
         {
  -        if (i > 0)
  -        {
  -          pw.print(", ");
  -        }
  -
  -        pw.print("[" + headerEntries.elementAt(i) + "]");
  +        pw.println("[(" + i + ")=" + DOM2Writer.nodeToString((Element) headerEntries.elementAt(i)) + "]");
         }
       }
   
  -    pw.print("}]");
  +    pw.print("]");
   
       return sw.toString();
     }