cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r465292 - in /incubator/cxf/trunk/rt/ws/rm: ./ src/main/java/org/apache/cxf/ws/rm/ src/main/java/org/apache/cxf/ws/rm/impl/ src/main/java/org/apache/cxf/ws/rm/soap/ src/test/java/org/apache/cxf/ws/rm/impl/ src/test/java/org/apache/cxf/ws/rm...
Date Wed, 18 Oct 2006 16:37:17 GMT
Author: andreasmyth
Date: Wed Oct 18 09:37:16 2006
New Revision: 465292

URL: http://svn.apache.org/viewvc?view=rev&rev=465292
Log:
[JIRA CXF-137]: RM SoapInterceptor.

Added:
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMProperties.java   (with props)
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/Messages.properties
      - copied unchanged from r465186, incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/main/java/org/objectweb/celtix/ws/rm/soap/Messages.properties
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
      - copied, changed from r465186, incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/main/java/org/objectweb/celtix/ws/rm/soap/RMSoapHandler.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java
      - copied, changed from r465239, incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/test/java/org/objectweb/celtix/ws/rm/soap/RMSoapHandlerTest.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/resources/
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/resources/Acknowledgment.xml
      - copied unchanged from r465269, incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/test/java/org/objectweb/celtix/ws/rm/resources/spec/Acknowledgment.xml
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/resources/Message1.xml
      - copied unchanged from r465275, incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/test/java/org/objectweb/celtix/ws/rm/resources/spec/Message1.xml
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/resources/Retransmission.xml
      - copied unchanged from r465269, incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/test/java/org/objectweb/celtix/ws/rm/resources/spec/Retransmission.xml
Removed:
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Names.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMConstantsImpl.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMPropertiesImpl.java
Modified:
    incubator/cxf/trunk/rt/ws/rm/.ruleset
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceFaultFactory.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java

Modified: incubator/cxf/trunk/rt/ws/rm/.ruleset
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/.ruleset?view=diff&rev=465292&r1=465291&r2=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/.ruleset (original)
+++ incubator/cxf/trunk/rt/ws/rm/.ruleset Wed Oct 18 09:37:16 2006
@@ -41,7 +41,7 @@
   <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/>
   <rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"/>
   <rule ref="rulesets/basic.xml/UnnecessaryReturn"/>
-  <rule ref="rulesets/basic.xml/UselessOverridingMethod"/>
+  <!--rule ref="rulesets/basic.xml/UselessOverridingMethod"/-->
   
 <!--<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"/>-->
 <!--<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"/>-->

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java?view=auto&rev=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java Wed Oct 18 09:37:16 2006
@@ -0,0 +1,176 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.rm;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Holder for WS-RM names (of headers, namespaces etc.).
+ */
+public final class RMConstants {
+   
+    public static final String WSRM_NAMESPACE_NAME = 
+        "http://schemas.xmlsoap.org/ws/2005/02/rm";
+    
+    public static final String WSRMP_NAMESPACE_NAME = 
+        "http://schemas.xmlsoap.org/ws/2005/02/rm/policy";
+    
+    public static final String WSA_NAMESPACE_NAME = 
+        "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+    
+    public static final String WSRM_NAMESPACE_PREFIX = "wsrm";
+    
+    public static final String WSRM_WSDL_NAMESPACE_NAME = 
+        WSRM_NAMESPACE_NAME + "/wsdl";
+    
+  
+    public static final String WSRM_SEQUENCE_NAME =
+        "Sequence";
+    
+    public static final QName WSRM_SEQUENCE_QNAME =
+        new QName(WSRM_NAMESPACE_NAME, WSRM_SEQUENCE_NAME);
+    
+    public static final String WSRM_SEQUENCE_ACK_NAME =
+        "SequenceAcknowledgement";
+    
+    public static final QName WSRM_SEQUENCE_ACK_QNAME =
+        new QName(WSRM_NAMESPACE_NAME, WSRM_SEQUENCE_ACK_NAME);
+    
+    public static final String WSRM_ACK_REQUESTED_NAME =
+        "AckRequested";
+    
+    public static final QName WSRM_ACK_REQUESTED_QNAME =
+        new QName(WSRM_NAMESPACE_NAME, WSRM_ACK_REQUESTED_NAME);
+    
+    public static final String WSA_ANONYMOUS_ADDRESS = 
+        WSA_NAMESPACE_NAME + "/anonymous";
+    
+    public static final String WSA_NONE_ADDRESS =
+        WSA_NAMESPACE_NAME + "/none";
+      
+    /**
+     * The set of headers understood by the protocol binding.
+     */
+    private static final Set<QName> HEADERS;
+
+    private static final String WSRM_CREATE_SEQUENCE_ACTION =
+        WSRM_NAMESPACE_NAME + "/CreateSequence";
+    
+    private static final String WSRM_CREATE_SEQUENCE_RESPONSE_ACTION =
+        WSRM_NAMESPACE_NAME + "/CreateSequenceResponse";
+    
+    private static final String WSRM_TERMINATE_SEQUENCE_ACTION =
+        WSRM_NAMESPACE_NAME + "/TerminateSequence";
+    
+    private static final String WSRM_LAST_MESSAGE_ACTION =
+        WSRM_NAMESPACE_NAME + "/LastMessage";
+    
+    private static final String WSRM_SEQUENCE_ACKNOWLEDGMENT_ACTION =
+        WSRM_NAMESPACE_NAME + "/SequenceAcknowledgement";
+    
+    private static final String WSRM_SEQUENCE_INFO_ACTION =
+        WSRM_NAMESPACE_NAME + "/SequenceInfo";
+    
+    private static final String WSRM_UNKNOWN_SEQUENCE_FAULT_CODE =
+        "UnknownSequence";
+    
+    private static final String WSRM_SEQUENCE_TERMINATED_FAULT_CODE =
+        "SequenceTerminated";
+    
+    private static final String WSRM_INVALID_ACKNOWLEDGMENT_FAULT_CODE =
+        "InvalidAcknowledgement";
+    
+    private static final String WSRM_MESSAGE_NUMBER_ROLLOVER_FAULT_CODE =
+        "MessageNumberRollover";
+    
+    private static final String WSRM_CREATE_SEQUENCE_REFUSED_FAULT_CODE =
+        "CreateSequenceRefused";
+    
+    private static final String WSRM_LAST_MESSAGE_NUMBER_EXCEEDED_FAULT_CODE =
+        "LastMessageNumberExceeded";
+    
+    static {
+        Set<QName> headers = new HashSet<QName>();
+        headers.add(WSRM_SEQUENCE_QNAME);
+        headers.add(WSRM_SEQUENCE_ACK_QNAME);
+        headers.add(WSRM_ACK_REQUESTED_QNAME);
+        HEADERS = Collections.unmodifiableSet(headers);
+    }
+    
+    private RMConstants() {
+    }
+    
+    public static Set<QName> getHeaders() {
+        return HEADERS;
+    }
+    
+    public static String getCreateSequenceAction() {
+        return WSRM_CREATE_SEQUENCE_ACTION;
+    }
+
+    public static String getCreateSequenceResponseAction() {
+        return WSRM_CREATE_SEQUENCE_RESPONSE_ACTION;
+    }
+    
+    public static String getTerminateSequenceAction() {
+        return WSRM_TERMINATE_SEQUENCE_ACTION;
+    }
+    
+    public static String getLastMessageAction() {
+        return WSRM_LAST_MESSAGE_ACTION;
+    }
+    
+    public static String getSequenceAcknowledgmentAction() {
+        return WSRM_SEQUENCE_ACKNOWLEDGMENT_ACTION;
+    }
+    
+    public static String getSequenceInfoAction() {
+        return WSRM_SEQUENCE_INFO_ACTION;
+    }
+    
+    public static QName getUnknownSequenceFaultCode() {
+        return new QName(WSRM_NAMESPACE_NAME, WSRM_UNKNOWN_SEQUENCE_FAULT_CODE);
+    }
+        
+    public static QName getSequenceTerminatedFaultCode() {
+        return new QName(WSRM_NAMESPACE_NAME, WSRM_SEQUENCE_TERMINATED_FAULT_CODE);
+    }
+        
+    public static QName getInvalidAcknowledgmentFaultCode() {
+        return new QName(RMConstants.WSRM_NAMESPACE_NAME, WSRM_INVALID_ACKNOWLEDGMENT_FAULT_CODE);
+    }
+  
+    public static QName getMessageNumberRolloverFaultCode() {
+        return new QName(WSRM_NAMESPACE_NAME, WSRM_MESSAGE_NUMBER_ROLLOVER_FAULT_CODE);
+    }
+    
+    public static QName getCreateSequenceRefusedFaultCode() {
+        return new QName(WSRM_NAMESPACE_NAME, WSRM_CREATE_SEQUENCE_REFUSED_FAULT_CODE);
+    }
+    
+    public static QName getLastMessageNumberExceededFaultCode() {
+        return new QName(WSRM_NAMESPACE_NAME, WSRM_LAST_MESSAGE_NUMBER_EXCEEDED_FAULT_CODE);
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java?view=diff&rev=465292&r1=465291&r2=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java Wed Oct 18 09:37:16 2006
@@ -30,10 +30,32 @@
     protected RMContextUtils() {
     }
     
+    /**
+     * Determine if message is outbound.
+     * 
+     * @param message the current Message
+     * @return true iff the message direction is outbound
+     */
+    public static boolean isOutbound(Message message) {
+        return org.apache.cxf.ws.addressing.ContextUtils.isOutbound(message);
+    }
+    
+    /**
+     * Retrieve the RM properties from the current message.
+     * @param message the current message
+     * @param outbound true iff the message direction is outbound
+     * @return the RM properties
+     */
     public static RMProperties retrieveRMProperties(Message message, boolean outbound) {
         return (RMProperties)message.get(getRMPropertiesKey(outbound));
     }
     
+    /**
+     * Store the RM properties in the current message.
+     * @param message the current message
+     * @param rmps the RM properties
+     * @param outbound iff the message direction is outbound
+     */
     public static void storeRMProperties(Message message, RMProperties rmps, boolean outbound) {
         String key = getRMPropertiesKey(outbound);
         message.put(key, rmps);
@@ -43,5 +65,7 @@
         return outbound ? RMMessageConstants.RM_PROPERTIES_OUTBOUND 
             : RMMessageConstants.RM_PROPERTIES_INBOUND;
     }
+    
+    
     
 }

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMProperties.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMProperties.java?view=auto&rev=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMProperties.java (added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMProperties.java Wed Oct 18 09:37:16 2006
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.rm;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.cxf.ws.rm.impl.RMUtils;
+
+public class RMProperties {
+    private SequenceType sequence;
+    private Collection<SequenceAcknowledgement> acks;
+    private Collection<AckRequestedType> acksRequested;
+    
+    public Collection<SequenceAcknowledgement> getAcks() {
+        return acks;
+    }
+    
+    public Collection<AckRequestedType> getAcksRequested() {
+        return acksRequested;
+    }
+    
+    public SequenceType getSequence() {
+        return sequence;
+    }
+    
+    public void setAcks(Collection<SequenceAcknowledgement> a) {
+        acks = a;
+    }
+    
+    public void setAcksRequested(Collection<AckRequestedType> ar) {
+        acksRequested = ar;       
+    }
+    
+    public void setSequence(SequenceType s) {
+        sequence = s;
+    }
+    
+    public void setSequence(SourceSequence seq) {
+        SequenceType s = RMUtils.getWSRMFactory().createSequenceType();
+        s.setIdentifier(seq.getIdentifier());
+        s.setMessageNumber(seq.getCurrentMessageNr());   
+        if (seq.isLastMessage()) {
+            s.setLastMessage(new SequenceType.LastMessage());
+        }
+        setSequence(s);
+    }
+    
+    public void addAck(DestinationSequence seq) {
+        if (null == acks) {
+            acks = new ArrayList<SequenceAcknowledgement>();
+        }
+        SequenceAcknowledgement ack = seq.getAcknowledgment();
+        acks.add(ack);
+        // TODO: move to caller
+        // seq.acknowledgmentSent();
+    }
+  
+}

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMProperties.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMProperties.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java?view=diff&rev=465292&r1=465291&r2=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/ContextUtils.java Wed Oct 18 09:37:16 2006
@@ -44,16 +44,6 @@
     }
 
     /**
-     * Determine if message is outbound.
-     * 
-     * @param message the current Message
-     * @return true iff the message direction is outbound
-     */
-    static boolean isOutbound(Message message) {
-        return org.apache.cxf.ws.addressing.ContextUtils.isOutbound(message);
-    }
-
-    /**
      * Determine if current messaging role is that of requestor.
      * 
      * @param message the current Message

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java?view=diff&rev=465292&r1=465291&r2=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/DestinationSequenceImpl.java Wed Oct 18 09:37:16 2006
@@ -34,6 +34,7 @@
 import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType;
 import org.apache.cxf.ws.rm.DestinationSequence;
 import org.apache.cxf.ws.rm.Identifier;
+import org.apache.cxf.ws.rm.RMConstants;
 import org.apache.cxf.ws.rm.SequenceAcknowledgement;
 import org.apache.cxf.ws.rm.SequenceAcknowledgement.AcknowledgementRange;
 import org.apache.cxf.ws.rm.SequenceFault;
@@ -82,7 +83,7 @@
     public void acknowledge(BigInteger messageNumber) throws SequenceFault {
         if (null != lastMessageNumber && messageNumber.compareTo(lastMessageNumber) > 0) {
             SequenceFaultType sf = RMUtils.getWSRMFactory().createSequenceFaultType();
-            sf.setFaultCode(RMUtils.getRMConstants().getLastMessageNumberExceededFaultCode());
+            sf.setFaultCode(RMConstants.getLastMessageNumberExceededFaultCode());
             Message msg = new Message("LAST_MESSAGE_NUMBER_EXCEEDED_EXC", LOG, this);
             throw new SequenceFault(msg.toString(), sf);
         }
@@ -176,7 +177,7 @@
     boolean canPiggybackAckOnPartialResponse() {
         // TODO: should also check if we allow breaking the WI Profile rule by which no headers
         // can be included in a HTTP response
-        return getAcksTo().getAddress().getValue().equals(Names.WSA_ANONYMOUS_ADDRESS);
+        return getAcksTo().getAddress().getValue().equals(RMConstants.WSA_ANONYMOUS_ADDRESS);
     }
      
     final void setDestination(Destination d) {

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java?view=diff&rev=465292&r1=465291&r2=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMInterceptor.java Wed Oct 18 09:37:16 2006
@@ -48,7 +48,9 @@
 import org.apache.cxf.ws.addressing.v200408.AttributedURI;
 import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType;
 import org.apache.cxf.ws.rm.Identifier;
+import org.apache.cxf.ws.rm.RMConstants;
 import org.apache.cxf.ws.rm.RMContextUtils;
+import org.apache.cxf.ws.rm.RMProperties;
 import org.apache.cxf.ws.rm.RetransmissionQueue;
 import org.apache.cxf.ws.rm.SequenceAcknowledgement;
 import org.apache.cxf.ws.rm.SequenceFault;
@@ -128,7 +130,7 @@
 
     public void handleMessage(Message msg) throws Fault {
         try {
-            if (ContextUtils.isOutbound(msg)) {
+            if (RMContextUtils.isOutbound(msg)) {
                 handleOutbound(msg, true);
             } else {
                 handleInbound(msg, true);
@@ -141,7 +143,7 @@
     
     public void handleFault(Message msg) {
         try {
-            if (ContextUtils.isOutbound(msg)) {
+            if (RMContextUtils.isOutbound(msg)) {
                 handleOutbound(msg, true);
             } else {
                 handleInbound(msg, true);
@@ -176,21 +178,21 @@
         boolean isApplicationMessage = isAplicationMessage(action);
         System.out.println("isApplicationMessage: " + isApplicationMessage);
         
-        RMPropertiesImpl rmpsOut = (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(message, true);
+        RMProperties rmpsOut = (RMProperties)RMContextUtils.retrieveRMProperties(message, true);
         if (null == rmpsOut) {
-            rmpsOut = new RMPropertiesImpl();
+            rmpsOut = new RMProperties();
             RMContextUtils.storeRMProperties(message, rmpsOut, true);
         } else {
             System.out.println("Got existing RMPropertiesImpl");
         }
         
-        RMPropertiesImpl rmpsIn = null;
+        RMProperties rmpsIn = null;
         Identifier inSeqId = null;
         BigInteger inMessageNumber = null;
         
         if (isApplicationMessage) {
                         
-            rmpsIn = (RMPropertiesImpl)RMContextUtils.retrieveRMProperties(message, false);
+            rmpsIn = (RMProperties)RMContextUtils.retrieveRMProperties(message, false);
             
             if (null != rmpsIn && null != rmpsIn.getSequence()) {
                 inSeqId = rmpsIn.getSequence().getIdentifier();
@@ -224,7 +226,7 @@
         // created Acknowledgement messages only)
 
         if (isApplicationMessage 
-            || RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)) {
+            || RMConstants.getSequenceAcknowledgmentAction().equals(action)) {
             AttributedURI to = VersionTransformer.convert(maps.getTo());
             assert null != to;
             addAcknowledgements(destination, rmpsOut, inSeqId, to);
@@ -293,19 +295,19 @@
     }
     
     boolean isAplicationMessage(String action) {
-        if (RMUtils.getRMConstants().getCreateSequenceAction().equals(action)
-            || RMUtils.getRMConstants().getCreateSequenceResponseAction().equals(action)
-            || RMUtils.getRMConstants().getTerminateSequenceAction().equals(action)
-            || RMUtils.getRMConstants().getLastMessageAction().equals(action)
-            || RMUtils.getRMConstants().getSequenceAcknowledgmentAction().equals(action)
-            || RMUtils.getRMConstants().getSequenceInfoAction().equals(action)) {
+        if (RMConstants.getCreateSequenceAction().equals(action)
+            || RMConstants.getCreateSequenceResponseAction().equals(action)
+            || RMConstants.getTerminateSequenceAction().equals(action)
+            || RMConstants.getLastMessageAction().equals(action)
+            || RMConstants.getSequenceAcknowledgmentAction().equals(action)
+            || RMConstants.getSequenceInfoAction().equals(action)) {
             return false;
         }
         return true;
     }
     
     void addAcknowledgements(Destination destination, 
-                             RMPropertiesImpl rmpsOut, 
+                             RMProperties rmpsOut, 
                              Identifier inSeqId, 
                              AttributedURI to) {
 
@@ -364,8 +366,8 @@
                 } else {
                     acksTo = VersionTransformer.convert(maps.getReplyTo());
                     // for oneways
-                    if (Names.WSA_NONE_ADDRESS.equals(acksTo.getAddress().getValue())) {
-                        acksTo = RMUtils.createReference(Names.WSA_ANONYMOUS_ADDRESS);
+                    if (RMConstants.WSA_NONE_ADDRESS.equals(acksTo.getAddress().getValue())) {
+                        acksTo = RMUtils.createReference(RMConstants.WSA_ANONYMOUS_ADDRESS);
                     }
                 }
                 

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java?view=diff&rev=465292&r1=465291&r2=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/RMUtils.java Wed Oct 18 09:37:16 2006
@@ -27,22 +27,20 @@
 
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.PolicyConstantsImpl;
-import org.apache.cxf.ws.rm.RMConstants;
+
 // import org.apache.cxf.ws.rm.persistence.PersistenceUtils;
 
 public final class RMUtils {
    
     private static final org.apache.cxf.ws.addressing.v200408.ObjectFactory WSA_FACTORY;
     private static final org.apache.cxf.ws.rm.ObjectFactory WSRM_FACTORY;
-    private static final RMConstants WSRM_CONSTANTS;
     private static final AddressingConstants WSA_CONSTANTS; 
     private static final PolicyConstants WSP_CONSTANTS;
     // private static final PersistenceUtils WSRM_PERSISTENCE_UTILS;
     
     static {
         WSA_FACTORY = new org.apache.cxf.ws.addressing.v200408.ObjectFactory();
-        WSRM_FACTORY = new org.apache.cxf.ws.rm.ObjectFactory();
-        WSRM_CONSTANTS = new RMConstantsImpl();        
+        WSRM_FACTORY = new org.apache.cxf.ws.rm.ObjectFactory();        
         WSA_CONSTANTS = new AddressingConstantsImpl();
         WSP_CONSTANTS = new PolicyConstantsImpl();
         // WSRM_PERSISTENCE_UTILS = new PersistenceUtils();       
@@ -57,10 +55,6 @@
     
     public static org.apache.cxf.ws.rm.ObjectFactory getWSRMFactory() {
         return WSRM_FACTORY;
-    }
-    
-    public static RMConstants getRMConstants() {
-        return WSRM_CONSTANTS;
     }
     
     public static AddressingConstants getAddressingConstants() {

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceFaultFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceFaultFactory.java?view=diff&rev=465292&r1=465291&r2=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceFaultFactory.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/SequenceFaultFactory.java Wed Oct 18 09:37:16 2006
@@ -24,6 +24,7 @@
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.ws.rm.Identifier;
+import org.apache.cxf.ws.rm.RMConstants;
 import org.apache.cxf.ws.rm.SequenceFault;
 import org.apache.cxf.ws.rm.SequenceFaultType;
 
@@ -37,7 +38,7 @@
 
     SequenceFault createUnknownSequenceFault(Identifier sid) {
         SequenceFaultType sf = RMUtils.getWSRMFactory().createSequenceFaultType();
-        sf.setFaultCode(RMUtils.getRMConstants().getUnknownSequenceFaultCode());
+        sf.setFaultCode(RMConstants.getUnknownSequenceFaultCode());
         Message msg = new Message("UNKNOWN_SEQUENCE_EXC", LOG, sid.getValue());
         return new SequenceFault(msg.toString(), sf);
     }    

Copied: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java (from r465186, incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/main/java/org/objectweb/celtix/ws/rm/soap/RMSoapHandler.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java?view=diff&rev=465292&p1=incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/main/java/org/objectweb/celtix/ws/rm/soap/RMSoapHandler.java&r1=465186&p2=incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java&r2=465292
==============================================================================
--- incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/main/java/org/objectweb/celtix/ws/rm/soap/RMSoapHandler.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java Wed Oct 18 09:37:16 2006
@@ -1,9 +1,28 @@
-package org.objectweb.celtix.ws.rm.soap;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.rm.soap;
 
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
+import java.util.Collections;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -14,146 +33,152 @@
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-
-import org.objectweb.celtix.bindings.BindingContextUtils;
-import org.objectweb.celtix.bindings.DataBindingCallback;
-import org.objectweb.celtix.common.logging.LogUtils;
-import org.objectweb.celtix.common.util.PackageUtils;
-import org.objectweb.celtix.context.ObjectMessageContext;
-import org.objectweb.celtix.ws.addressing.AddressingProperties;
-import org.objectweb.celtix.ws.addressing.AttributedURIType;
-import org.objectweb.celtix.ws.addressing.ContextUtils;
-import org.objectweb.celtix.ws.rm.AckRequestedType;
-import org.objectweb.celtix.ws.rm.CreateSequenceRequest;
-import org.objectweb.celtix.ws.rm.CreateSequenceResponse;
-import org.objectweb.celtix.ws.rm.Names;
-import org.objectweb.celtix.ws.rm.RMContextUtils;
-import org.objectweb.celtix.ws.rm.RMProperties;
-import org.objectweb.celtix.ws.rm.RMPropertiesImpl;
-import org.objectweb.celtix.ws.rm.RMUtils;
-import org.objectweb.celtix.ws.rm.SequenceAcknowledgement;
-import org.objectweb.celtix.ws.rm.SequenceType;
-import org.objectweb.celtix.ws.rm.TerminateSequenceRequest;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.PackageUtils;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.ws.addressing.soap.MAPCodec;
+import org.apache.cxf.ws.rm.AckRequestedType;
+import org.apache.cxf.ws.rm.RMConstants;
+import org.apache.cxf.ws.rm.RMContextUtils;
+import org.apache.cxf.ws.rm.RMProperties;
+import org.apache.cxf.ws.rm.SequenceAcknowledgement;
+import org.apache.cxf.ws.rm.SequenceType;
 
 
 /**
  * Protocol Handler responsible for {en|de}coding the RM 
  * Properties for {outgo|incom}ing messages.
  */
-public class RMSoapHandler implements SOAPHandler<SOAPMessageContext> {
+public class RMSoapInterceptor extends AbstractSoapInterceptor {
 
     protected static JAXBContext jaxbContext;
 
-    private static final Logger LOG = LogUtils.getL7dLogger(RMSoapHandler.class);
+    private static final Logger LOG = LogUtils.getL7dLogger(RMSoapInterceptor.class);
     private static final String WS_RM_PACKAGE = 
         PackageUtils.getPackageName(SequenceType.class);
+    
+    private Set<String> before = Collections.singleton(MAPCodec.class.getName());
 
     /**
      * Constructor.
      */
-    public RMSoapHandler() {
+    public RMSoapInterceptor() {
     } 
+    
+    // PhaseInterceptor interface
 
-    /**
-     * @return the set of SOAP headers understood by this handler 
-     */
-    public Set<QName> getHeaders() {
-        return Names.HEADERS;
+    public Set<String> getAfter() {
+        return CastUtils.cast(Collections.EMPTY_SET);        
+    }
+
+    public Set<String> getBefore() {
+        return before;
     }
+
+    public String getId() {
+        return RMSoapInterceptor.class.getName();
+    }
+
+    public String getPhase() {
+        return Phase.PRE_LOGICAL;
+    }
+      
+    // AbstractSoapInterceptor interface 
     
     /**
-     * Invoked for normal processing of inbound and outbound messages.
-     *
-     * @param context the messsage context
+     * @return the set of SOAP headers understood by this handler 
      */
-    public boolean handleMessage(SOAPMessageContext context) {
-        return mediate(context);
+    public Set<QName> getUnderstoodHeaders() {
+        return RMConstants.getHeaders();
     }
+    
+    // Interceptor interface
 
-    /**
-     * Invoked for fault processing.
-     *
-     * @param context the messsage context
+    /* (non-Javadoc)
+     * @see org.apache.cxf.interceptor.Interceptor#handleFault(org.apache.cxf.message.Message)
      */
-    public boolean handleFault(SOAPMessageContext context) {
-        return mediate(context);
+    public void handleFault(SoapMessage message) {
+        mediate(message);        
     }
 
-    /**
-     * Called at the conclusion of a message exchange pattern just prior to
-     * the JAX-WS runtime dispatching a message, fault or exception.
-     *
-     * @param context the message context
+    /* (non-Javadoc)
+     * @see org.apache.cxf.interceptor.Interceptor#handleMessage(org.apache.cxf.message.Message)
      */
-    public void close(MessageContext context) {
+
+    public void handleMessage(SoapMessage message) throws Fault {
+        mediate(message);
     }
 
 
     /**
-     * Mediate message flow, peforming MAP {en|de}coding.
+     * Mediate message flow, peforming RMProperties {en|de}coding.
      * 
-     * @param context the messsage context
-     * @return true if processing should continue on dispatch path 
-     */     
-    boolean mediate(SOAPMessageContext context) {
-        if (ContextUtils.isOutbound(context)) {
-            encode(context);
+     * @param message the messsage
+     */ 
+
+    void mediate(SoapMessage message) {
+        if (RMContextUtils.isOutbound(message)) {
+            encode(message);
         } else {
-            decode(context);
-            storeBindingInfo(context);
+            decode(message);
+            // storeBindingInfo(context);
         }
-        return true;
     }
     
     /**
-     * Encode the current RM properties  in protocol-specific headers.
+     * Encode the current RM properties in protocol-specific headers.
      *
-     * @param context the message context.
+     * @param message the SOAP message
      */
-    private void encode(SOAPMessageContext context) {
-        RMProperties rmps = RMContextUtils.retrieveRMProperties(context, true);
+    
+    void encode(SoapMessage message) {
+        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);
         if (null == rmps) {
             // nothing to encode
             return;
         }
-        SOAPMessage message = context.getMessage();
         encode(message, rmps);
     }
 
     /**
-     * Encode the current RM properties  in protocol-specific headers.
+     * Encode the current RM properties in protocol-specific headers.
      *
      * @param message the SOAP message.
      * @param rmps the current RM properties.
      */
 
-    public static void encode(SOAPMessage message, RMProperties rmps) {
+    public static void encode(SoapMessage message, RMProperties rmps) {
+        if (null == rmps) {
+            return;
+        }
+        LOG.log(Level.FINE, "encoding RMPs in SOAP headers");
+        
         try {
-            SOAPEnvelope env = message.getSOAPPart().getEnvelope();
-            SOAPHeader header = env.getHeader() != null 
-                                ? env.getHeader()
-                                : env.addHeader(); 
-                                
+            Element header = message.getHeaders(Element.class);
             discardRMHeaders(header);
-            header.addNamespaceDeclaration(Names.WSRM_NAMESPACE_PREFIX,
-                                           Names.WSRM_NAMESPACE_NAME);
+            
+            // add WSRM namespace declaration to header, instead of
+            // repeating in each individual child node
+            header.setAttributeNS("http://www.w3.org/2000/xmlns/",
+                                  "xmlns:" + RMConstants.WSRM_NAMESPACE_PREFIX,
+                                 RMConstants.WSRM_NAMESPACE_NAME);
             Marshaller marshaller = getJAXBContext().createMarshaller();
             marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
            
             SequenceType seq = rmps.getSequence();
             if (null != seq) {
                 encodeProperty(seq, 
-                               Names.WSRM_SEQUENCE_QNAME, 
+                               RMConstants.WSRM_SEQUENCE_QNAME, 
                                SequenceType.class, 
                                header,
                                marshaller);
@@ -162,7 +187,7 @@
             if (null != acks) {
                 for (SequenceAcknowledgement ack : acks) {
                     encodeProperty(ack, 
-                                   Names.WSRM_SEQUENCE_ACK_QNAME, 
+                                   RMConstants.WSRM_SEQUENCE_ACK_QNAME, 
                                    SequenceAcknowledgement.class, 
                                    header,
                                    marshaller);
@@ -172,71 +197,71 @@
             if (null != requested) {
                 for (AckRequestedType ar : requested) {
                     encodeProperty(ar, 
-                                   Names.WSRM_ACK_REQUESTED_QNAME, 
+                                   RMConstants.WSRM_ACK_REQUESTED_QNAME, 
                                    AckRequestedType.class, 
                                    header,
                                    marshaller);
                 }
-            }                           
+            }         
         } catch (SOAPException se) {
             LOG.log(Level.WARNING, "SOAP_HEADER_ENCODE_FAILURE_MSG", se); 
         } catch (JAXBException je) {
             LOG.log(Level.WARNING, "SOAP_HEADER_ENCODE_FAILURE_MSG", je);
-        }
+        }        
     }
     
     /**
-     * Decode the RM properties from protocol-specific headers.
+     * Decode the RM properties from protocol-specific headers
+     * and store them in the message.
      *  
-     * @param context the messsage context
-     * @param the decoded MAPs
-     * @exception SOAPFaultException if decoded MAPs are invalid 
+     * @param message the SOAP mesage
      */
-    private void decode(SOAPMessageContext context) { 
-        SOAPMessage message = context.getMessage();
+    void decode(SoapMessage message) {
         RMProperties rmps = unmarshalRMProperties(message);
-        RMContextUtils.storeRMProperties(context, rmps, false);
+        RMContextUtils.storeRMProperties(message, rmps, false);
     }
     
     /**
-     * Decode the RM properties from the SOAP message.
+     * Decode the RM properties from protocol-specific headers.
      * 
      * @param message the SOAP message
      * @return the RM properties
      */
-    public RMProperties unmarshalRMProperties(SOAPMessage message) { 
-        RMProperties rmps = new RMPropertiesImpl();
+    public RMProperties unmarshalRMProperties(SoapMessage message) { 
+        RMProperties rmps = new RMProperties();
         
         try {
             Collection<SequenceAcknowledgement> acks = new ArrayList<SequenceAcknowledgement>();
             Collection<AckRequestedType> requested = new ArrayList<AckRequestedType>();           
             
-            SOAPEnvelope env = message.getSOAPPart().getEnvelope();
-            SOAPHeader header = env.getHeader();
-            
+            Element header = message.getHeaders(Element.class);
+ 
             if (header != null) {
                 Unmarshaller unmarshaller = 
                     getJAXBContext().createUnmarshaller();
-                Iterator headerElements = header.examineAllHeaderElements();
-                while (headerElements.hasNext()) {
-                    SOAPHeaderElement headerElement = 
-                        (SOAPHeaderElement)headerElements.next();
-                    Name headerName = headerElement.getElementName();
-                    String localName = headerName.getLocalName(); 
-                    if (Names.WSRM_NAMESPACE_NAME.equals(headerName.getURI())) {
+                NodeList headerElements = header.getChildNodes();
+                for (int i = 0; i < headerElements.getLength(); i++) {
+                    Node node = headerElements.item(i);
+                    if (Node.ELEMENT_NODE != node.getNodeType()) {
+                        continue;
+                    }
+                    Element headerElement = (Element)headerElements.item(i);
+                    String headerURI = headerElement.getNamespaceURI();
+                    String localName = headerElement.getLocalName();
+                    if (RMConstants.WSRM_NAMESPACE_NAME.equals(headerURI)) {
                         LOG.log(Level.INFO, "decoding RM header {0}", localName);
-                        if (Names.WSRM_SEQUENCE_NAME.equals(localName)) {
+                        if (RMConstants.WSRM_SEQUENCE_NAME.equals(localName)) {
                             SequenceType s = decodeProperty(SequenceType.class,
                                                             headerElement,
                                                             unmarshaller);
                             
                             rmps.setSequence(s);
-                        } else if (Names.WSRM_SEQUENCE_ACK_NAME.equals(localName)) {
+                        } else if (RMConstants.WSRM_SEQUENCE_ACK_NAME.equals(localName)) {
                             SequenceAcknowledgement ack = decodeProperty(SequenceAcknowledgement.class,
                                                             headerElement,
                                                             unmarshaller);
                             acks.add(ack);                            
-                        } else if (Names.WSRM_ACK_REQUESTED_NAME.equals(localName)) {
+                        } else if (RMConstants.WSRM_ACK_REQUESTED_NAME.equals(localName)) {
                             AckRequestedType ar = decodeProperty(AckRequestedType.class,
                                                             headerElement,
                                                             unmarshaller);
@@ -250,11 +275,9 @@
                 if (requested.size() > 0) {
                     rmps.setAcksRequested(requested);
                 }
-            }
-        } catch (SOAPException se) {
-            LOG.log(Level.WARNING, "SOAP_HEADER_DECODE_FAILURE_MSG", se); 
-        } catch (JAXBException je) {
-            LOG.log(Level.WARNING, "SOAP_HEADER_DECODE_FAILURE_MSG", je); 
+            } 
+        } catch (JAXBException ex) {
+            LOG.log(Level.WARNING, "SOAP_HEADER_DECODE_FAILURE_MSG", ex); 
         }
         return rmps;
     }
@@ -276,13 +299,13 @@
      * @param value the value to encode
      * @param qname the QName for the header 
      * @param clz the class
-     * @param header the SOAP header
+     * @param header the SOAP header element
      * @param marshaller the JAXB marshaller to use
      */
     private static <T> void encodeProperty(T value, 
                                            QName qname, 
                                            Class<T> clz, 
-                                           SOAPHeader header,
+                                           Element header,
                                            Marshaller marshaller)
         throws JAXBException {
         if (value != null) {
@@ -300,7 +323,7 @@
      * @return the decoded EndpointReference
      */
     public static <T> T decodeProperty(Class<T> clz,
-                                       SOAPHeaderElement headerElement,
+                                       Element headerElement,
                                        Unmarshaller unmarshaller)
         throws JAXBException {
         if (null == unmarshaller) {
@@ -316,25 +339,28 @@
      * Discard any pre-existing RM headers - this may occur if the runtime
      * re-uses a SOAP message.
      *
-     * @param header the SOAP header
+     * @param header the SOAP header element
      */
-    private static void discardRMHeaders(SOAPHeader header) throws SOAPException {
-        Iterator headerElements = header.examineAllHeaderElements();
-        while (headerElements.hasNext()) {
-            SOAPHeaderElement headerElement =
-                (SOAPHeaderElement)headerElements.next();
-            Name headerName = headerElement.getElementName();
-            if (Names.WSRM_NAMESPACE_NAME.equals(headerName.getURI())) {
-                headerElement.detachNode();
+    private static void discardRMHeaders(Element header) throws SOAPException {
+        NodeList headerElements =
+            header.getElementsByTagNameNS(RMConstants.WSRM_NAMESPACE_NAME, "*");
+        
+        for (int i = 0; i < headerElements.getLength(); i++) {
+            Node headerElement = headerElements.item(i);
+            if (RMConstants.WSRM_NAMESPACE_NAME.equals(headerElement.getNamespaceURI())) {
+                header.removeChild(headerElement);
             }
+
             
             // REVISIT should detach wsa:Action on resend
-            if (org.objectweb.celtix.ws.addressing.Names.WSA_NAMESPACE_NAME
+            /*
+            if (org.apache.cxf.ws.addressing.Names.WSA_NAMESPACE_NAME
                 .equals(headerName.getURI())
-                && org.objectweb.celtix.ws.addressing.Names.WSA_ACTION_NAME
+                && org.apache.cxf.ws.addressing.Names.WSA_ACTION_NAME
                 .equals(headerName.getLocalName())) {
                 headerElement.detachNode();
             }
+            */
         }
     }
     
@@ -347,6 +373,7 @@
      * 
      * @param context
      */
+    /*
     private void storeBindingInfo(MessageContext context) {
         assert !ContextUtils.isOutbound(context);
         AddressingProperties maps = ContextUtils.retrieveMAPs(context, false, false);
@@ -382,6 +409,7 @@
             context.put(ObjectMessageContext.MESSAGE_INPUT, Boolean.FALSE);            
         }
     }
+    */
 
 }
 

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java?view=diff&rev=465292&r1=465291&r2=465292
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/impl/RMInterceptorTest.java Wed Oct 18 09:37:16 2006
@@ -45,6 +45,7 @@
 import org.apache.cxf.ws.addressing.v200408.AttributedURI;
 import org.apache.cxf.ws.rm.Identifier;
 import org.apache.cxf.ws.rm.RMMessageConstants;
+import org.apache.cxf.ws.rm.RMProperties;
 import org.apache.cxf.ws.rm.RetransmissionQueue;
 import org.apache.cxf.ws.rm.SequenceFault;
 import org.apache.cxf.ws.rm.interceptor.SequenceTerminationPolicyType;
@@ -239,7 +240,7 @@
             RMInterceptor.class.getDeclaredMethod("getSequence", 
                 new Class[] {Identifier.class, Message.class, AddressingProperties.class}),
             RMInterceptor.class.getDeclaredMethod("addAcknowledgements",
-                new Class[] {Destination.class, RMPropertiesImpl.class, Identifier.class, 
+                new Class[] {Destination.class, RMProperties.class, Identifier.class, 
                              AttributedURI.class})            
         };
         RMInterceptor rmi = control.createMock(RMInterceptor.class, mocked);       
@@ -247,7 +248,7 @@
         EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.TRUE).anyTimes();        
         EasyMock.expect(message.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND))
             .andReturn(maps).anyTimes();
-        RMPropertiesImpl rmpsOut = new RMPropertiesImpl();
+        RMProperties rmpsOut = new RMProperties();
         EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_OUTBOUND)).andReturn(rmpsOut);
         EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_INBOUND)).andReturn(null);        
         Source source = control.createMock(Source.class);

Copied: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java (from r465239, incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/test/java/org/objectweb/celtix/ws/rm/soap/RMSoapHandlerTest.java)
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java?view=diff&rev=465292&p1=incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/test/java/org/objectweb/celtix/ws/rm/soap/RMSoapHandlerTest.java&r1=465239&p2=incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java&r2=465292
==============================================================================
--- incubator/cxf/tags/celtix/pre_apache/rt/ws/rm/src/test/java/org/objectweb/celtix/ws/rm/soap/RMSoapHandlerTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java Wed Oct 18 09:37:16 2006
@@ -1,56 +1,63 @@
-package org.objectweb.celtix.ws.rm.soap;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 
-import java.io.IOException;
+package org.apache.cxf.ws.rm.soap;
+
+import java.io.InputStream;
 import java.lang.reflect.Method;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Set;
 
 import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 
-import static javax.xml.ws.handler.MessageContext.MESSAGE_OUTBOUND_PROPERTY;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 import junit.framework.TestCase;
 
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.ws.rm.AckRequestedType;
+import org.apache.cxf.ws.rm.Identifier;
+import org.apache.cxf.ws.rm.RMConstants;
+import org.apache.cxf.ws.rm.RMContextUtils;
+import org.apache.cxf.ws.rm.RMProperties;
+import org.apache.cxf.ws.rm.SequenceAcknowledgement;
+import org.apache.cxf.ws.rm.SequenceType;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
-import org.objectweb.celtix.bindings.soap.SOAPBindingImpl;
-import org.objectweb.celtix.context.ObjectMessageContext;
-import org.objectweb.celtix.context.ObjectMessageContextImpl;
-import org.objectweb.celtix.datamodel.soap.W3CConstants;
-import org.objectweb.celtix.ws.rm.AckRequestedType;
-import org.objectweb.celtix.ws.rm.Identifier;
-import org.objectweb.celtix.ws.rm.Names;
-import org.objectweb.celtix.ws.rm.RMContextUtils;
-import org.objectweb.celtix.ws.rm.RMEndpointTest;
-import org.objectweb.celtix.ws.rm.RMProperties;
-import org.objectweb.celtix.ws.rm.RMPropertiesImpl;
-import org.objectweb.celtix.ws.rm.RMUtils;
-import org.objectweb.celtix.ws.rm.SequenceAcknowledgement;
-import org.objectweb.celtix.ws.rm.SequenceAcknowledgement.AcknowledgementRange;
-import org.objectweb.celtix.ws.rm.SequenceType;
-import org.objectweb.celtix.ws.rm.TestInputStreamContext;
-
-import static org.easymock.classextension.EasyMock.expect;
 
-public class RMSoapHandlerTest extends TestCase {
+public class RMSoapInterceptorTest extends TestCase {
 
     private static final String SEQ_IDENTIFIER = "http://Business456.com/RM/ABC";
     private static final BigInteger MSG1_MESSAGE_NUMBER = BigInteger.ONE;
     private static final BigInteger MSG2_MESSAGE_NUMBER = BigInteger.ONE.add(BigInteger.ONE);
 
     private IMocksControl control;
-    private RMSoapHandler codec;
     
     private SequenceType s1;
     private SequenceType s2;
@@ -58,126 +65,142 @@
     private SequenceAcknowledgement ack2;
     private AckRequestedType ar1;
     private AckRequestedType ar2;
-    private SOAPBindingImpl sb = new SOAPBindingImpl(false);
     
     public void setUp() {
         control = EasyMock.createNiceControl(); 
-        codec = new RMSoapHandler();
     }
 
-    public void testGetHeaders() throws Exception {
-
-        Set<QName> headers = codec.getHeaders();
-        assertTrue("expected Sequence header", headers.contains(Names.WSRM_SEQUENCE_QNAME));
-        assertTrue("expected SequenceAcknowledgment header", headers.contains(Names.WSRM_SEQUENCE_ACK_QNAME));
-        assertTrue("expected AckRequested header", headers.contains(Names.WSRM_ACK_REQUESTED_QNAME));
-    }
-    
-    public void testClose() {
-        SOAPMessageContext ctx = control.createMock(SOAPMessageContext.class);
-        codec.close(ctx);
+    public void testGetUnderstoodHeaders() throws Exception {
+        RMSoapInterceptor codec = new RMSoapInterceptor();
+        Set<QName> headers = codec.getUnderstoodHeaders();
+        assertTrue("expected Sequence header", 
+                   headers.contains(RMConstants.WSRM_SEQUENCE_QNAME));
+        assertTrue("expected SequenceAcknowledgment header", 
+                   headers.contains(RMConstants.WSRM_SEQUENCE_ACK_QNAME));
+        assertTrue("expected AckRequested header", 
+                   headers.contains(RMConstants.WSRM_ACK_REQUESTED_QNAME));
     }
     
     public void testHandleMessage() throws NoSuchMethodException {
-        Method m = RMSoapHandler.class.getDeclaredMethod("mediate", 
-            new Class[] {SOAPMessageContext.class});
-        codec = control.createMock(RMSoapHandler.class, new Method[] {m});
-        SOAPMessageContext ctx = control.createMock(SOAPMessageContext.class);
-        expect(codec.mediate(ctx)).andReturn(true);
+        Method m = RMSoapInterceptor.class.getDeclaredMethod("mediate", 
+            new Class[] {SoapMessage.class});
+        RMSoapInterceptor codec = control.createMock(RMSoapInterceptor.class, new Method[] {m});
+        SoapMessage msg = control.createMock(SoapMessage.class);
+        codec.mediate(msg);
+        EasyMock.expectLastCall();
         
         control.replay();
-        assertTrue(codec.handleMessage(ctx));
+        codec.handleMessage(msg);
         control.verify();
     }
     
     public void testHandleFault() throws NoSuchMethodException {
-        Method m = RMSoapHandler.class.getDeclaredMethod("mediate", 
-            new Class[] {SOAPMessageContext.class});
-        codec = control.createMock(RMSoapHandler.class, new Method[] {m});
-        SOAPMessageContext ctx = control.createMock(SOAPMessageContext.class);
-        expect(codec.mediate(ctx)).andReturn(true);
+        Method m = RMSoapInterceptor.class.getDeclaredMethod("mediate", 
+            new Class[] {SoapMessage.class});
+        RMSoapInterceptor codec = control.createMock(RMSoapInterceptor.class, new Method[] {m});
+        SoapMessage msg = control.createMock(SoapMessage.class);
+        codec.mediate(msg);
+        EasyMock.expectLastCall();
         
         control.replay();
-        assertTrue(codec.handleFault(ctx));
+        codec.handleFault(msg);
         control.verify();
     }
+    
+    public void testMediate() throws NoSuchMethodException {
+        Method m1 = RMSoapInterceptor.class.getDeclaredMethod("encode", 
+                                                             new Class[] {SoapMessage.class});
+        Method m2 = RMSoapInterceptor.class.getDeclaredMethod("decode", 
+                                                              new Class[] {SoapMessage.class});
+        RMSoapInterceptor codec = control.createMock(RMSoapInterceptor.class, new Method[] {m1, m2});
+        
+        SoapMessage msg = control.createMock(SoapMessage.class);
+        Exchange exchange = control.createMock(Exchange.class);
+        EasyMock.expect(msg.getExchange()).andReturn(exchange);
+        EasyMock.expect(exchange.getOutMessage()).andReturn(msg);
+        codec.encode(msg);
+        EasyMock.expectLastCall();
+        
+        control.replay();
+        codec.mediate(msg);
+        control.verify();
+                
+        control.reset();
+        EasyMock.expect(msg.getExchange()).andReturn(null);
+        codec.decode(msg);
+        EasyMock.expectLastCall();
+        
+        control.replay();
+        codec.mediate(msg);
+        control.verify();
+        
+    }
 
-    public void testOutbound() throws Exception {
-
+    public void testEncode() throws Exception {
+        RMSoapInterceptor codec = new RMSoapInterceptor();
         setUpOutbound();
-        SOAPMessageContext context = null;
+        SoapMessage message = setupOutboundMessage();
 
         // no RM headers
-
-        context = setupOutboundContext();
-        assertTrue("expected dispatch to proceed", codec.handleMessage(context));
-        verifyHeaders(context, new String[] {});
-        codec.close(context);
+   
+        codec.handleMessage(message);
+        verifyHeaders(message, new String[] {});
 
         // one sequence header
 
-        context = setupOutboundContext();
-        
-        RMProperties rmps = RMContextUtils.retrieveRMProperties(context, true);     
-        rmps.setSequence(s1);
-        
-        assertTrue("expected dispatch to proceed", codec.handleMessage(context));
-        verifyHeaders(context, new String[] {Names.WSRM_SEQUENCE_NAME});
-        codec.close(context);
+        message = setupOutboundMessage();        
+        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, true);     
+        rmps.setSequence(s1);        
+        codec.encode(message);
+        verifyHeaders(message, new String[] {RMConstants.WSRM_SEQUENCE_NAME});
 
         // one acknowledgment header
 
-        context = setupOutboundContext();
-        rmps = RMContextUtils.retrieveRMProperties(context, true);  
-        
+        message = setupOutboundMessage(); 
+        rmps = RMContextUtils.retrieveRMProperties(message, true);          
         Collection<SequenceAcknowledgement> acks = new ArrayList<SequenceAcknowledgement>();
         acks.add(ack1);
-        rmps.setAcks(acks);
-        assertTrue("expected dispatch to proceed", codec.handleMessage(context));
-        verifyHeaders(context, new String[] {Names.WSRM_SEQUENCE_ACK_NAME});
+        rmps.setAcks(acks);        
+        codec.encode(message);
+        verifyHeaders(message, new String[] {RMConstants.WSRM_SEQUENCE_ACK_NAME});
 
         // two acknowledgment headers
 
-        context = setupOutboundContext();
-        rmps = RMContextUtils.retrieveRMProperties(context, true);
-        
+        message = setupOutboundMessage();
+        rmps = RMContextUtils.retrieveRMProperties(message, true);        
         acks.add(ack2);
         rmps.setAcks(acks);
-        assertTrue("expected dispatch to proceed", codec.handleMessage(context));
-        verifyHeaders(context, new String[] {Names.WSRM_SEQUENCE_ACK_NAME, Names.WSRM_SEQUENCE_ACK_NAME});
+        codec.encode(message);
+        verifyHeaders(message, new String[] {RMConstants.WSRM_SEQUENCE_ACK_NAME, 
+                                             RMConstants.WSRM_SEQUENCE_ACK_NAME});
 
         // one ack requested header
 
-        context = setupOutboundContext();
-        rmps = RMContextUtils.retrieveRMProperties(context, true);
-        
+        message = setupOutboundMessage();
+        rmps = RMContextUtils.retrieveRMProperties(message, true);        
         Collection<AckRequestedType> requested = new ArrayList<AckRequestedType>();
         requested.add(ar1);
         rmps.setAcksRequested(requested);
-        assertTrue("expected dispatch to proceed", codec.handleMessage(context));
-        verifyHeaders(context, new String[] {Names.WSRM_ACK_REQUESTED_NAME});
+        codec.encode(message);
+        verifyHeaders(message, new String[] {RMConstants.WSRM_ACK_REQUESTED_NAME});
 
         // two ack requested headers
 
-        context = setupOutboundContext();
-        rmps = RMContextUtils.retrieveRMProperties(context, true); 
-        
+        message = setupOutboundMessage();
+        rmps = RMContextUtils.retrieveRMProperties(message, true);         
         requested.add(ar2);
         rmps.setAcksRequested(requested);
-        assertTrue("expected dispatch to proceed", codec.handleMessage(context));
-        verifyHeaders(context, new String[] {Names.WSRM_ACK_REQUESTED_NAME, Names.WSRM_ACK_REQUESTED_NAME});
+        codec.encode(message);
+        verifyHeaders(message, new String[] {RMConstants.WSRM_ACK_REQUESTED_NAME, 
+                                             RMConstants.WSRM_ACK_REQUESTED_NAME});
     }
 
-    public void testInboundSequence() throws IOException {
-        TestInputStreamContext istreamCtx = new TestInputStreamContext();
-        istreamCtx.setInputStream(RMEndpointTest.class
-            .getResourceAsStream("resources/spec/Message1.xml"));
-        sb = new SOAPBindingImpl(false);
-        ObjectMessageContext objectCtx = new ObjectMessageContextImpl();
-        SOAPMessageContext context = (SOAPMessageContext)sb.createBindingMessageContext(objectCtx);
-        sb.read(istreamCtx, context);
-        assertTrue(codec.handleMessage(context));
-        RMProperties rmps = RMContextUtils.retrieveRMProperties(context, false);
+
+    public void testDecodeSequence() throws XMLStreamException {
+        SoapMessage message = setUpInboundMessage("resources/Message1.xml");
+        RMSoapInterceptor codec = new RMSoapInterceptor();
+        codec.handleMessage(message);
+        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
         SequenceType st = rmps.getSequence();
         assertNotNull(st);
         assertEquals(st.getIdentifier().getValue(), SEQ_IDENTIFIER);
@@ -188,17 +211,11 @@
 
     }
 
-    public void testInboundAcknowledgements() throws IOException {
-        TestInputStreamContext istreamCtx = new TestInputStreamContext();
-        istreamCtx.setInputStream(RMEndpointTest.class
-            .getResourceAsStream("resources/spec/Acknowledgment.xml"));
-        sb = new SOAPBindingImpl(false);
-        ObjectMessageContext objectCtx = new ObjectMessageContextImpl();
-        SOAPMessageContext context = (SOAPMessageContext)sb.createBindingMessageContext(objectCtx);
-        sb.read(istreamCtx, context);
-        
-        assertTrue(codec.handleMessage(context));
-        RMProperties rmps = RMContextUtils.retrieveRMProperties(context, false);
+    public void testDecodeAcknowledgements() throws XMLStreamException {
+        SoapMessage message = setUpInboundMessage("resources/Acknowledgment.xml");
+        RMSoapInterceptor codec = new RMSoapInterceptor();
+        codec.handleMessage(message);
+        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
         Collection<SequenceAcknowledgement> acks = rmps.getAcks();
         assertNotNull(acks);
         assertEquals(1, acks.size());
@@ -210,17 +227,11 @@
         assertNull(rmps.getAcksRequested());
     }
 
-    public void testInboundAcksRequested() throws IOException {
-        TestInputStreamContext istreamCtx = new TestInputStreamContext();
-        istreamCtx.setInputStream(RMEndpointTest.class
-            .getResourceAsStream("resources/spec/Retransmission.xml"));
-        sb = new SOAPBindingImpl(false);
-        ObjectMessageContext objectCtx = new ObjectMessageContextImpl();
-        SOAPMessageContext context = (SOAPMessageContext)sb.createBindingMessageContext(objectCtx);
-        sb.read(istreamCtx, context);
-        
-        assertTrue(codec.handleMessage(context));
-        RMProperties rmps = RMContextUtils.retrieveRMProperties(context, false);
+    public void testDecodeAcksRequested() throws XMLStreamException {
+        SoapMessage message = setUpInboundMessage("resources/Retransmission.xml");
+        RMSoapInterceptor codec = new RMSoapInterceptor();
+        codec.handleMessage(message);
+        RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
         Collection<AckRequestedType> requested = rmps.getAcksRequested();
         assertNotNull(requested);
         assertEquals(1, requested.size());
@@ -237,7 +248,7 @@
     }
 
     private void setUpOutbound() {
-        org.objectweb.celtix.ws.rm.ObjectFactory factory = RMUtils.getWSRMFactory();
+        org.apache.cxf.ws.rm.ObjectFactory factory = new org.apache.cxf.ws.rm.ObjectFactory();
         s1 = factory.createSequenceType();
         Identifier sid = factory.createIdentifier();
         sid.setValue("sequence1");
@@ -250,7 +261,8 @@
         s2.setMessageNumber(BigInteger.TEN);
 
         ack1 = factory.createSequenceAcknowledgement();
-        AcknowledgementRange r = factory.createSequenceAcknowledgementAcknowledgementRange();
+        SequenceAcknowledgement.AcknowledgementRange r = 
+            factory.createSequenceAcknowledgementAcknowledgementRange();
         r.setLower(BigInteger.ONE);
         r.setUpper(BigInteger.ONE);
         ack1.getAcknowledgementRange().add(r);
@@ -268,50 +280,34 @@
 
         ar2 = factory.createAckRequestedType();
         ar2.setIdentifier(s2.getIdentifier());
-
-        sb = new SOAPBindingImpl(false);
     }
 
-    private SOAPMessageContext setupOutboundContext() throws Exception {
-        ObjectMessageContext objectCtx = new ObjectMessageContextImpl();
-        objectCtx.put(ObjectMessageContext.MESSAGE_INPUT, Boolean.FALSE);
-        objectCtx.put(MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);
-        SOAPMessageContext context = (SOAPMessageContext)sb.createBindingMessageContext(objectCtx);
-
-        MessageFactory msgFactory = MessageFactory.newInstance();
-        SOAPMessage msg = msgFactory.createMessage();
-        msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true");
-        msg.getSOAPPart().getEnvelope().addNamespaceDeclaration(W3CConstants.NP_SCHEMA_XSD,
-                                                                W3CConstants.NU_SCHEMA_XSD);
-        msg.getSOAPPart().getEnvelope().addNamespaceDeclaration(W3CConstants.NP_SCHEMA_XSI,
-                                                                W3CConstants.NU_SCHEMA_XSI);
-        context.setMessage(msg);
+    private SoapMessage setupOutboundMessage() throws Exception {
+        Message message = new MessageImpl();
+        SoapMessage soapMessage = new SoapMessage(message);         
+        RMProperties rmps = new RMProperties();
+        RMContextUtils.storeRMProperties(soapMessage, rmps, true);
         
-        RMPropertiesImpl rmps = new RMPropertiesImpl();
-        RMContextUtils.storeRMProperties(context, rmps, true);
-        return context;
+        return soapMessage;
     }
 
-    private void verifyHeaders(SOAPMessageContext context, String... names) throws SOAPException {
-        SOAPMessage message = context.getMessage();
-        SOAPEnvelope env = message.getSOAPPart().getEnvelope();
-        SOAPHeader header = env.getHeader();
+    private void verifyHeaders(SoapMessage message, String... names) {
+        Element header = message.getHeaders(Element.class);
 
         // check all expected headers are present
 
         for (String name : names) {
             boolean found = false;
-            Iterator headerElements = header.examineAllHeaderElements();
-            while (headerElements.hasNext()) {
-                SOAPHeaderElement headerElement = (SOAPHeaderElement)headerElements.next();
-                Name headerName = headerElement.getElementName();
-                String localName = headerName.getLocalName();
-                if (headerName.getURI().equals(RMUtils.getRMConstants().getNamespaceURI())
+            NodeList headerElements = header.getChildNodes();
+            for (int i = 0; i < headerElements.getLength(); i++) {
+                Element headerElement = (Element)headerElements.item(i);
+                String namespace = headerElement.getNamespaceURI();
+                String localName = headerElement.getLocalName();
+                if (RMConstants.WSRM_NAMESPACE_NAME.equals(namespace)
                     && localName.equals(name)) {
                     found = true;
                     break;
-                } else if (headerName.getURI().equals(
-                    org.objectweb.celtix.ws.addressing.Names.WSA_NAMESPACE_NAME)
+                } else if (RMConstants.WSA_NAMESPACE_NAME.equals(namespace)
                     && localName.equals(name)) {
                     found = true;
                     break;
@@ -322,14 +318,13 @@
 
         // no other headers should be present
 
-        Iterator headerElements = header.examineAllHeaderElements();
-        while (headerElements.hasNext()) {
-            SOAPHeaderElement headerElement = (SOAPHeaderElement)headerElements.next();
-            Name headerName = headerElement.getElementName();
-            String localName = headerName.getLocalName();
-            assertTrue(RMUtils.getRMConstants().getNamespaceURI().equals(headerName.getURI()) 
-                || org.objectweb.celtix.ws.addressing.Names.WSA_NAMESPACE_NAME
-                .equals(headerName.getURI()));
+        NodeList headerElements = header.getChildNodes();
+        for (int i = 0; i < headerElements.getLength(); i++) {
+            Element headerElement = (Element)headerElements.item(i);  
+            String namespace = headerElement.getNamespaceURI();
+            String localName = headerElement.getLocalName();
+            assertTrue(RMConstants.WSRM_NAMESPACE_NAME.equals(namespace) 
+                || RMConstants.WSA_NAMESPACE_NAME.equals(namespace));
             boolean found = false;
             for (String name : names) {
                 if (localName.equals(name)) {
@@ -339,5 +334,17 @@
             }
             assertTrue("Unexpected header element " + localName, found);
         }
+    }
+    
+    private SoapMessage setUpInboundMessage(String resource) throws XMLStreamException {
+        Message message = new MessageImpl();
+        SoapMessage soapMessage = new SoapMessage(message);
+        InputStream is = RMSoapInterceptorTest.class.getResourceAsStream(resource);
+        assertNotNull(is);
+        XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(is);
+        soapMessage.setContent(XMLStreamReader.class, reader);
+        ReadHeadersInterceptor rji = new ReadHeadersInterceptor();
+        rji.handleMessage(soapMessage); 
+        return soapMessage;
     }
 }



Mime
View raw message