axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject cvs commit: xml-axis/java/test/soap TestHeaderAttrs.java
Date Tue, 26 Mar 2002 16:40:36 GMT
glyn        02/03/26 08:40:35

  Modified:    java/docs messagemodelclasses.jpg
               java/samples/echo echoHeaderStringHandler.java
                        echoHeaderStructHandler.java
               java/samples/security SignedSOAPEnvelope.java
               java/src/org/apache/axis/client Call.java
               java/src/org/apache/axis/handlers DebugHandler.java
                        SimpleSessionHandler.java
               java/src/org/apache/axis/handlers/soap SOAPService.java
               java/src/org/apache/axis/message HeaderBuilder.java
                        SOAPEnvelope.java
               java/test/soap TestHeaderAttrs.java
  Added:       java/src/org/apache/axis/message SOAPHeaderElement.java
  Removed:     java/src/org/apache/axis/message SOAPHeader.java
  Log:
  Rename SOAPHeader to SOAPHeaderElement in org.apache.axis.message to avoid
  confusion with javax.xml.soap.SOAPHeader.
  
  Make Axis SOAPHeaderElement implement JAXM SOAPHeaderElement.
  
  Revision  Changes    Path
  1.3       +101 -131  xml-axis/java/docs/messagemodelclasses.jpg
  
  	<<Binary file>>
  
  
  1.3       +6 -6      xml-axis/java/samples/echo/echoHeaderStringHandler.java
  
  Index: echoHeaderStringHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/echoHeaderStringHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- echoHeaderStringHandler.java	19 Feb 2002 17:38:18 -0000	1.2
  +++ echoHeaderStringHandler.java	26 Mar 2002 16:40:34 -0000	1.3
  @@ -61,7 +61,7 @@
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeader;
  +import org.apache.axis.message.SOAPHeaderElement;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -100,9 +100,9 @@
               if (msg == null)
                   return;
               SOAPEnvelope env = msg.getSOAPEnvelope();
  -            SOAPHeader header = new SOAPHeader(HEADER_NS,
  -                                               HEADER_RESNAME,
  -                                               strVal);
  +            SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS,
  +                                                             HEADER_RESNAME,
  +                                                             strVal);
               env.addHeader(header);
           } else {
               // Request. look for the header
  @@ -111,8 +111,8 @@
                   throw new AxisFault(JavaUtils.getMessage("noRequest00"));
               
               SOAPEnvelope env = msg.getSOAPEnvelope();
  -            SOAPHeader header = env.getHeaderByName(HEADER_NS,
  -                                                    HEADER_REQNAME);
  +            SOAPHeaderElement header = env.getHeaderByName(HEADER_NS,
  +                                                           HEADER_REQNAME);
               
               if (header != null) {
                   // seems Axis has already ignored any headers not tageted
  
  
  
  1.3       +6 -6      xml-axis/java/samples/echo/echoHeaderStructHandler.java
  
  Index: echoHeaderStructHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/echoHeaderStructHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- echoHeaderStructHandler.java	19 Feb 2002 17:38:18 -0000	1.2
  +++ echoHeaderStructHandler.java	26 Mar 2002 16:40:34 -0000	1.3
  @@ -61,7 +61,7 @@
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeader;
  +import org.apache.axis.message.SOAPHeaderElement;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -104,9 +104,9 @@
               if (msg == null)
                   return;
               SOAPEnvelope env = msg.getSOAPEnvelope();
  -            SOAPHeader header = new SOAPHeader(HEADER_NS,
  -                                               HEADER_RESNAME,
  -                                               hdrVal);
  +            SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS,
  +                                                             HEADER_RESNAME,
  +                                                             hdrVal);
               env.addHeader(header);
           } else {
               // Request. look for the header
  @@ -115,8 +115,8 @@
                   throw new AxisFault(JavaUtils.getMessage("noRequest00"));
               
               SOAPEnvelope env = msg.getSOAPEnvelope();
  -            SOAPHeader header = env.getHeaderByName(HEADER_NS,
  -                                                    HEADER_REQNAME);
  +            SOAPHeaderElement header = env.getHeaderByName(HEADER_NS,
  +                                                           HEADER_REQNAME);
               
               if (header != null) {
                   // seems Axis has already ignored any headers not tageted
  
  
  
  1.7       +5 -2      xml-axis/java/samples/security/SignedSOAPEnvelope.java
  
  Index: SignedSOAPEnvelope.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/security/SignedSOAPEnvelope.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SignedSOAPEnvelope.java	13 Feb 2002 15:21:16 -0000	1.6
  +++ SignedSOAPEnvelope.java	26 Mar 2002 16:40:34 -0000	1.7
  @@ -64,7 +64,7 @@
   import org.apache.axis.encoding.SerializationContext;
   import org.apache.axis.encoding.SerializationContextImpl;
   import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeader;
  +import org.apache.axis.message.SOAPHeaderElement;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.Mapping;
   import org.apache.axis.utils.XMLUtils;
  @@ -114,7 +114,10 @@
               env.addAttribute(Constants.URI_SOAP_ENV, "actor", "some-uri");
               env.addAttribute(Constants.URI_SOAP_ENV, "mustUnderstand", "1");
   
  -            SOAPHeader header = new SOAPHeader(XMLUtils.StringToElement(SOAPSECNS, "Signature",
""));
  +            SOAPHeaderElement header = 
  +                new SOAPHeaderElement(XMLUtils.StringToElement(SOAPSECNS,
  +                                                               "Signature",
  +                                                               ""));
               env.addHeader(header);
   
               Document doc = getSOAPEnvelopeAsDocument(env, msgContext);
  
  
  
  1.106     +6 -6      xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- Call.java	25 Mar 2002 16:12:15 -0000	1.105
  +++ Call.java	26 Mar 2002 16:40:34 -0000	1.106
  @@ -76,7 +76,7 @@
   import org.apache.axis.message.SOAPBodyElement;
   import org.apache.axis.message.SOAPEnvelope;
   import org.apache.axis.message.SOAPFaultElement;
  -import org.apache.axis.message.SOAPHeader;
  +import org.apache.axis.message.SOAPHeaderElement;
   import org.apache.axis.transport.http.HTTPTransport;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.attachments.AttachmentPart;
  @@ -1185,7 +1185,7 @@
               env = new SOAPEnvelope();
   
               for ( i = 0 ; myHeaders != null && i < myHeaders.size() ; i++ )
  -                env.addHeader((SOAPHeader)myHeaders.get(i));
  +                env.addHeader((SOAPHeaderElement)myHeaders.get(i));
   
               if ( !(params[0] instanceof SOAPEnvelope) )
                   for ( i = 0 ; i < params.length ; i++ )
  @@ -1259,7 +1259,7 @@
               int     i ;
   
               for ( i = 0 ; myHeaders != null && i < myHeaders.size() ; i++ )
  -                env.addHeader((SOAPHeader)myHeaders.get(i));
  +                env.addHeader((SOAPHeaderElement)myHeaders.get(i));
   
               msg = new Message( env );
               setRequestMessage( msg );
  @@ -1502,9 +1502,9 @@
        *
        * Note: Not part of JAX-RPC specification.
        *
  -     * @param header a SOAPHeader to be inserted into messages
  +     * @param header a SOAPHeaderElement to be inserted into messages
        */
  -    public void addHeader(SOAPHeader header)
  +    public void addHeader(SOAPHeaderElement header)
       {
           if (myHeaders == null) {
               myHeaders = new Vector();
  @@ -1695,7 +1695,7 @@
           // If we have headers to insert, do so now.
           if (myHeaders != null) {
               for (int i = 0; i < myHeaders.size(); i++) {
  -                reqEnv.addHeader((SOAPHeader)myHeaders.get(i));
  +                reqEnv.addHeader((SOAPHeaderElement)myHeaders.get(i));
               }
           }
   
  
  
  
  1.33      +3 -3      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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- DebugHandler.java	25 Feb 2002 17:38:15 -0000	1.32
  +++ DebugHandler.java	26 Mar 2002 16:40:35 -0000	1.33
  @@ -60,7 +60,7 @@
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeader;
  +import org.apache.axis.message.SOAPHeaderElement;
   import org.apache.axis.utils.JavaUtils;
   
   import org.apache.commons.logging.Log;
  @@ -81,8 +81,8 @@
               Message       msg = msgContext.getRequestMessage();
   
               SOAPEnvelope message = (SOAPEnvelope)msg.getSOAPEnvelope();
  -            SOAPHeader header = message.getHeaderByName(Constants.URI_DEBUG,
  -                                                        "Debug");
  +            SOAPHeaderElement header = message.
  +                getHeaderByName(Constants.URI_DEBUG, "Debug");
   
               if (header != null) {
                   Integer i = ((Integer)header
  
  
  
  1.15      +11 -11    xml-axis/java/src/org/apache/axis/handlers/SimpleSessionHandler.java
  
  Index: SimpleSessionHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/SimpleSessionHandler.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SimpleSessionHandler.java	22 Feb 2002 23:39:45 -0000	1.14
  +++ SimpleSessionHandler.java	26 Mar 2002 16:40:35 -0000	1.15
  @@ -61,7 +61,7 @@
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeader;
  +import org.apache.axis.message.SOAPHeaderElement;
   import org.apache.axis.session.SimpleSession;
   import org.apache.axis.utils.JavaUtils;
   
  @@ -192,8 +192,8 @@
               if (msg == null)
                   return;
               SOAPEnvelope env = msg.getSOAPEnvelope();
  -            SOAPHeader header = env.getHeaderByName(SESSION_NS,
  -                                                    SESSION_LOCALPART);
  +            SOAPHeaderElement header = env.getHeaderByName(SESSION_NS,
  +                                                           SESSION_LOCALPART);
               if (header == null)
                   return;
               
  @@ -219,9 +219,9 @@
                   throw new AxisFault(JavaUtils.getMessage("noRequest00"));
               
               SOAPEnvelope env = msg.getSOAPEnvelope();
  -            SOAPHeader header = new SOAPHeader(SESSION_NS,
  -                                               SESSION_LOCALPART,
  -                                               id);
  +            SOAPHeaderElement header = new SOAPHeaderElement(SESSION_NS,
  +                                                             SESSION_LOCALPART,
  +                                                             id);
               env.addHeader(header);
           }
       }
  @@ -242,9 +242,9 @@
               if (msg == null)
                   return;
               SOAPEnvelope env = msg.getSOAPEnvelope();
  -            SOAPHeader header = new SOAPHeader(SESSION_NS,
  -                                               SESSION_LOCALPART,
  -                                               id);
  +            SOAPHeaderElement header = new SOAPHeaderElement(SESSION_NS,
  +                                                             SESSION_LOCALPART,
  +                                                             id);
               env.addHeader(header);
           } else {
               // Request.  Set up the session if we find the header.
  @@ -253,8 +253,8 @@
                   throw new AxisFault(JavaUtils.getMessage("noRequest00"));
               
               SOAPEnvelope env = msg.getSOAPEnvelope();
  -            SOAPHeader header = env.getHeaderByName(SESSION_NS,
  -                                                    SESSION_LOCALPART);
  +            SOAPHeaderElement header = env.getHeaderByName(SESSION_NS,
  +                                                           SESSION_LOCALPART);
               Long id;
               
               if (header != null) {
  
  
  
  1.54      +9 -7      xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
  
  Index: SOAPService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- SOAPService.java	25 Mar 2002 04:44:02 -0000	1.53
  +++ SOAPService.java	26 Mar 2002 16:40:35 -0000	1.54
  @@ -71,7 +71,7 @@
   import org.apache.axis.encoding.TypeMapping;
   import org.apache.axis.encoding.TypeMappingRegistryImpl;
   import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeader;
  +import org.apache.axis.message.SOAPHeaderElement;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.LockableHashtable;
   import org.apache.axis.utils.XMLUtils;
  @@ -145,8 +145,9 @@
               Vector misunderstoodHeaders = null;
               Enumeration enum = headers.elements();
               while (enum.hasMoreElements()) {
  -                SOAPHeader header = (SOAPHeader)enum.nextElement();
  -                if (header.isMustUnderstand() && !header.isProcessed()) {
  +                SOAPHeaderElement header = (SOAPHeaderElement)enum.
  +                                               nextElement();
  +                if (header.getMustUnderstand() && !header.isProcessed()) {
                       if (misunderstoodHeaders == null)
                           misunderstoodHeaders = new Vector();
                       misunderstoodHeaders.addElement(header);
  @@ -168,12 +169,13 @@
                       env = respMsg.getSOAPEnvelope();
                       enum = misunderstoodHeaders.elements();
                       while (enum.hasMoreElements()) {
  -                        SOAPHeader badHeader = (SOAPHeader)enum.nextElement();
  +                        SOAPHeaderElement badHeader = (SOAPHeaderElement)enum.
  +                                                          nextElement();
                           QName badQName = new QName(badHeader.getNamespaceURI(),
                                                      badHeader.getName());
  -                        SOAPHeader newHeader = new SOAPHeader(
  -                                                              Constants.URI_SOAP12_FAULT_NS,
  -                                                              Constants.ELEM_MISUNDERSTOOD);
  +                        SOAPHeaderElement newHeader = new 
  +                            SOAPHeaderElement(Constants.URI_SOAP12_FAULT_NS,
  +                                              Constants.ELEM_MISUNDERSTOOD);
                           newHeader.addAttribute(null,
                                                  Constants.ATTR_QNAME,
                                                  badQName);
  
  
  
  1.7       +3 -3      xml-axis/java/src/org/apache/axis/message/HeaderBuilder.java
  
  Index: HeaderBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/HeaderBuilder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HeaderBuilder.java	30 Oct 2001 14:19:29 -0000	1.6
  +++ HeaderBuilder.java	26 Mar 2002 16:40:35 -0000	1.7
  @@ -66,7 +66,7 @@
   
   public class HeaderBuilder extends SOAPHandler
   {
  -    private SOAPHeader header;
  +    private SOAPHeaderElement header;
       private SOAPEnvelope envelope;
       
       HeaderBuilder(SOAPEnvelope envelope)
  @@ -81,8 +81,8 @@
                                       DeserializationContext context)
           throws SAXException
       {
  -        header = new SOAPHeader(namespace, localName, prefix,
  -                                attributes, context);
  +        header = new SOAPHeaderElement(namespace, localName, prefix,
  +                                       attributes, context);
           
           SOAPHandler handler = new SOAPHandler();
           handler.myElement = header;
  
  
  
  1.61      +15 -12    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.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- SOAPEnvelope.java	25 Mar 2002 14:14:55 -0000	1.60
  +++ SOAPEnvelope.java	26 Mar 2002 16:40:35 -0000	1.61
  @@ -179,7 +179,7 @@
           Vector results = new Vector();
           Iterator i = headers.iterator();
           while (i.hasNext()) {
  -            SOAPHeader header = (SOAPHeader)i.next();
  +            SOAPHeaderElement header = (SOAPHeaderElement)i.next();
               // Always process NEXT's, and then anything else in our list
               if (Constants.ACTOR_NEXT.equals(header.getActor()) || 
                   (actors != null && actors.contains(header.getActor()))) {
  @@ -190,7 +190,7 @@
           return results;
       }
       
  -    public void addHeader(SOAPHeader header)
  +    public void addHeader(SOAPHeaderElement header)
       {
           if (log.isDebugEnabled())
               log.debug(JavaUtils.getMessage("addHeader00"));
  @@ -209,7 +209,7 @@
           _isDirty = true;
       }
       
  -    public void removeHeader(SOAPHeader header)
  +    public void removeHeader(SOAPHeaderElement header)
       {
           if (log.isDebugEnabled())
               log.debug(JavaUtils.getMessage("removeHeader00"));
  @@ -253,7 +253,8 @@
        * Get a header by name (always respecting the currently in-scope
        * actors list)
        */ 
  -    public SOAPHeader getHeaderByName(String namespace, String localPart)
  +    public SOAPHeaderElement getHeaderByName(String namespace,
  +                                             String localPart)
           throws AxisFault
       {
           return getHeaderByName(namespace, localPart, false);
  @@ -263,13 +264,14 @@
        * Get a header by name, filtering for headers targeted at this
        * engine depending on the accessAllHeaders parameter.
        */ 
  -    public SOAPHeader getHeaderByName(String namespace, String localPart,
  -                                      boolean accessAllHeaders)
  +    public SOAPHeaderElement getHeaderByName(String namespace,
  +                                             String localPart,
  +                                             boolean accessAllHeaders)
           throws AxisFault
       {
  -        SOAPHeader header = (SOAPHeader)findElement(headers,
  -                                                    namespace,
  -                                                    localPart);
  +        SOAPHeaderElement header = (SOAPHeaderElement)findElement(headers,
  +                                                                  namespace,
  +                                                                  localPart);
   
           // If we're operating within an AxisEngine, respect its actor list
           // unless told otherwise
  @@ -346,9 +348,9 @@
            */
           Vector v = new Vector();
           Enumeration e = headers.elements();
  -        SOAPHeader header;
  +        SOAPHeaderElement header;
           while (e.hasMoreElements()) {
  -            header = (SOAPHeader)e.nextElement();
  +            header = (SOAPHeaderElement)e.nextElement();
               if (header.getNamespaceURI().equals(namespace) &&
                   header.getName().equals(localPart)) {
   
  @@ -409,7 +411,8 @@
                                              Constants.ELEM_HEADER), null);
               enum = headers.elements();
               while (enum.hasMoreElements()) {
  -                SOAPHeader header = (SOAPHeader)enum.nextElement();
  +                SOAPHeaderElement header = (SOAPHeaderElement)enum.
  +                                               nextElement();
                   header.output(context);
                   // Output this header element
               }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/message/SOAPHeaderElement.java
  
  Index: SOAPHeaderElement.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.message;
  
  import org.apache.axis.Constants;
  import org.apache.axis.soap.SOAPConstants;
  import org.apache.axis.encoding.DeserializationContext;
  import org.apache.axis.encoding.SerializationContext;
  import org.w3c.dom.Element;
  import org.xml.sax.Attributes;
  import org.xml.sax.helpers.AttributesImpl;
  
  import javax.xml.rpc.namespace.QName;
  
  /** 
   * A simple header element abstraction.  Extends MessageElement with
   * header-specific stuff like mustUnderstand, actor, and a 'processed' flag.
   *
   * @author Glen Daniels (gdaniels@macromedia.com)
   * @author Glyn Normington (glyn@apache.org)
   */
  public class SOAPHeaderElement extends MessageElement
      implements javax.xml.soap.SOAPHeaderElement {
      protected boolean   processed = false;
  
      protected String    actor;
      protected boolean   mustUnderstand = false;
  
      public SOAPHeaderElement() {
          super();
      }
  
      public SOAPHeaderElement(String namespace, String localPart)
      {
          super(namespace, localPart);
      }
  
      public SOAPHeaderElement(String namespace, String localPart, Object value)
      {
          super(namespace, localPart, value);
      }
  
      public SOAPHeaderElement(Element elem)
      {
          super(elem);
          String val = elem.getAttributeNS(Constants.URI_SOAP_ENV,
                                           Constants.ATTR_MUST_UNDERSTAND);
          mustUnderstand = ((val != null) && val.equals("1")) ? true : false;
  
          actor = elem.getAttributeNS(Constants.URI_SOAP_ENV,
                                      Constants.ATTR_ACTOR);
      }
  
      public SOAPHeaderElement(String namespace, String localPart, String prefix,
                        Attributes attributes, DeserializationContext context) {
          super(namespace, localPart, prefix, attributes, context);
  
          SOAPConstants soapConstants = context.getMessageContext().
                                                            getSOAPConstants();
  
          // Check for mustUnderstand
          String val = attributes.getValue(soapConstants.getEnvelopeURI(),
                                           Constants.ATTR_MUST_UNDERSTAND);
          mustUnderstand = ((val != null) && val.equals("1")) ? true : false;
  
          actor = attributes.getValue(soapConstants.getEnvelopeURI(),
                                      Constants.ATTR_ACTOR);
  
          processed = false;
      }
  
      public boolean getMustUnderstand() { return( mustUnderstand ); }
      public void setMustUnderstand(boolean b) {
          mustUnderstand = b ;
          String val = b ? "1" : "0";
  
          // Instead of doing this can we hang out until serialization time
          // and do it there, so that we can then resolve SOAP version?
          setAttribute(Constants.URI_SOAP_ENV,
                       Constants.ATTR_MUST_UNDERSTAND,
                       val);
      }
  
      public String getActor() { return( actor ); }
      public void setActor(String a) {
          actor = a ;
  
          // Instead of doing this can we hang out until serialization time
          // and do it there, so that we can then resolve SOAP version?
          setAttribute(Constants.URI_SOAP_ENV, Constants.ATTR_ACTOR, a);
      }
  
      public void setProcessed(boolean value) {
          processed = value ;
      }
  
      public boolean isProcessed() {
          return( processed );
      }
  }
  
  
  
  1.4       +9 -6      xml-axis/java/test/soap/TestHeaderAttrs.java
  
  Index: TestHeaderAttrs.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/soap/TestHeaderAttrs.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestHeaderAttrs.java	28 Jan 2002 18:23:03 -0000	1.3
  +++ TestHeaderAttrs.java	26 Mar 2002 16:40:35 -0000	1.4
  @@ -18,7 +18,7 @@
   import org.apache.axis.message.RPCElement;
   import org.apache.axis.message.RPCParam;
   import org.apache.axis.message.SOAPEnvelope;
  -import org.apache.axis.message.SOAPHeader;
  +import org.apache.axis.message.SOAPHeaderElement;
   import org.apache.axis.server.AxisServer;
   
   import org.xml.sax.SAXException;
  @@ -49,10 +49,12 @@
       
       static final String ACTOR = "http://some.actor/";
       
  -    static SOAPHeader goodHeader = new SOAPHeader(GOOD_HEADER_NS, 
  -                                                  GOOD_HEADER_NAME);
  -    static SOAPHeader badHeader = new SOAPHeader(BAD_HEADER_NS, 
  -                                                 BAD_HEADER_NAME);
  +    static SOAPHeaderElement goodHeader = 
  +                                       new SOAPHeaderElement(GOOD_HEADER_NS, 
  +                                                             GOOD_HEADER_NAME);
  +    static SOAPHeaderElement badHeader = 
  +                                       new SOAPHeaderElement(BAD_HEADER_NS, 
  +                                                             BAD_HEADER_NAME);
   
       private SimpleProvider provider = new SimpleProvider();
       private AxisServer engine = new AxisServer(provider);
  @@ -169,7 +171,8 @@
        * Call the service with a random string.  Returns true if the result
        * is the length of the string (doubled if the doubled arg is true).
        */ 
  -    public boolean runTest(SOAPHeader header, boolean doubled) throws Exception
  +    public boolean runTest(SOAPHeaderElement header,
  +                           boolean doubled) throws Exception
       {
           Call call = new Call(new Service());
           call.setTransport(localTransport);
  
  
  

Mime
View raw message