axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Andras.A...@nokia.com>
Subject mustunderstand values patch for soap 1.2
Date Wed, 06 Nov 2002 16:55:30 GMT
Hi,

Since the mustunderstand attribute values are changed in soap 1.2 here is a patch for it.
Plz let me know if this helps.

Br,
Andras

 <<SOAPHeaderElement.java>> 

And of course the diff:
--- 20021027/org/apache/axis/message/SOAPHeaderElement.java	Wed Oct 16 10:38:10 2002
+++ 1_0_soap12/org/apache/axis/message/SOAPHeaderElement.java	Wed Nov  6 15:40:48 2002
@@ -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.
  *
@@ -100,13 +100,18 @@
     {
         super(elem);
 
-        // FIXME : This needs to come from someplace reasonable, perhaps
-        // 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 +123,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 +149,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 +196,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,





Mime
View raw message