dims        2002/11/19 19:28:07

  Modified:    java/src/org/apache/axis/message SOAPHeaderElement.java
  Log:
  Fix for Bug 14341 - mustunderstand values patch for soap 1.2
  from [EMAIL PROTECTED] (Andras Avar)
  
  Revision  Changes    Path
  1.15      +21 -6     xml-axis/java/src/org/apache/axis/message/SOAPHeaderElement.java
  
  Index: SOAPHeaderElement.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPHeaderElement.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SOAPHeaderElement.java    15 Oct 2002 21:15:42 -0000      1.14
  +++ SOAPHeaderElement.java    20 Nov 2002 03:28:07 -0000      1.15
  @@ -67,7 +67,7 @@
   import javax.xml.soap.Name;
   import javax.xml.namespace.QName;
   
  -/** 
  +/**
    * A simple header element abstraction.  Extends MessageElement with
    * header-specific stuff like mustUnderstand, actor, and a 'processed' flag.
    *
  @@ -104,9 +104,16 @@
           // TLS (SOAPConstants.getCurrentVersion() ?)
           SOAPConstants soapConstants = SOAPConstants.SOAP11_CONSTANTS;
   
  +        if 
(getNamespaceURI().equals(SOAPConstants.SOAP12_CONSTANTS.getEnvelopeURI()))
  +            soapConstants = SOAPConstants.SOAP12_CONSTANTS;
  +
           String val = elem.getAttributeNS(soapConstants.getEnvelopeURI(),
                                            Constants.ATTR_MUST_UNDERSTAND);
  -        mustUnderstand = ((val != null) && val.equals("1")) ? true : false;
  +
  +        if (soapConstants == SOAPConstants.SOAP12_CONSTANTS)
  +            mustUnderstand = ((val != null) && val.equals("true")) ? true : false;
  +        else
  +            mustUnderstand = ((val != null) && val.equals("1")) ? true : false;
   
           QName roleQName = soapConstants.getRoleAttributeQName();
           actor = elem.getAttributeNS(roleQName.getNamespaceURI(),
  @@ -118,9 +125,9 @@
   
       public void setParentElement(SOAPElement parent) throws SOAPException {
           if(parent == null)
  -            throw new 
IllegalArgumentException(Messages.getMessage("nullParent00")); 
  +            throw new IllegalArgumentException(Messages.getMessage("nullParent00"));
           if(!(parent instanceof SOAPHeader))
  -            throw new 
IllegalArgumentException(Messages.getMessage("illegalArgumentException00")); 
  +            throw new 
IllegalArgumentException(Messages.getMessage("illegalArgumentException00"));
           try {
               super.setParentElement((SOAPHeader)parent);
           } catch (Throwable t) {
  @@ -144,7 +151,11 @@
           // Check for mustUnderstand
           String val = attributes.getValue(soapConstants.getEnvelopeURI(),
                                            Constants.ATTR_MUST_UNDERSTAND);
  -        mustUnderstand = ((val != null) && val.equals("1")) ? true : false;
  +
  +        if (soapConstants == SOAPConstants.SOAP12_CONSTANTS)
  +            mustUnderstand = ((val != null) && val.equals("true")) ? true : false;
  +        else
  +            mustUnderstand = ((val != null) && val.equals("1")) ? true : false;
   
           QName roleQName = soapConstants.getRoleAttributeQName();
           actor = attributes.getValue(roleQName.getNamespaceURI(),
  @@ -187,7 +198,11 @@
               setAttribute(roleQName.getNamespaceURI(),
                            roleQName.getLocalPart(), actor);
   
  -            String val = mustUnderstand ? "1" : "0";
  +            String val;
  +            if (context.getMessageContext().getSOAPConstants() == 
SOAPConstants.SOAP12_CONSTANTS)
  +                val = mustUnderstand ? "true" : "false";
  +            else
  +                val = mustUnderstand ? "1" : "0";
   
               setAttribute(soapVer.getEnvelopeURI(),
                            Constants.ATTR_MUST_UNDERSTAND,
  
  
  


Reply via email to