You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by co...@apache.org on 2009/05/08 15:18:32 UTC

svn commit: r772969 - in /webservices/wss4j/trunk/src/org/apache/ws/security: ./ action/ handler/ message/ message/token/ processor/ saml/ transform/ util/

Author: coheigea
Date: Fri May  8 13:18:30 2009
New Revision: 772969

URL: http://svn.apache.org/viewvc?rev=772969&view=rev
Log:
Some misc code cleanup

Modified:
    webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java
    webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.java
    webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecHeader.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSAMLToken.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSecurityContextToken.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/BinarySecurity.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/PKIPathSecurity.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Reference.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SignatureConfirmation.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java
    webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java
    webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java
    webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSecurityEngine.java Fri May  8 13:18:30 2009
@@ -131,9 +131,6 @@
     public static final QName SECURITY_CONTEXT_TOKEN_05_12 = 
         new QName(ConversationConstants.WSC_NS_05_12, ConversationConstants.SECURITY_CONTEXT_TOKEN_LN);
     
-    public WSSecurityEngine() {
-    }
-
     /**
      * Get a singleton instance of security engine.
      * <p/>
@@ -303,15 +300,13 @@
         wsDocInfo.setCrypto(sigCrypto);
 
         NodeList list = securityHeader.getChildNodes();
-        int len = list.getLength();
-        Node elem;
         if (tlog.isDebugEnabled()) {
             t1 = System.currentTimeMillis();
         }
         Vector returnResults = new Vector();
         final WSSConfig cfg = getWssConfig();
-        for (int i = 0; i < len; i++) {
-            elem = list.item(i);
+        for (int i = 0; i < list.getLength(); i++) {
+            Node elem = list.item(i);
             if (elem == null || elem.getNodeType() != Node.ELEMENT_NODE) {
                 continue;
             }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/action/UsernameTokenSignedAction.java Fri May  8 13:18:30 2009
@@ -22,6 +22,7 @@
 import java.util.List;
 import java.util.Vector;
 
+import org.apache.ws.security.SOAPConstants;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.WSEncryptionPart;
 import org.apache.ws.security.WSSecurityException;
@@ -46,8 +47,8 @@
 public class UsernameTokenSignedAction implements Action {
     public void execute(WSHandler handler, int actionToDo, Document doc, RequestData reqData)
             throws WSSecurityException {
-        String password;
-        password = handler.getPassword(reqData.getUsername(), actionToDo,
+        String password = 
+            handler.getPassword(reqData.getUsername(), actionToDo,
                 WSHandlerConstants.PW_CALLBACK_CLASS,
                 WSHandlerConstants.PW_CALLBACK_REF, reqData).getPassword();
 
@@ -96,10 +97,13 @@
         if (reqData.getSignatureParts().size() > 0) {
             parts = reqData.getSignatureParts();
         } else {
-            String soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
+            SOAPConstants soapConstants = reqData.getSoapConstants();
+            if (soapConstants == null) {
+                soapConstants = WSSecurityUtil.getSOAPConstants(doc.getDocumentElement());
+            }
             parts = new Vector();
             WSEncryptionPart encP = 
-                new WSEncryptionPart(WSConstants.ELEM_BODY, soapNamespace, "Content");
+                new WSEncryptionPart(WSConstants.ELEM_BODY, soapConstants.getEnvelopeURI(), "Content");
             parts.add(encP);
         }
         sign.addReferencesToSign(parts, reqData.getSecHeader());

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java Fri May  8 13:18:30 2009
@@ -184,7 +184,6 @@
          * action(s).
          */
         for (int i = 0; i < actions.size(); i++) {
-
             int actionToDo = ((Integer) actions.get(i)).intValue();
             if (doDebug) {
                 log.debug("Performing Action: " + actionToDo);

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java Fri May  8 13:18:30 2009
@@ -48,12 +48,6 @@
     protected WSSConfig wssConfig = WSSConfig.getDefaultWSConfig();
 
     /**
-     * Constructor.
-     */
-    public WSSecBase() {
-    }
-
-    /**
      * Set which parts of the message to encrypt/sign. <p/>
      * 
      * @param parts The list containing the WSEncryptionPart objects

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKEncrypt.java Fri May  8 13:18:30 2009
@@ -56,7 +56,7 @@
         // Setup the encrypted key
         //
         prepare(doc);
-        this.envelope =  doc.getDocumentElement();
+        envelope =  doc.getDocumentElement();
         //
         // prepend elements in the right order to the security header
         //
@@ -82,7 +82,7 @@
     private List doEncryption(Document doc, byte[] secretKey, List references) 
         throws WSSecurityException {
 
-        SecretKey key = WSSecurityUtil.prepareSecretKey(this.symEncAlgo, secretKey);
+        SecretKey key = WSSecurityUtil.prepareSecretKey(symEncAlgo, secretKey);
         XMLCipher xmlCipher = null;
         try {
             xmlCipher = XMLCipher.getInstance(symEncAlgo);
@@ -155,9 +155,9 @@
                 encData.setId(xencEncryptedDataId);
                 encData.setKeyInfo(keyInfo);
                 xmlCipher.doFinal(doc, body, content);
-            } catch (Exception e2) {
+            } catch (Exception ex) {
                 throw new WSSecurityException(
-                    WSSecurityException.FAILED_ENCRYPTION, null, null, e2
+                    WSSecurityException.FAILED_ENCRYPTION, null, null, ex
                 );
             }
             encDataRefs.add(new String("#" + xencEncryptedDataId));
@@ -229,7 +229,7 @@
                 doc.createElementNS(
                     WSConstants.ENC_NS, WSConstants.ENC_PREFIX + ":DataReference"
                 );
-            dataReference.setAttributeNS(null, "URI", dataReferenceUri);
+            dataReference.setAttribute("URI", dataReferenceUri);
             referenceList.appendChild(dataReference);
         }
         return referenceList;
@@ -244,8 +244,8 @@
      * @see org.apache.ws.security.message.WSSecDerivedKeyBase#getDerivedKeyLength()
      */
     protected int getDerivedKeyLength() throws WSSecurityException{
-        return (this.derivedKeyLength > 0) ? this.derivedKeyLength : 
-            WSSecurityUtil.getKeyLength(this.symEncAlgo);
+        return (derivedKeyLength > 0) ? derivedKeyLength : 
+            WSSecurityUtil.getKeyLength(symEncAlgo);
     }
     
 }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDKSign.java Fri May  8 13:18:30 2009
@@ -86,7 +86,7 @@
     public Document build(Document doc, WSSecHeader secHeader)
         throws WSSecurityException, ConversationException {
         
-        this.prepare(doc, secHeader);
+        prepare(doc, secHeader);
         String soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
         if (parts == null) {
             parts = new Vector();
@@ -100,12 +100,12 @@
         }
         
         addReferencesToSign(parts, secHeader);
-        this.computeSignature();
-        this.prependSigToHeader(secHeader);
+        computeSignature();
+        prependSigToHeader(secHeader);
         //
         // prepend elements in the right order to the security header
         //
-        this.prependDKElementToHeader(secHeader);
+        prependDKElementToHeader(secHeader);
 
         return doc;
     }
@@ -122,7 +122,7 @@
             Element canonElem = 
                 XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_CANONICALIZATIONMETHOD);
 
-            canonElem.setAttributeNS(null, Constants._ATT_ALGORITHM, canonAlgo);
+            canonElem.setAttribute(Constants._ATT_ALGORITHM, canonAlgo);
 
             if (wssConfig.isWsiBSPCompliant()) {
                 Set prefixes = getInclusivePrefixes(secHeader.getSecurityHeader(), false);
@@ -163,7 +163,7 @@
         secRef.setID(strUri);
         
         Reference refUt = new Reference(document);
-        refUt.setURI("#" + this.dktId);
+        refUt.setURI("#" + dktId);
         secRef.setReference(refUt);
         
         keyInfo.addUnknownElement(secRef.getElement());
@@ -338,13 +338,13 @@
                     }
                     sig.addDocument("#" + setWsuId(body), transforms);
                 }
-            } catch (TransformationException e1) {
+            } catch (TransformationException ex) {
                 throw new WSSecurityException(
-                    WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, e1
+                    WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, ex
                 );
-            } catch (XMLSignatureException e1) {
+            } catch (XMLSignatureException ex) {
                 throw new WSSecurityException(
-                    WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, e1
+                    WSSecurityException.FAILED_SIGNATURE, "noXMLSig", null, ex
                 );
             }
         }
@@ -357,18 +357,12 @@
                 WSConstants.WSSE_PREFIX + ":TransformationParameters"
             );
 
-        WSSecurityUtil.setNamespace(
-            transformParam, WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX
-        );
-
         Element canonElem = 
             doc.createElementNS(
                 WSConstants.SIG_NS, WSConstants.SIG_PREFIX + ":CanonicalizationMethod"
             );
 
-        WSSecurityUtil.setNamespace(canonElem, WSConstants.SIG_NS, WSConstants.SIG_PREFIX);
-
-        canonElem.setAttributeNS(null, "Algorithm", Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
+        canonElem.setAttribute("Algorithm", Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
         transformParam.appendChild(canonElem);
         return transformParam;
     }
@@ -399,7 +393,7 @@
      * @return the signature element
      */
     public Element getSignatureElement() {
-        return this.sig.getElement();
+        return sig.getElement();
     }
     
     /**
@@ -416,13 +410,13 @@
         try {
             sig.sign(sig.createSecretKey(derivedKeyBytes));
             signatureValue = sig.getSignatureValue();
-        } catch (XMLSignatureException e1) {
+        } catch (XMLSignatureException ex) {
             throw new WSSecurityException(
-                WSSecurityException.FAILED_SIGNATURE, null, null, e1
+                WSSecurityException.FAILED_SIGNATURE, null, null, ex
             );
-        } catch (Exception e1) {
+        } catch (Exception ex) {
             throw new WSSecurityException(
-                WSSecurityException.FAILED_SIGNATURE, null, null, e1
+                WSSecurityException.FAILED_SIGNATURE, null, null, ex
             );
         } finally {
             if (remove) {
@@ -435,13 +429,13 @@
      * @see org.apache.ws.security.message.WSSecDerivedKeyBase#getDerivedKeyLength()
      */
     protected int getDerivedKeyLength() throws WSSecurityException {
-        return (this.derivedKeyLength > 0) ? this.derivedKeyLength : 
-            WSSecurityUtil.getKeyLength(this.sigAlgo);
+        return (derivedKeyLength > 0) ? derivedKeyLength : 
+            WSSecurityUtil.getKeyLength(sigAlgo);
     }
     
     
     public void setSignatureAlgorithm(String algo) {
-        this.sigAlgo = algo;
+        sigAlgo = algo;
     }
 
     /**

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecDerivedKeyBase.java Fri May  8 13:18:30 2009
@@ -177,7 +177,7 @@
         // Create the derived keys
         // At this point figure out the key length according to the symencAlgo
         int offset = 0;
-        int length = this.getDerivedKeyLength();
+        int length = getDerivedKeyLength();
         byte[] label;
         try {
             label = (clientLabel + serviceLabel).getBytes("UTF-8");
@@ -193,10 +193,10 @@
         DerivationAlgorithm algo = 
             AlgoFactory.getInstance(ConversationConstants.DerivationAlgorithm.P_SHA_1);
         
-        this.derivedKeyBytes = algo.createKey(this.ephemeralKey, seed, offset, length);
+        derivedKeyBytes = algo.createKey(ephemeralKey, seed, offset, length);
         
         // Add the DKTs
-        dkt = new DerivedKeyToken(this.wscVersion, document);
+        dkt = new DerivedKeyToken(wscVersion, document);
         dktId = wssConfig.getIdAllocator().createId("derivedKeyId-", dkt);
         
         dkt.setOffset(offset);
@@ -204,18 +204,18 @@
         dkt.setNonce(Base64.encode(nonce));
         dkt.setID(dktId);
         
-        if (this.strElem == null) {
+        if (strElem == null) {
             //Create the SecurityTokenRef to the Encrypted Key
             SecurityTokenReference strEncKey = new SecurityTokenReference(document);
             Reference ref = new Reference(document);
-            ref.setURI("#" + this.tokenIdentifier);
-            if (this.customValueType != null && this.customValueType.trim().length() > 0) {
-                ref.setValueType(this.customValueType);
+            ref.setURI("#" + tokenIdentifier);
+            if (customValueType != null && customValueType.trim().length() > 0) {
+                ref.setValueType(customValueType);
             }
             strEncKey.setReference(ref);
             dkt.setSecurityTokenReference(strEncKey); 
         } else {
-            dkt.setSecurityTokenReference(this.strElem);
+            dkt.setSecurityTokenReference(strElem);
         }
     }
 
@@ -249,7 +249,7 @@
     }
     
     public Element getdktElement() {
-        return this.dkt.getElement();
+        return dkt.getElement();
     }
 
     public void setDerivedKeyLength(int keyLength) {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java Fri May  8 13:18:30 2009
@@ -97,19 +97,13 @@
     private boolean encKeyIdDirectId;
 
     /**
-     * Constructor.
-     */
-    public WSSecEncrypt() {
-    }
-
-    /**
      * Sets the key to use during embedded encryption.
      * 
      * @param key to use during encryption. The key must fit the selected
      *            symmetrical encryption algorithm
      */
     public void setKey(byte[] key) {
-        this.embeddedKey = key;
+        embeddedKey = key;
     }
 
     /**
@@ -424,8 +418,8 @@
             keyInfo = new KeyInfo(document);
             SecurityTokenReference secToken = new SecurityTokenReference(document);
             secToken.addWSSENamespace();
-            if (this.customReferenceValue != null) {
-                secToken.setKeyIdentifierEncKeySHA1(this.customReferenceValue);
+            if (customReferenceValue != null) {
+                secToken.setKeyIdentifierEncKeySHA1(customReferenceValue);
             } else {
                 secToken.setKeyIdentifierEncKeySHA1(getSHA1(encryptedEphemeralKey));
             }
@@ -563,9 +557,9 @@
                 xmlCipher.doFinal(doc, body, content);
                 
                 keyInfo = new KeyInfo((Element) keyInfo.getElement().cloneNode(true), null);
-            } catch (Exception e2) {
+            } catch (Exception ex) {
                 throw new WSSecurityException(
-                    WSSecurityException.FAILED_ENCRYPTION, null, null, e2
+                    WSSecurityException.FAILED_ENCRYPTION, null, null, ex
                 );
             }
             encDataRef.add(new String("#" + xencEncryptedDataId));
@@ -705,7 +699,7 @@
                 doc.createElementNS(
                     WSConstants.ENC_NS, WSConstants.ENC_PREFIX + ":DataReference"
                 );
-            dataReference.setAttributeNS(null, "URI", dataReferenceUri);
+            dataReference.setAttribute("URI", dataReferenceUri);
             referenceList.appendChild(dataReference);
         }
         return referenceList;

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java Fri May  8 13:18:30 2009
@@ -149,8 +149,8 @@
         //
         // Set up the ephemeral key
         //
-        if (this.ephemeralKey == null) {
-            this.ephemeralKey = generateEphemeralKey();
+        if (ephemeralKey == null) {
+            ephemeralKey = generateEphemeralKey();
         }
 
         //
@@ -217,22 +217,22 @@
         }
         
         try {
-            this.encryptedEphemeralKey = cipher.doFinal(keyBytes);
-        } catch (IllegalStateException e1) {
+            encryptedEphemeralKey = cipher.doFinal(keyBytes);
+        } catch (IllegalStateException ex) {
             throw new WSSecurityException(
-                WSSecurityException.FAILED_ENCRYPTION, null, null, e1
+                WSSecurityException.FAILED_ENCRYPTION, null, null, ex
             );
-        } catch (IllegalBlockSizeException e1) {
+        } catch (IllegalBlockSizeException ex) {
             throw new WSSecurityException(
-                WSSecurityException.FAILED_ENCRYPTION, null, null, e1
+                WSSecurityException.FAILED_ENCRYPTION, null, null, ex
             );
-        } catch (BadPaddingException e1) {
+        } catch (BadPaddingException ex) {
             throw new WSSecurityException(
-                WSSecurityException.FAILED_ENCRYPTION, null, null, e1
+                WSSecurityException.FAILED_ENCRYPTION, null, null, ex
             );
         }
         Text keyText = 
-            WSSecurityUtil.createBase64EncodedTextNode(document, this.encryptedEphemeralKey);
+            WSSecurityUtil.createBase64EncodedTextNode(document, encryptedEphemeralKey);
 
         //
         // Now we need to setup the EncryptedKey header block 1) create a
@@ -246,7 +246,7 @@
         if(encKeyId == null || "".equals(encKeyId)) {
             encKeyId = "EncKeyId-" + UUIDGenerator.getUUID();
         }
-        encryptedKeyElement.setAttributeNS(null, "Id", encKeyId);
+        encryptedKeyElement.setAttribute("Id", encKeyId);
 
         KeyInfo keyInfo = new KeyInfo(document);
 
@@ -337,7 +337,7 @@
         WSSecurityUtil.setNamespace(encryptedKey, WSConstants.ENC_NS, WSConstants.ENC_PREFIX);
         Element encryptionMethod = 
             doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + ":EncryptionMethod");
-        encryptionMethod.setAttributeNS(null, "Algorithm", keyTransportAlgo);
+        encryptionMethod.setAttribute("Algorithm", keyTransportAlgo);
         encryptedKey.appendChild(encryptionMethod);
         return encryptedKey;
     }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecHeader.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecHeader.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecHeader.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecHeader.java Fri May  8 13:18:30 2009
@@ -109,12 +109,9 @@
                 WSSecurityUtil.findWsseSecurityHeaderBlock(
                     doc, doc.getDocumentElement(), actor, false
                 );
-            if (securityHeader == null) {
-                return true;
-            }
         }
         
-        if (securityHeader.getChildNodes().getLength() == 0) {
+        if (securityHeader == null || securityHeader.getChildNodes().getLength() == 0) {
             return true;
         }
         return false;
@@ -181,13 +178,12 @@
                 WSSecurityUtil.findWsseSecurityHeaderBlock(
                     doc, doc.getDocumentElement(), actor, false
                 );
-            if (securityHeader == null) {
-                return;
-            }
         }
         
-        Node parent = securityHeader.getParentNode();
-        parent.removeChild(securityHeader);
+        if (securityHeader != null) {
+            Node parent = securityHeader.getParentNode();
+            parent.removeChild(securityHeader);
+        }
     }
     
 }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSAMLToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSAMLToken.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSAMLToken.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSAMLToken.java Fri May  8 13:18:30 2009
@@ -42,12 +42,6 @@
     private SAMLAssertion saml = null;
 
     /**
-     * Constructor.
-     */
-    public WSSecSAMLToken() {
-    }
-
-    /**
      * Creates a SAML token.
      * 
      * The method prepares and initializes a WSSec UsernameToken structure after
@@ -76,14 +70,12 @@
      *            The security header that holds the Signature element.
      */
     public void prependToHeader(WSSecHeader secHeader) {
-        Element element = null;        
         try {
-            element = (Element) saml.toDOM(document);
+            Element element = (Element) saml.toDOM(document);
+            WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), element);
         } catch (SAMLException ex) {
             throw new RuntimeException(ex.toString(), ex);
         }
-        
-        WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), element);
     }
     
     /**

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSecurityContextToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSecurityContextToken.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSecurityContextToken.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSecurityContextToken.java Fri May  8 13:18:30 2009
@@ -63,17 +63,17 @@
         throws WSSecurityException, ConversationException  {
 
         if (sct == null) {
-            if (this.identifier != null) {
-                this.sct = new SecurityContextToken(this.wscVersion, doc, this.identifier);
+            if (identifier != null) {
+                sct = new SecurityContextToken(wscVersion, doc, identifier);
             } else {
-                this.sct = new SecurityContextToken(this.wscVersion, doc);
-                this.identifier = this.sct.getIdentifier();
+                sct = new SecurityContextToken(wscVersion, doc);
+                identifier = sct.getIdentifier();
             }
         }
 
         // The wsu:Id of the wsc:SecurityContextToken
-        if (this.sctId != null) {
-            this.sct.setID(this.sctId);
+        if (sctId != null) {
+            sct.setID(sctId);
         }
     }
 
@@ -107,7 +107,7 @@
      * @param ephemeralKey The ephemeralKey to set.
      */
     protected void setSecret(byte[] ephemeralKey) {
-        this.secret = ephemeralKey;
+        secret = ephemeralKey;
     }
 
     /**
@@ -128,10 +128,10 @@
      * @return Returns the sctId.
      */
     public String getSctId() {
-        if (this.sct != null) {
-            return this.sct.getID();
+        if (sct != null) {
+            return sct.getID();
         }
-        return this.sctId;
+        return sctId;
     }
 
     /**

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignature.java Fri May  8 13:18:30 2009
@@ -123,11 +123,6 @@
     private String digestAlgo = "http://www.w3.org/2000/09/xmldsig#sha1";
     
     private X509Certificate useThisCert = null;
-    /**
-     * Constructor.
-     */
-    public WSSecSignature() {
-    }
 
     /**
      * set the single cert flag.
@@ -337,7 +332,7 @@
         if (canonAlgo.equals(WSConstants.C14N_EXCL_OMIT_COMMENTS)) {
             Element canonElem = 
                 XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_CANONICALIZATIONMETHOD);
-            canonElem.setAttributeNS(null, Constants._ATT_ALGORITHM, canonAlgo);
+            canonElem.setAttribute(Constants._ATT_ALGORITHM, canonAlgo);
 
             if (wssConfig.isWsiBSPCompliant()) {
                 Set prefixes = getInclusivePrefixes(secHeader.getSecurityHeader(), false);
@@ -698,13 +693,13 @@
                 sig.sign(crypto.getPrivateKey(user, password));
             }
             signatureValue = sig.getSignatureValue();
-        } catch (XMLSignatureException e1) {
+        } catch (XMLSignatureException ex) {
             throw new WSSecurityException(
-                WSSecurityException.FAILED_SIGNATURE, null, null, e1
+                WSSecurityException.FAILED_SIGNATURE, null, null, ex
             );
-        } catch (Exception e1) {
+        } catch (Exception ex) {
             throw new WSSecurityException(
-                WSSecurityException.FAILED_SIGNATURE, null, null, e1
+                WSSecurityException.FAILED_SIGNATURE, null, null, ex
             );
         } finally {
             if (remove) {
@@ -779,7 +774,7 @@
                 WSConstants.SIG_PREFIX + ":CanonicalizationMethod"
             );
 
-        canonElem.setAttributeNS(null, "Algorithm", Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
+        canonElem.setAttribute("Algorithm", Canonicalizer.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
         transformParam.appendChild(canonElem);
         return transformParam;
     }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java Fri May  8 13:18:30 2009
@@ -40,12 +40,6 @@
     byte[] signatureValue = null;
 
     /**
-     * Constructor.
-     */
-    public WSSecSignatureConfirmation() {
-    }
-
-    /**
      * Set the Signature value to store in this SignatureConfirmation.
      * 
      * @param signatureValue The Signature value to store in the SignatureConfirmation element
@@ -127,6 +121,7 @@
      * was not called before.
      */
     public Element getSignatureConfirmationElement() {
-        return (this.sc != null) ? this.sc.getElement() : null;
+        return (sc != null) ? sc.getElement() : null;
     }
+    
 }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/BinarySecurity.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/BinarySecurity.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/BinarySecurity.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/BinarySecurity.java Fri May  8 13:18:30 2009
@@ -102,7 +102,7 @@
      * efficiency purposes.
      */
     public void addWSSENamespace() {
-        WSSecurityUtil.setNamespace(this.element, WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX);
+        WSSecurityUtil.setNamespace(element, WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX);
     }
     
     /**
@@ -116,7 +116,7 @@
     /**
      * get the value type.
      * 
-     * @return TODO
+     * @return the value type
      */
     public String getValueType() {
         return element.getAttribute("ValueType");
@@ -128,7 +128,7 @@
      * @param type 
      */
     public void setValueType(String type) {
-        element.setAttributeNS(null, "ValueType", type);
+        element.setAttribute("ValueType", type);
     }
 
     /**
@@ -146,7 +146,7 @@
      * @param encoding 
      */
     public void setEncodingType(String encoding) {
-        element.setAttributeNS(null, "EncodingType", encoding);
+        element.setAttribute("EncodingType", encoding);
     }
 
     /**
@@ -201,7 +201,7 @@
     /**
      * get the id.
      * 
-     * @return TODO
+     * @return the WSU ID of this element
      */
     public String getID() {
         return element.getAttributeNS(WSConstants.WSU_NS, "Id");
@@ -219,7 +219,7 @@
     /**
      * return the string representation of the token.
      * 
-     * @return TODO
+     * @return the string representation of the token.
      */
     public String toString() {
         return DOM2Writer.nodeToString((Node)element);

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/DerivedKeyToken.java Fri May  8 13:18:30 2009
@@ -102,8 +102,7 @@
     public DerivedKeyToken(Element elem) throws WSSecurityException {
         log.debug("DerivedKeyToken: created : element constructor");
         element = elem;
-        QName el = 
-            new QName(element.getNamespaceURI(), element.getLocalName());
+        QName el = new QName(element.getNamespaceURI(), element.getLocalName());
         
         if (!(el.equals(ConversationConstants.DERIVED_KEY_TOKEN_QNAME_05_02) ||
             el.equals(ConversationConstants.DERIVED_KEY_TOKEN_QNAME_05_12))) {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/PKIPathSecurity.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/PKIPathSecurity.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/PKIPathSecurity.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/PKIPathSecurity.java Fri May  8 13:18:30 2009
@@ -40,10 +40,9 @@
      *
      * @throws WSSecurityException
      */
-    public PKIPathSecurity(Element elem)
-        throws WSSecurityException {
+    public PKIPathSecurity(Element elem) throws WSSecurityException {
         super(elem);
-        if (!getValueType().equals(getType())) {
+        if (!getValueType().equals(type)) {
             throw new WSSecurityException(
                 WSSecurityException.INVALID_SECURITY_TOKEN,
                 "invalidValueType",
@@ -57,7 +56,7 @@
      */
     public PKIPathSecurity(Document doc) {
         super(doc);
-        setValueType(getType());
+        setValueType(type);
     }
 
     /**

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Reference.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Reference.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Reference.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Reference.java Fri May  8 13:18:30 2009
@@ -35,8 +35,7 @@
  * @author Davanum Srinivas (dims@yahoo.com).
  */
 public class Reference {
-    public static final QName TOKEN =
-        new QName(WSConstants.WSSE_NS, "Reference");
+    public static final QName TOKEN = new QName(WSConstants.WSSE_NS, "Reference");
     protected Element element = null;
 
     /**
@@ -49,9 +48,8 @@
         if (elem == null) {
             throw new WSSecurityException(WSSecurityException.INVALID_SECURITY, "noReference");
         }
-        this.element = elem;
-        QName el =
-            new QName(this.element.getNamespaceURI(), this.element.getLocalName());
+        element = elem;
+        QName el = new QName(element.getNamespaceURI(), element.getLocalName());
         if (!el.equals(TOKEN)) {
             throw new WSSecurityException(
                 WSSecurityException.FAILURE, "badElement", new Object[] {TOKEN, el}
@@ -65,7 +63,7 @@
      * @param doc 
      */
     public Reference(Document doc) {
-        this.element = doc.createElementNS(WSConstants.WSSE_NS, "wsse:Reference");
+        element = doc.createElementNS(WSConstants.WSSE_NS, "wsse:Reference");
     }
     
     /**
@@ -82,7 +80,7 @@
      * @return TODO
      */
     public Element getElement() {
-        return this.element;
+        return element;
     }
 
     /**
@@ -91,7 +89,7 @@
      * @return TODO
      */
     public String getValueType() {
-        return this.element.getAttributeNS(null, "ValueType");
+        return element.getAttribute("ValueType");
     }
 
     /**
@@ -100,7 +98,7 @@
      * @return TODO
      */
     public String getURI() {
-        return this.element.getAttributeNS(null, "URI");
+        return element.getAttribute("URI");
     }
 
     /**
@@ -109,7 +107,7 @@
      * @param valueType
      */
     public void setValueType(String valueType) {
-        this.element.setAttributeNS(null, "ValueType", valueType);
+        element.setAttribute("ValueType", valueType);
     }
 
     /**
@@ -118,7 +116,7 @@
      * @param uri 
      */
     public void setURI(String uri) {
-        this.element.setAttributeNS(null, "URI", uri);
+        element.setAttribute("URI", uri);
     }
 
     /**
@@ -127,6 +125,6 @@
      * @return TODO
      */
     public String toString() {
-        return DOM2Writer.nodeToString((Node) this.element);
+        return DOM2Writer.nodeToString((Node)element);
     }
 }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityContextToken.java Fri May  8 13:18:30 2009
@@ -158,7 +158,7 @@
      * Set the identifier.
      */
     public void setIdentifier(String uuid) {
-        Text node = getFirstNode(this.elementIdentifier);
+        Text node = getFirstNode(elementIdentifier);
         node.setData(uuid);
     }
 

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SecurityTokenReference.java Fri May  8 13:18:30 2009
@@ -33,8 +33,14 @@
 import org.apache.xml.security.keys.content.X509Data;
 import org.apache.ws.security.util.Base64;
 import org.apache.xml.security.utils.Constants;
-import org.w3c.dom.*;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+import javax.xml.namespace.QName;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 
@@ -49,9 +55,9 @@
  * @author Davanum Srinivas (dims@yahoo.com).
  */
 public class SecurityTokenReference {
-    private static Log log =
-            LogFactory.getLog(SecurityTokenReference.class.getName());
     public static final String SECURITY_TOKEN_REFERENCE = "SecurityTokenReference";
+    public static final QName STR_QNAME = 
+        new QName(WSConstants.WSSE_NS, SECURITY_TOKEN_REFERENCE);
     public static final String KEY_NAME = "KeyName";
     public static final String SKI_URI = 
         WSConstants.X509TOKEN_NS + "#X509SubjectKeyIdentifier";
@@ -61,6 +67,8 @@
         WSConstants.SAMLTOKEN_NS + "#" + WSConstants.SAML_ASSERTION_ID;
     public static final String ENC_KEY_SHA1_URI = 
         WSConstants.SOAPMESSAGE_NS11 + "#" + WSConstants.ENC_KEY_SHA1_URI;
+    private static Log log =
+        LogFactory.getLog(SecurityTokenReference.class.getName());
     protected Element element = null;
     private XMLX509IssuerSerial issuerSerial = null;
     private byte[] skiBytes = null;
@@ -74,14 +82,9 @@
      */
     public SecurityTokenReference(Element elem) throws WSSecurityException {
         doDebug = log.isDebugEnabled();
-        this.element = elem;
-        boolean goodElement = false;
-        if (SECURITY_TOKEN_REFERENCE.equals(element.getLocalName())) {
-            goodElement = WSConstants.WSSE_NS.equals(element.getNamespaceURI());
-//        } else if (KEY_NAME.equals(element.getLocalName())) {
-//            goodElement = WSConstants.SIG_NS.equals(element.getNamespaceURI());
-        }
-        if (!goodElement) {
+        element = elem;
+        QName el = new QName(element.getNamespaceURI(), element.getLocalName());
+        if (!STR_QNAME.equals(el)) {
             throw new WSSecurityException(WSSecurityException.FAILURE, "badElement", null);
         }
     }
@@ -93,7 +96,7 @@
      */
     public SecurityTokenReference(Document doc) {
         doDebug = log.isDebugEnabled();
-        this.element = doc.createElementNS(WSConstants.WSSE_NS, "wsse:SecurityTokenReference");
+        element = doc.createElementNS(WSConstants.WSSE_NS, "wsse:SecurityTokenReference");
     }
     
     /**
@@ -101,7 +104,7 @@
      * efficiency purposes.
      */
     public void addWSSENamespace() {
-        WSSecurityUtil.setNamespace(this.element, WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX);
+        WSSecurityUtil.setNamespace(element, WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX);
     }
     
     /**
@@ -120,9 +123,9 @@
     public void setReference(Reference ref) {
         Element elem = getFirstElement();
         if (elem != null) {
-            this.element.replaceChild(ref.getElement(), elem);
+            element.replaceChild(ref.getElement(), elem);
         } else {
-            this.element.appendChild(ref.getElement());
+            element.appendChild(ref.getElement());
         }
     }
 
@@ -251,13 +254,13 @@
                 }
             }
             if (tokElement == null) {
-                Node assertion = 
+                Element assertion = 
                     WSSecurityUtil.findSAMLAssertionElementById(
                         doc.getDocumentElement(),
                         id
                     );
                 if (assertion != null) {
-                    tokElement = (Element)assertion;
+                    tokElement = assertion;
                 }
             }
         }
@@ -307,7 +310,7 @@
      */
     public void setKeyIdentifier(X509Certificate cert)
         throws WSSecurityException {
-        Document doc = this.element.getOwnerDocument();
+        Document doc = element.getOwnerDocument();
         byte data[] = null;
         try {
             data = cert.getEncoded();
@@ -343,10 +346,10 @@
             );
         }
         
-        Document doc = this.element.getOwnerDocument();
+        Document doc = element.getOwnerDocument();
         byte data[] = crypto.getSKIBytesFromCert(cert);
         
-        org.w3c.dom.Text text = doc.createTextNode(Base64.encode(data));
+        Text text = doc.createTextNode(Base64.encode(data));
         createKeyIdentifier(doc, SKI_URI, text, true);        
     }
 
@@ -361,7 +364,7 @@
      * @param cert is the X509 certificate to get the thumbprint
      */
     public void setKeyIdentifierThumb(X509Certificate cert) throws WSSecurityException {
-        Document doc = this.element.getOwnerDocument();
+        Document doc = element.getOwnerDocument();
         MessageDigest sha = null;
         try {
             sha = WSSecurityUtil.resolveMessageDigest();
@@ -386,33 +389,33 @@
     
 
     public void setKeyIdentifierEncKeySHA1(String value) throws WSSecurityException {
-        Document doc = this.element.getOwnerDocument();
+        Document doc = element.getOwnerDocument();
         org.w3c.dom.Text text = doc.createTextNode(value);
         createKeyIdentifier(doc, ENC_KEY_SHA1_URI, text, true);
     }
     
     public void setSAMLKeyIdentifier(String keyIdVal) throws WSSecurityException {
-        Document doc = this.element.getOwnerDocument();
+        Document doc = element.getOwnerDocument();
         createKeyIdentifier(doc, SAML_ID_URI, doc.createTextNode(keyIdVal), false);
     }
     public void setKeyIdentifier(String valueType, String keyIdVal) throws WSSecurityException {
-        Document doc = this.element.getOwnerDocument();
+        Document doc = element.getOwnerDocument();
         createKeyIdentifier(doc, valueType, doc.createTextNode(keyIdVal), false);
     }
 
     private void createKeyIdentifier(Document doc, String uri, Node node, boolean base64) {
         Element keyId = doc.createElementNS(WSConstants.WSSE_NS, "wsse:KeyIdentifier");
-        keyId.setAttributeNS(null, "ValueType", uri);
+        keyId.setAttribute("ValueType", uri);
         if (base64) {
-            keyId.setAttributeNS(null, "EncodingType", BinarySecurity.BASE64_ENCODING);
+            keyId.setAttribute("EncodingType", BinarySecurity.BASE64_ENCODING);
         }
 
         keyId.appendChild(node);
         Element elem = getFirstElement();
         if (elem != null) {
-            this.element.replaceChild(keyId, elem);
+            element.replaceChild(keyId, elem);
         } else {
-            this.element.appendChild(keyId);
+            element.appendChild(keyId);
         }
     }
 
@@ -449,9 +452,7 @@
             X509Security token = new X509Security(elem);
             if (token != null) {
                 X509Certificate cert = token.getX509Certificate(crypto);
-                X509Certificate[] certs = new X509Certificate[1];
-                certs[0] = cert;
-                return certs;
+                return new X509Certificate[]{cert};
             }
         } else if (SKI_URI.equals(value)) {
             alias = getX509SKIAlias(crypto);
@@ -536,9 +537,9 @@
     public void setX509IssuerSerial(X509Data ref) {
         Element elem = getFirstElement();
         if (elem != null) {
-            this.element.replaceChild(ref.getElement(), elem);
+            element.replaceChild(ref.getElement(), elem);
         } else {
-            this.element.appendChild(ref.getElement());
+            element.appendChild(ref.getElement());
         }
     }
 
@@ -614,7 +615,7 @@
      *         a <code>wsse:Reference</code> element
      */
     public boolean containsReference() {
-        return this.lengthReference() > 0;
+        return lengthReference() > 0;
     }
 
     /**
@@ -624,7 +625,7 @@
      *         the <code>SecurtityTokenReference</code>
      */
     public int lengthReference() {
-        return this.length(WSConstants.WSSE_NS, "Reference");
+        return length(WSConstants.WSSE_NS, "Reference");
     }
 
     /**
@@ -634,7 +635,7 @@
      *         a <code>ds:IssuerSerial</code> element
      */
     public boolean containsX509IssuerSerial() {
-        return this.lengthX509IssuerSerial() > 0;
+        return lengthX509IssuerSerial() > 0;
     }
 
     /**
@@ -644,7 +645,7 @@
      *         a <code>ds:X509Data</code> element
      */
     public boolean containsX509Data() {
-        return this.lengthX509Data() > 0;
+        return lengthX509Data() > 0;
     }
     
     /**
@@ -654,7 +655,7 @@
      *         the <code>SecurtityTokenReference</code>
      */
     public int lengthX509IssuerSerial() {
-        return this.length(WSConstants.SIG_NS, Constants._TAG_X509ISSUERSERIAL);
+        return length(WSConstants.SIG_NS, Constants._TAG_X509ISSUERSERIAL);
     }
 
     /**
@@ -664,7 +665,7 @@
      *         the <code>SecurtityTokenReference</code>
      */
     public int lengthX509Data() {
-        return this.length(WSConstants.SIG_NS, Constants._TAG_X509DATA);
+        return length(WSConstants.SIG_NS, Constants._TAG_X509DATA);
     }
     
     /**
@@ -674,7 +675,7 @@
      *         a <code>wsse:KeyIdentifier</code> element
      */
     public boolean containsKeyIdentifier() {
-        return this.lengthKeyIdentifier() > 0;
+        return lengthKeyIdentifier() > 0;
     }
 
     /**
@@ -684,7 +685,7 @@
      *         the <code>SecurtityTokenReference</code>
      */
     public int lengthKeyIdentifier() {
-        return this.length(WSConstants.WSSE_NS, "KeyIdentifier");
+        return length(WSConstants.WSSE_NS, "KeyIdentifier");
     }
 
     /**
@@ -695,7 +696,7 @@
      * @return number of elements with matching localname and namespace
      */
     public int length(String namespace, String localname) {
-        NodeList childNodes = this.element.getChildNodes();
+        NodeList childNodes = element.getChildNodes();
         int result = 0;
         for (int i = 0; i < childNodes.getLength(); i++) {
             Node n = childNodes.item(i);
@@ -719,7 +720,7 @@
      * @return TODO
      */
     public Element getElement() {
-        return this.element;
+        return element;
     }
 
     /**
@@ -728,7 +729,7 @@
      * @param id
      */
     public void setID(String id) {
-        this.element.setAttributeNS(WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":Id", id);
+        element.setAttributeNS(WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":Id", id);
     }
 
     /**
@@ -737,6 +738,6 @@
      * @return TODO
      */
     public String toString() {
-        return DOM2Writer.nodeToString((Node) this.element);
+        return DOM2Writer.nodeToString((Node) element);
     }
 }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SignatureConfirmation.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SignatureConfirmation.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SignatureConfirmation.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/SignatureConfirmation.java Fri May  8 13:18:30 2009
@@ -50,7 +50,7 @@
      */
     public SignatureConfirmation(Element elem) throws WSSecurityException {
         element = elem;
-        String sv = element.getAttributeNS(null, VALUE);
+        String sv = element.getAttribute(VALUE);
         if (sv != null) {
             signatureValue = Base64.decode(sv);
         }
@@ -91,7 +91,7 @@
      * @return the <code>wsse:UsernameToken</code> element
      */
     public Element getElement() {
-        return this.element;
+        return element;
     }
 
     /**
@@ -100,7 +100,7 @@
      * @return a XML string representation
      */
     public String toString() {
-        return DOM2Writer.nodeToString((Node) this.element);
+        return DOM2Writer.nodeToString((Node)element);
     }
     
     /**
@@ -108,15 +108,15 @@
      * @param id
      */
     public void setID(String id) {
-        this.element.setAttributeNS(WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":Id", id);
+        element.setAttributeNS(WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":Id", id);
     }
     
     /**
      * Returns the value of the wsu:Id attribute
-     * @return TODO
+     * @return the WSU ID
      */
     public String getID() {
-        return this.element.getAttributeNS(WSConstants.WSU_NS, "Id");
+        return element.getAttributeNS(WSConstants.WSU_NS, "Id");
     }
 
     /**

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java Fri May  8 13:18:30 2009
@@ -59,12 +59,12 @@
      * Constructs a <code>Timestamp</code> object and parses the
      * <code>wsu:Timestamp</code> element to initialize it.
      *
-     * @param element the <code>wsu:Timestamp</code> element that
-     *                contains the timestamp data
+     * @param timestampElement the <code>wsu:Timestamp</code> element that
+     *        contains the timestamp data
      */
-    public Timestamp(Element element) throws WSSecurityException {
+    public Timestamp(Element timestampElement) throws WSSecurityException {
 
-        this.element = element;
+        element = timestampElement;
         customElements = new Vector();
 
         String strCreated = null;

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java Fri May  8 13:18:30 2009
@@ -153,8 +153,7 @@
             && elementPassword.hasAttribute(WSConstants.PASSWORD_TYPE_ATTR)) {
             passwordType = elementPassword.getAttribute(WSConstants.PASSWORD_TYPE_ATTR);
         }
-        if (passwordType != null
-            && passwordType.equals(WSConstants.PASSWORD_DIGEST)) {
+        if (WSConstants.PASSWORD_DIGEST.equals(passwordType)) {
             hashed = true;
             if (elementNonce == null || elementCreated == null) {
                 throw new WSSecurityException(
@@ -218,7 +217,7 @@
      * efficiency purposes.
      */
     public void addWSSENamespace() {
-        WSSecurityUtil.setNamespace(this.element, WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX);
+        WSSecurityUtil.setNamespace(element, WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX);
     }
     
     /**
@@ -226,7 +225,7 @@
      * efficiency purposes.
      */
     public void addWSUNamespace() {
-        WSSecurityUtil.setNamespace(this.element, WSConstants.WSU_NS, WSConstants.WSU_PREFIX);
+        WSSecurityUtil.setNamespace(element, WSConstants.WSU_NS, WSConstants.WSU_PREFIX);
     }
 
     /**
@@ -240,7 +239,7 @@
         random.nextBytes(nonceValue);
         elementNonce = doc.createElementNS(WSConstants.WSSE_NS, "wsse:" + WSConstants.NONCE_LN);
         elementNonce.appendChild(doc.createTextNode(Base64.encode(nonceValue)));
-        elementNonce.setAttributeNS(null, "EncodingType", BASE64_ENCODING);
+        elementNonce.setAttribute("EncodingType", BASE64_ENCODING);
         element.appendChild(elementNonce);
     }
 

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java Fri May  8 13:18:30 2009
@@ -73,19 +73,19 @@
         
         // Deserialize the DKT
         DerivedKeyToken dkt = new DerivedKeyToken(elem);
-        this.extractSecret(wsDocInfo, dkt, cb, crypto);
+        extractSecret(wsDocInfo, dkt, cb, crypto);
         
         String tempNonce = dkt.getNonce();
         if (tempNonce == null) {
             throw new WSSecurityException("Missing wsc:Nonce value");
         }
-        this.nonce = Base64.decode(tempNonce);
-        this.length = dkt.getLength();
-        this.label = dkt.getLabel();
-        this.algorithm = dkt.getAlgorithm();
-        this.id = dkt.getID();
+        nonce = Base64.decode(tempNonce);
+        length = dkt.getLength();
+        label = dkt.getLabel();
+        algorithm = dkt.getAlgorithm();
+        id = dkt.getID();
         if (length > 0) {
-            this.deriveKey();
+            deriveKey();
             returnResults.add(
                 0, 
                 new WSSecurityEngineResult(
@@ -104,14 +104,14 @@
                     (ConversationConstants.DEFAULT_LABEL 
                         + ConversationConstants.DEFAULT_LABEL).getBytes("UTF-8");
             } else {
-                labelBytes = this.label.getBytes("UTF-8");
+                labelBytes = label.getBytes("UTF-8");
             }
             
             byte[] seed = new byte[labelBytes.length + nonce.length];
             System.arraycopy(labelBytes, 0, seed, 0, labelBytes.length);
             System.arraycopy(nonce, 0, seed, labelBytes.length, nonce.length);
             
-            this.keyBytes = algo.createKey(this.secret, seed, offset, length);
+            keyBytes = algo.createKey(secret, seed, offset, length);
             
         } catch (Exception e) {
             throw new WSSecurityException(
@@ -155,23 +155,23 @@
             
             if (processor == null && uri != null) {
                 // Now use the callback and get it
-                this.secret = this.getSecret(cb, uri);
+                secret = getSecret(cb, uri);
             } else if (processor == null && keyIdentifierValue != null
                 && keyIdentifierValueType != null) {                
-                this.secret = this.getSecret(cb, keyIdentifierValue, keyIdentifierValueType); 
+                secret = getSecret(cb, keyIdentifierValue, keyIdentifierValueType); 
             } else if (processor instanceof UsernameTokenProcessor) {
-                this.secret = ((UsernameTokenProcessor) processor).getDerivedKey(cb);
+                secret = ((UsernameTokenProcessor) processor).getDerivedKey(cb);
             } else if (processor instanceof EncryptedKeyProcessor) {
-                this.secret = ((EncryptedKeyProcessor) processor).getDecryptedBytes();
+                secret = ((EncryptedKeyProcessor) processor).getDecryptedBytes();
             } else if (processor instanceof SecurityContextTokenProcessor) {
-                this.secret = ((SecurityContextTokenProcessor) processor).getSecret();
+                secret = ((SecurityContextTokenProcessor) processor).getSecret();
             } else if (processor instanceof SAMLTokenProcessor) {
                 SAMLTokenProcessor samlp = (SAMLTokenProcessor) processor;
                 SAMLKeyInfo keyInfo = 
                     SAMLUtil.getSAMLKeyInfo(samlp.getSamlTokenElement(), crypto, cb);
                 // TODO Handle malformed SAML tokens where they don't have the 
                 // secret in them
-                this.secret = keyInfo.getSecret();
+                secret = keyInfo.getSecret();
             } else {
                 throw new WSSecurityException(
                     WSSecurityException.FAILED_CHECK, "unsupportedKeyId"
@@ -251,7 +251,7 @@
      * @see org.apache.ws.security.processor.Processor#getId()
      */
     public String getId() {
-        return this.id;
+        return id;
     }
 
     /**
@@ -266,8 +266,8 @@
      * @return Returns the keyBytes.
      */
     public byte[] getKeyBytes(int len) throws WSSecurityException {
-        this.length = len;
-        this.deriveKey();
+        length = len;
+        deriveKey();
         return keyBytes;
     } 
 

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/EncryptedKeyProcessor.java Fri May  8 13:18:30 2009
@@ -90,14 +90,14 @@
             throw new WSSecurityException(WSSecurityException.FAILURE, "noCallback");
         }
         List dataRefUris = handleEncryptedKey(elem, cb, decCrypto, null);
-        encryptedKeyId = elem.getAttributeNS(null, "Id");
+        encryptedKeyId = elem.getAttribute("Id");
         returnResults.add(
             0, 
             new WSSecurityEngineResult(
                 WSConstants.ENCR, 
-                this.decryptedBytes,
-                this.encryptedEphemeralKey,
-                this.encryptedKeyId, 
+                decryptedBytes,
+                encryptedEphemeralKey,
+                encryptedKeyId, 
                 dataRefUris,
                 certs
             )

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/SAMLTokenProcessor.java Fri May  8 13:18:30 2009
@@ -53,13 +53,13 @@
             log.debug("Found SAML Assertion element");
         }
         SAMLAssertion assertion = handleSAMLToken(elem);
-        this.id = assertion.getId();
+        id = assertion.getId();
         wsDocInfo.setAssertion(elem);
         returnResults.add(
             0,
             new WSSecurityEngineResult(WSConstants.ST_UNSIGNED, assertion)
         );
-        this.samlTokenElement = elem;
+        samlTokenElement = elem;
 
     }
 
@@ -87,7 +87,7 @@
      * Return the id of the SAML token
      */
     public String getId() {
-        return this.id;
+        return id;
     }
 
     public Element getSamlTokenElement() {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/SecurityContextTokenProcessor.java Fri May  8 13:18:30 2009
@@ -70,9 +70,9 @@
         WSSConfig config
     ) throws WSSecurityException {
         SecurityContextToken sct = new SecurityContextToken(elem);
-        this.identifier = sct.getIdentifier();
-        this.secret = this.getSecret(cb, sct);
-        this.sctId = sct.getID();
+        identifier = sct.getIdentifier();
+        secret = getSecret(cb, sct);
+        sctId = sct.getID();
         
         returnResults.add(
             0, 
@@ -124,7 +124,7 @@
      * Return the id of the 
      */
     public String getId() {
-        return this.sctId;
+        return sctId;
     }
 
     /**

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/saml/WSSecSignatureSAML.java Fri May  8 13:18:30 2009
@@ -300,7 +300,7 @@
             Element canonElem = 
                 XMLUtils.createElementInSignatureSpace(doc, Constants._TAG_CANONICALIZATIONMETHOD);
 
-            canonElem.setAttributeNS(null, Constants._ATT_ALGORITHM, canonAlgo);
+            canonElem.setAttribute(Constants._ATT_ALGORITHM, canonAlgo);
 
             if (wssConfig.isWsiBSPCompliant()) {
                 Set prefixes = getInclusivePrefixes(secHeader.getSecurityHeader(), false);

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java Fri May  8 13:18:30 2009
@@ -57,7 +57,8 @@
     /**
      * Field implementedTransformURI
      */
-    public static final String implementedTransformURI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform";
+    public static final String implementedTransformURI = 
+        "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform";
 
     private static Log log = LogFactory.getLog(STRTransform.class.getName());
 
@@ -119,7 +120,7 @@
             //
             wsDocInfo = WSDocInfoStore.lookup(thisDoc);
             if (wsDocInfo == null) {
-                throw (new CanonicalizationException("no WSDocInfo found"));
+                throw new CanonicalizationException("no WSDocInfo found");
             }
             //
             // According to the OASIS WS Specification "Web Services Security:
@@ -185,7 +186,7 @@
             //
             SecurityTokenReference secRef = new SecurityTokenReference(str);
             //
-            // Third and forth step are performed by derefenceSTR()
+            // Third and fourth step are performed by derefenceSTR()
             //
             Element dereferencedToken = dereferenceSTR(thisDoc, secRef);
             //
@@ -323,11 +324,10 @@
                 WSSecurityException.SECURITY_TOKEN_UNAVAILABLE, "encodeError", null, e
             );
         }
-        String prefix = WSSecurityUtil.getPrefixNS(WSConstants.WSSE_NS, secRefE);
+        String prefix = 
+            WSSecurityUtil.setNamespace(secRefE, WSConstants.WSSE_NS, WSConstants.WSSE_PREFIX);
         Element elem = doc.createElementNS(WSConstants.WSSE_NS, prefix + ":BinarySecurityToken");
-        WSSecurityUtil.setNamespace(elem, WSConstants.WSSE_NS, prefix);
-        // elem.setAttributeNS(WSConstants.XMLNS_NS, "xmlns", "");
-        elem.setAttributeNS(null, "ValueType", X509Security.X509_V3_TYPE);
+        elem.setAttribute("ValueType", X509Security.X509_V3_TYPE);
         Text certText = doc.createTextNode(Base64.encode(data)); // no line wrap
         elem.appendChild(certText);
         return elem;

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java?rev=772969&r1=772968&r2=772969&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java Fri May  8 13:18:30 2009
@@ -549,13 +549,7 @@
         if (id == null) {
             return null;
         }
-        id = id.trim();
-        if (id.length() == 0) {
-            return null;
-        }
-        if (id.charAt(0) == '#') {
-            id = id.substring(1);
-        }
+        id = getIDFromReference(id);
         return WSSecurityUtil.findElementById(doc.getDocumentElement(), id, null);
     }
 
@@ -615,32 +609,31 @@
     }
 
     /**
-     * find a ws-security header block for a given actor <p/>
+     * find a WS-Security header block for a given actor <p/>
      * 
      * @param doc the DOM document (SOAP request)
      * @param envelope the SOAP envelope
-     * @param actot the actor (role) name of the WSS header
+     * @param actor the actor (role) name of the WSS header
      * @param doCreate if true create a new WSS header block if none exists
      * @return the WSS header or null if none found and doCreate is false
      */
     public static Element findWsseSecurityHeaderBlock(
         Document doc,
-        Element envelope, 
+        Element envelope,
         String actor, 
         boolean doCreate
     ) {
         Element wsseSecurity = getSecurityHeader(doc, actor);
         if (wsseSecurity != null) {
             return wsseSecurity;
-        }
-        String soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
-        Element header = 
-            getDirectChildElement(envelope, WSConstants.ELEM_HEADER, soapNamespace);
-        if (header == null && doCreate) {
-            header = createElementInSameNamespace(envelope, WSConstants.ELEM_HEADER);
-            header = prependChildElement(envelope, header);
-        }
-        if (doCreate) {
+        } else if (doCreate) {
+            String soapNamespace = WSSecurityUtil.getSOAPNamespace(doc.getDocumentElement());
+            Element header = 
+                getDirectChildElement(envelope, WSConstants.ELEM_HEADER, soapNamespace);
+            if (header == null) {
+                header = createElementInSameNamespace(envelope, WSConstants.ELEM_HEADER);
+                header = prependChildElement(envelope, header);
+            }
             wsseSecurity = 
                 header.getOwnerDocument().createElementNS(WSConstants.WSSE_NS, "wsse:Security");
             wsseSecurity.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsse", WSConstants.WSSE_NS);
@@ -676,12 +669,7 @@
     }
     
     public static String getSOAPNamespace(Element startElement) {
-        Document doc = startElement.getOwnerDocument();
-        String ns = doc.getDocumentElement().getNamespaceURI();
-        if (WSConstants.URI_SOAP12_ENV.equals(ns)) {
-            return ns;
-        }
-        return WSConstants.URI_SOAP11_ENV;
+        return getSOAPConstants(startElement).getEnvelopeURI();
     }
 
     public static Cipher getCipherInstance(String cipherAlgo)



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org