cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r537250 [1/2] - in /incubator/cxf/branches/headerwork: api/src/main/java/org/apache/cxf/headers/ common/common/src/main/java/org/apache/cxf/staxutils/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/soap/src/main/jav...
Date Fri, 11 May 2007 17:59:38 GMT
Author: dkulp
Date: Fri May 11 10:59:35 2007
New Revision: 537250

URL: http://svn.apache.org/viewvc?view=rev&rev=537250
Log:
Start of header refactor

Added:
    incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/
    incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/Header.java   (with props)
    incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderManager.java   (with props)
    incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderProcessor.java   (with props)
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapHeader.java   (with props)
    incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/headers/
    incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/headers/HeaderManagerImpl.java   (with props)
Modified:
    incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java
    incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
    incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/bus-extensions.xml
    incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/cxf/cxf.xml
    incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java
    incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
    incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
    incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
    incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
    incubator/cxf/branches/headerwork/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
    incubator/cxf/branches/headerwork/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptorTest.java
    incubator/cxf/branches/headerwork/systests/src/test/java/org/apache/cxf/systest/ws/addressing/HeaderVerifier.java

Added: incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/Header.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/Header.java?view=auto&rev=537250
==============================================================================
--- incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/Header.java (added)
+++ incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/Header.java Fri May 11 10:59:35 2007
@@ -0,0 +1,61 @@
+/**
+ * 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.headers;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.databinding.DataBinding;
+
+public class Header {
+    public static final String HEADER_LIST = Header.class.getName() + ".list";
+    
+    private DataBinding dataBinding;
+    private QName name;
+    private Object object;
+
+    public Header(QName q, Object o) {
+        this(q, o, null);
+    }
+    
+    public Header(QName q, Object o, DataBinding b) {
+        object = o;
+        name = q;
+        dataBinding = b;
+    }
+    
+    public DataBinding getDataBinding() {
+        return dataBinding;
+    }
+    public void setDataBinding(DataBinding dataBinding) {
+        this.dataBinding = dataBinding;
+    }
+    public QName getName() {
+        return name;
+    }
+    public void setName(QName name) {
+        this.name = name;
+    }
+    public Object getObject() {
+        return object;
+    }
+    public void setObject(Object object) {
+        this.object = object;
+    }
+    
+}

Propchange: incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/Header.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/Header.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderManager.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderManager.java?view=auto&rev=537250
==============================================================================
--- incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderManager.java (added)
+++ incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderManager.java Fri May 11 10:59:35 2007
@@ -0,0 +1,26 @@
+/**
+ * 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.headers;
+
+public interface HeaderManager {
+    
+    void registerHeaderProcessor(HeaderProcessor processor);
+    
+    HeaderProcessor getHeaderProcessor(String namespace);
+}

Propchange: incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderManager.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderProcessor.java?view=auto&rev=537250
==============================================================================
--- incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderProcessor.java (added)
+++ incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderProcessor.java Fri May 11 10:59:35 2007
@@ -0,0 +1,32 @@
+/**
+ * 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.headers;
+
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.interceptor.InterceptorProvider;
+
+public interface HeaderProcessor {
+    
+    String getNamespace();
+    
+    DataBinding getDataBinding();
+    
+    InterceptorProvider getInterceptorProvider();
+
+}

Propchange: incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/branches/headerwork/api/src/main/java/org/apache/cxf/headers/HeaderProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ incubator/cxf/branches/headerwork/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Fri May 11 10:59:35 2007
@@ -23,6 +23,8 @@
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.NamespaceContext;
@@ -235,6 +237,10 @@
         XMLStreamReader reader = createXMLStreamReader(doc);
         copy(reader, writer);
     }
+    public static void copy(Element node, XMLStreamWriter writer) throws XMLStreamException {
+        XMLStreamReader reader = createXMLStreamReader(node);
+        copy(reader, writer);
+    }
     
     /**
      * Copies the reader to the writer. The start and end document methods must
@@ -339,7 +345,23 @@
                 writer.writeNamespace(prefix, uri);
             }
         }
-
+        
+        Map<String, String> prefixMap = new HashMap<String, String>();
+        for (int i = 0; i < reader.getAttributeCount(); i++) {
+            String ns = reader.getAttributeNamespace(i);
+            String nsPrefix = reader.getAttributePrefix(i);
+            
+            if (nsPrefix != null 
+                    && nsPrefix.length() > 0 
+                    && ns != null 
+                    && ns.length() > 0
+                    && !prefixMap.containsKey(nsPrefix)) {
+                writer.writeNamespace(nsPrefix, ns);
+                prefixMap.put(nsPrefix, ns);
+            }
+        }
+        
+        
         // Write out attributes
         for (int i = 0; i < reader.getAttributeCount(); i++) {
             String ns = reader.getAttributeNamespace(i);
@@ -691,6 +713,9 @@
         }
     }
     
+    public static XMLStreamReader createXMLStreamReader(Element el) {
+        return new W3CDOMStreamReader(el);
+    }
     public static XMLStreamReader createXMLStreamReader(Document doc) {
         return new W3CDOMStreamReader(doc.getDocumentElement());
     }

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Fri May 11 10:59:35 2007
@@ -227,11 +227,11 @@
         }
         
         if (!Boolean.TRUE.equals(binding.getProperty(MESSAGE_PROCESSING_DISABLED))) {
-            sb.getInInterceptors().add(new ReadHeadersInterceptor());
+            sb.getInInterceptors().add(new ReadHeadersInterceptor(getBus()));
             sb.getInInterceptors().add(new MustUnderstandInterceptor());
             sb.getOutInterceptors().add(new SoapPreProtocolOutInterceptor());
-            sb.getOutInterceptors().add(new SoapOutInterceptor());
-            sb.getOutFaultInterceptors().add(new SoapOutInterceptor());
+            sb.getOutInterceptors().add(new SoapOutInterceptor(getBus()));
+            sb.getOutFaultInterceptors().add(new SoapOutInterceptor(getBus()));
 
             // REVISIT: The phase interceptor chain seems to freak out if this added
             // first. Not sure what the deal is at the moment, I suspect the
@@ -392,7 +392,7 @@
             // This will not work if we one of the endpoints disables message
             // processing. But, if you've disabled message processing, you 
             // probably aren't going to use this feature.
-            newMO.getBindingInterceptors().add(new ReadHeadersInterceptor());
+            newMO.getBindingInterceptors().add(new ReadHeadersInterceptor(getBus()));
 
             // Add in a default selection interceptor
             newMO.getRoutingInterceptors().add(new EndpointSelectionInterceptor());

Added: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapHeader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapHeader.java?view=auto&rev=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapHeader.java (added)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapHeader.java Fri May 11 10:59:35 2007
@@ -0,0 +1,52 @@
+/**
+ * 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.binding.soap;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.headers.Header;
+
+public class SoapHeader extends Header {
+    private boolean mustUnderstand;
+    private String actor;
+
+    public SoapHeader(QName q, Object o) {
+        super(q, o);
+    }
+    public SoapHeader(QName q, Object o, DataBinding b) {
+        super(q, o, b);
+    }
+    
+    public String getActor() {
+        return actor;
+    }
+    public void setActor(String actor) {
+        this.actor = actor;
+    }
+    
+    public boolean isMustUnderstand() {
+        return mustUnderstand;
+    }
+    public void setMustUnderstand(boolean mustUnderstand) {
+        this.mustUnderstand = mustUnderstand;
+    }
+    
+
+}

Propchange: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapHeader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapHeader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java Fri May 11 10:59:35 2007
@@ -19,25 +19,17 @@
 
 package org.apache.cxf.binding.soap;
 
-import java.util.HashMap;
-import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
 
-import javax.xml.parsers.DocumentBuilder;
+import javax.xml.namespace.QName;
 
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-
-import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.AbstractWrappedMessage;
 import org.apache.cxf.message.Message;
 
 public class SoapMessage extends AbstractWrappedMessage {
-    private static final DocumentBuilder BUILDER = DOMUtils.createDocumentBuilder();
-
-    
-    private Map<Class<?>, Object> headers = new HashMap<Class<?>, Object>(); 
-    
     private SoapVersion version = Soap11.getInstance();
 
     public SoapMessage(Message message) {
@@ -52,24 +44,34 @@
         this.version = v;
     }
     
-    public <T> boolean hasHeaders(Class<T> format) {
-        return headers.containsKey(format);
+    public List<Header> getHeaders() {
+        List<Header> heads = CastUtils.cast((List<?>)get(Header.HEADER_LIST));
+        if (heads == null) {
+            heads = new ArrayList<Header>();
+            put(Header.HEADER_LIST, heads);
+        }
+        return heads;
     }
     
-    public <T> T getHeaders(Class<T> format) {
-        T t = format.cast(headers.get(format));
-        if (t == null && Element.class.equals(format)) {
-            Document doc = BUILDER.newDocument();
-            Element header = doc.createElementNS(version.getNamespace(),
-                                                 version.getHeader().getLocalPart());
-            header.setPrefix(version.getPrefix());
-            setHeaders(Element.class, header);
-            t = format.cast(header);
+    public boolean hasHeader(QName qn) {
+        for (Header head : getHeaders()) {
+            if (head.getName().equals(qn)) {
+                return true;
+            }
         }
-        return t;
-    }  
-
-    public <T> void setHeaders(Class<T> format, T content) {
-        headers.put(format, content);
+        return false;
+    }
+    public Header getHeader(QName qn) {
+        for (Header head : getHeaders()) {
+            if (head.getName().equals(qn)) {
+                return head;
+            }
+        }
+        return null;
     }
+    
+    public boolean hasHeaders() {
+        return containsKey(Header.HEADER_LIST) && getHeaders().size() > 0;
+    }
+    
 }

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java Fri May 11 10:59:35 2007
@@ -20,23 +20,21 @@
 package org.apache.cxf.binding.soap.interceptor;
 
 import java.net.URI;
-import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.List;
 import java.util.ResourceBundle;
 import java.util.Set;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
 
-import org.w3c.dom.Element;
-
 import org.apache.cxf.binding.soap.HeaderUtil;
 import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapHeader;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.headers.Header;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.phase.Phase;
 
@@ -52,13 +50,14 @@
 
     public void handleMessage(SoapMessage soapMessage) {
         SoapVersion soapVersion = soapMessage.getVersion();              
-        Set<Element> mustUnderstandHeaders = new HashSet<Element>();
+        Set<Header> mustUnderstandHeaders = new HashSet<Header>();
         Set<URI> serviceRoles = new HashSet<URI>();
         Set<QName> notUnderstandQNames = new HashSet<QName>();
         Set<QName> mustUnderstandQNames = new HashSet<QName>();
 
         buildMustUnderstandHeaders(mustUnderstandHeaders, soapMessage, serviceRoles);
         initServiceSideInfo(mustUnderstandQNames, soapMessage, serviceRoles);
+        
         if (!checkUnderstand(mustUnderstandHeaders, mustUnderstandQNames, notUnderstandQNames)) {
             StringBuffer sb = new StringBuffer(300);
             int pos = 0;
@@ -95,29 +94,12 @@
         }
     }
 
-    private void buildMustUnderstandHeaders(Set<Element> mustUnderstandHeaders, SoapMessage soapMessage,
-                    Set<URI> serviceRoles) {
-        
-        Element headers = null;
-        if (soapMessage.hasHeaders(Element.class)) {
-            headers = soapMessage.getHeaders(Element.class);
-        }
-        List<Element> headerChilds = new ArrayList<Element>();
-        if (headers != null) {
-            for (int i = 0; i < headers.getChildNodes().getLength(); i++) {
-                if (headers.getChildNodes().item(i) instanceof Element) {
-                    headerChilds.add((Element) headers.getChildNodes().item(i));
-                }
-            }            
-        }
-        for (int i = 0; i < headerChilds.size(); i++) {
-            Element header = headerChilds.get(i);
-            String mustUnderstand = header.getAttributeNS(soapMessage.getVersion().getNamespace(),
-                            soapMessage.getVersion().getAttrNameMustUnderstand());
-
-            if (Boolean.valueOf(mustUnderstand) || "1".equals(mustUnderstand.trim())) {
-                String role = header.getAttributeNS(soapMessage.getVersion().getNamespace(), soapMessage
-                                .getVersion().getAttrNameRole());
+    private void buildMustUnderstandHeaders(Set<Header> mustUnderstandHeaders,
+                                            SoapMessage soapMessage,
+                                            Set<URI> serviceRoles) {
+        for (Header header : soapMessage.getHeaders()) {
+            if (header instanceof SoapHeader && ((SoapHeader)header).isMustUnderstand()) {
+                String role = ((SoapHeader)header).getActor();
                 if (role != null) {
                     role = role.trim();
                     if (role.equals(soapMessage.getVersion().getNextRole())
@@ -136,15 +118,15 @@
                     mustUnderstandHeaders.add(header);
                 }
             }
-
         }
     }
 
-    private boolean checkUnderstand(Set<Element> mustUnderstandHeaders, Set<QName> mustUnderstandQNames,
-                    Set<QName> notUnderstandQNames) {
+    private boolean checkUnderstand(Set<Header> mustUnderstandHeaders,
+                                    Set<QName> mustUnderstandQNames,
+                                    Set<QName> notUnderstandQNames) {
 
-        for (Element header : mustUnderstandHeaders) {
-            QName qname = new QName(header.getNamespaceURI(), header.getLocalName());
+        for (Header header : mustUnderstandHeaders) {
+            QName qname = header.getName();
             if (!mustUnderstandQNames.contains(qname)) {
                 notUnderstandQNames.add(qname);
             }

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java Fri May 11 10:59:35 2007
@@ -33,14 +33,19 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapHeader;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.SoapVersionFactory;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.headers.HeaderManager;
+import org.apache.cxf.headers.HeaderProcessor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.staxutils.PartialXMLStreamReader;
 import org.apache.cxf.staxutils.StaxUtils;
@@ -51,9 +56,11 @@
     private static final Logger LOG = Logger.getLogger(ReadHeadersInterceptor.class.getName());
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ReadHeadersInterceptor.class);
 
-    public ReadHeadersInterceptor() {
+    private Bus bus;
+    public ReadHeadersInterceptor(Bus b) {
         super();
         setPhase(Phase.READ);
+        bus = b;
     }
 
     public void handleMessage(SoapMessage message) {
@@ -90,13 +97,45 @@
                 message.setContent(Node.class, doc);
 
                 // Find header
+                // TODO - we could stream read the "known" headers and just DOM read the 
+                // unknown ones
                 Element element = doc.getDocumentElement();
                 QName header = soapVersion.getHeader();
                 NodeList headerEls = element.getElementsByTagNameNS(header.getNamespaceURI(), header
                     .getLocalPart());
                 for (int i = 0; i < headerEls.getLength(); i++) {
                     Node node = headerEls.item(i);
-                    message.setHeaders(Element.class, (Element)node);
+                    NodeList heads = node.getChildNodes();
+                    for (int x = 0; x < heads.getLength(); x++) {
+                        node = (Node)heads.item(x);
+                        if (node.getNodeType() == Node.ELEMENT_NODE) {
+                            Element hel = (Element)node;
+                            HeaderProcessor p = bus.getExtension(HeaderManager.class)
+                                .getHeaderProcessor(hel.getNamespaceURI());
+
+                            Object obj;
+                            DataBinding dataBinding = null;
+                            if (p == null || p.getDataBinding() == null) {
+                                obj = node;
+                            } else {
+                                obj = p.getDataBinding().createReader(Node.class).read(node);
+                            }
+                            //TODO - add the interceptors
+                            
+                            SoapHeader shead = new SoapHeader(new QName(node.getNamespaceURI(),
+                                                                        node.getLocalName()),
+                                                               obj,
+                                                               dataBinding);
+                            String mu = hel.getAttributeNS(soapVersion.getNamespace(),
+                                                          soapVersion.getAttrNameMustUnderstand());
+                            String act = hel.getAttributeNS(soapVersion.getNamespace(),
+                                                            soapVersion.getAttrNameRole());
+                            
+                            shead.setActor(act);
+                            shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu));
+                            message.getHeaders().add(shead);
+                        }                        
+                    }
                 }
 
                 // advance just past body.

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java Fri May 11 10:59:35 2007
@@ -22,14 +22,11 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.xml.namespace.QName;
-
-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.model.SoapHeaderInfo;
+import org.apache.cxf.headers.Header;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
 import org.apache.cxf.interceptor.BareInInterceptor;
@@ -82,15 +79,20 @@
             return;
         }
         
-        Element headerElement = message.getHeaders(Element.class);
         for (SoapHeaderInfo header : headers) {
             MessagePartInfo mpi = header.getPart();
-            Element param = findHeader(headerElement, mpi);
+            Header param = findHeader(message, mpi);
             
             int idx = mpi.getIndex();
             Object object = null;
             if (param != null) {
-                object = getNodeDataReader(message).read(mpi, param);
+                if (param.getDataBinding() == null) {
+                    Node source = (Node)param.getObject();
+                    object = getNodeDataReader(message).read(mpi, source);
+                } else {
+                    object = param.getObject();
+                }
+                
             }
             
             if (client) {
@@ -112,21 +114,7 @@
         }
     }
 
-    private Element findHeader(Element headerElement, MessagePartInfo mpi) {
-        NodeList nodeList = headerElement.getChildNodes();
-        Element param = null;
-        if (nodeList != null) {
-            QName name = mpi.getConcreteName();
-            for (int i = 0; i < nodeList.getLength(); i++) {
-                Node n = nodeList.item(i);
-                if (n.getNamespaceURI() != null 
-                        && n.getNamespaceURI().equals(name.getNamespaceURI())
-                        && n.getLocalName() != null
-                        && n.getLocalName().equals(name.getLocalPart())) {
-                    param = (Element) n;
-                }
-            }
-        }
-        return param;
+    private Header findHeader(SoapMessage message, MessagePartInfo mpi) {
+        return message.getHeader(mpi.getConcreteName());
     }
 }

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Fri May 11 10:59:35 2007
@@ -29,12 +29,17 @@
 
 import org.w3c.dom.Element;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
 import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.headers.HeaderManager;
+import org.apache.cxf.headers.HeaderProcessor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -49,10 +54,12 @@
 
 public class SoapOutInterceptor extends AbstractSoapInterceptor {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(SoapOutInterceptor.class);
-
-    public SoapOutInterceptor() {
+    private Bus bus;
+    
+    public SoapOutInterceptor(Bus b) {
         super();
         setPhase(Phase.WRITE);
+        bus = b;
     }
     
     public void handleMessage(SoapMessage message) {
@@ -65,12 +72,27 @@
                                   soapVersion.getNamespace());
             xtw.writeNamespace(soapVersion.getPrefix(), soapVersion.getNamespace());
             
-            boolean preexistingHeaders = false;
-            if (message.hasHeaders(Element.class)) {
-                Element eleHeaders = message.getHeaders(Element.class);
-                preexistingHeaders = eleHeaders != null && eleHeaders.hasChildNodes();
-                if (preexistingHeaders) {
-                    StaxUtils.writeElement(eleHeaders, xtw, true, false);
+            boolean preexistingHeaders = message.hasHeaders();
+            if (preexistingHeaders) {
+                xtw.writeStartElement(soapVersion.getPrefix(), 
+                                      soapVersion.getHeader().getLocalPart(),
+                                      soapVersion.getNamespace());                    
+                for (Header header : message.getHeaders()) {
+                    DataBinding b = header.getDataBinding();
+                    if (b == null) {
+                        HeaderProcessor hp = bus.getExtension(HeaderManager.class)
+                                .getHeaderProcessor(header.getName().getNamespaceURI());
+                        if (hp != null) {
+                            b = hp.getDataBinding();
+                        }
+                    }
+                    if (b != null) {
+                        b.createWriter(XMLStreamWriter.class)
+                            .write(header.getObject(), xtw);
+                    } else {
+                        Element node = (Element)header.getObject();
+                        StaxUtils.copy(node, xtw);
+                    }
                 }
             }
             boolean endedHeader = handleHeaderPart(preexistingHeaders, message);

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java Fri May 11 10:59:35 2007
@@ -23,6 +23,7 @@
 import java.util.Collection;
 import java.util.ResourceBundle;
 
+import javax.xml.namespace.QName;
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPConstants;
@@ -36,11 +37,17 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapHeader;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
 import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.headers.HeaderManager;
+import org.apache.cxf.headers.HeaderProcessor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.phase.Phase;
@@ -86,9 +93,45 @@
             }
             
             //replace header element if necessary
-            if (message.hasHeaders(Element.class)) {
-                Element headerElements = soapMessage.getSOAPHeader();    
-                message.setHeaders(Element.class, headerElements);
+            if (message.hasHeaders()) {
+//                Element headerElements = soapMessage.getSOAPHeader();
+//              message.setHeaders(Element.class, headerElements);
+                NodeList headerEls = soapMessage.getSOAPHeader().getChildNodes();
+                for (int i = 0; i < headerEls.getLength(); i++) {
+                    Node nd = headerEls.item(i);
+                    NodeList heads = nd.getChildNodes();
+                    for (int x = 0; x < heads.getLength(); x++) {
+                        nd = (Node)heads.item(x);
+                        if (Node.ELEMENT_NODE == node.getNodeType()) {
+                            Element hel = (Element)node;
+                            HeaderProcessor p = BusFactory.getDefaultBus().getExtension(HeaderManager.class)
+                                .getHeaderProcessor(hel.getNamespaceURI());
+
+                            Object obj;
+                            DataBinding dataBinding = null;
+                            if (p == null || p.getDataBinding() == null) {
+                                obj = nd;
+                            } else {
+                                obj = p.getDataBinding().createReader(Node.class).read(nd);
+                            }
+                            //TODO - add the interceptors
+                            
+                            SoapHeader shead = new SoapHeader(new QName(node.getNamespaceURI(),
+                                                                        node.getLocalName()),
+                                                               obj,
+                                                               dataBinding);
+                            String mu = hel.getAttributeNS(message.getVersion().getNamespace(),
+                                    message.getVersion().getAttrNameMustUnderstand());
+                            String act = hel.getAttributeNS(message.getVersion().getNamespace(),
+                                    message.getVersion().getAttrNameRole());
+                            
+                            shead.setActor(act);
+                            shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu));
+                            message.getHeaders().add(shead);
+                        }
+                        
+                    }
+                }
             }
             
             XMLStreamReader xmlReader = message.getContent(XMLStreamReader.class);

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/MustUnderstandInterceptorTest.java Fri May 11 10:59:35 2007
@@ -29,6 +29,8 @@
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.attachment.AttachmentImpl;
 import org.apache.cxf.attachment.AttachmentUtil;
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
@@ -52,8 +54,10 @@
     public void setUp() throws Exception {
 
         super.setUp();
+        
+        Bus bus = BusFactory.getDefaultBus();
 
-        rhi = new ReadHeadersInterceptor();
+        rhi = new ReadHeadersInterceptor(bus);
         rhi.setPhase("phase1");
         chain.add(rhi);
 

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java Fri May 11 10:59:35 2007
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.activation.DataHandler;
@@ -30,9 +31,11 @@
 
 import org.w3c.dom.Element;
 
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.attachment.AttachmentImpl;
 import org.apache.cxf.attachment.AttachmentUtil;
 import org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor;
+import org.apache.cxf.headers.Header;
 import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.apache.cxf.message.Attachment;
 
@@ -44,7 +47,7 @@
     public void setUp() throws Exception {
         super.setUp();
 
-        rhi = new ReadHeadersInterceptor();
+        rhi = new ReadHeadersInterceptor(BusFactory.getDefaultBus());
         rhi.setPhase("phase1");
         chain.add(rhi);
     }
@@ -56,7 +59,7 @@
         ByteArrayDataSource bads = new ByteArrayDataSource(in, "test/xml");
         soapMessage.setContent(InputStream.class, bads.getInputStream());
 
-        ReadHeadersInterceptor r = new ReadHeadersInterceptor();
+        ReadHeadersInterceptor r = new ReadHeadersInterceptor(BusFactory.getDefaultBus());
         try {
             r.handleMessage(soapMessage);
             fail("Did not throw exception");
@@ -78,14 +81,23 @@
         XMLStreamReader xmlReader = soapMessage.getContent(XMLStreamReader.class);
         assertEquals("check the first entry of body", "itinerary", xmlReader.getLocalName());
         
-        Element eleHeaders = soapMessage.getHeaders(Element.class);
+        List<Header> eleHeaders = soapMessage.getHeaders();
+        
         List<Element> headerChilds = new ArrayList<Element>();
-        for (int i = 0; i < eleHeaders.getChildNodes().getLength(); i++) {
-            if (eleHeaders.getChildNodes().item(i) instanceof Element) {
-                Element element = (Element)eleHeaders.getChildNodes().item(i);
-                headerChilds.add(element);
+        Iterator<Header> iter = eleHeaders.iterator();
+        while (iter.hasNext()) {
+            Header hdr = iter.next();
+
+            if (hdr.getObject() instanceof Element) {
+                headerChilds.add((Element) hdr.getObject());
             }
         }
+//        for (int i = 0; i < eleHeaders.getChildNodes().getLength(); i++) {
+//            if (eleHeaders.getChildNodes().item(i) instanceof Element) {
+//                Element element = (Element)eleHeaders.getChildNodes().item(i);
+//                headerChilds.add(element);
+//            }
+//        }
 
         assertEquals(2, headerChilds.size());
         for (int i = 0; i < headerChilds.size(); i++) {

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapOutInterceptorTest.java Fri May 11 10:59:35 2007
@@ -28,8 +28,7 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.w3c.dom.Element;
-
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor;
 import org.apache.cxf.interceptor.StaxInInterceptor;
@@ -45,11 +44,11 @@
         sii.setPhase("phase1");
         chain.add(sii);
 
-        rhi = new ReadHeadersInterceptor();
+        rhi = new ReadHeadersInterceptor(BusFactory.getDefaultBus());
         rhi.setPhase("phase2");
         chain.add(rhi);
 
-        soi = new SoapOutInterceptor();
+        soi = new SoapOutInterceptor(BusFactory.getDefaultBus());
         soi.setPhase("phase3");
         chain.add(soi);
     }
@@ -63,13 +62,14 @@
         
         soapMessage.getInterceptorChain().doIntercept(soapMessage);
         
-        assertNotNull(soapMessage.getHeaders(Element.class));
+        assertNotNull(soapMessage.getHeaders());
 
         Exception oe = (Exception)soapMessage.getContent(Exception.class);
         if (oe != null) {
             throw oe;
         }
 
+        System.out.println("out contains : " + out.toString());
         InputStream bis = new ByteArrayInputStream(out.toByteArray());
         XMLStreamReader xmlReader = StaxUtils.createXMLStreamReader(bis);
         assertInputStream(xmlReader);

Modified: incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java Fri May 11 10:59:35 2007
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.mail.util.ByteArrayDataSource;
@@ -29,10 +30,12 @@
 
 import org.w3c.dom.Element;
 
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.soap.Soap12;
 import org.apache.cxf.binding.soap.TestBase;
 import org.apache.cxf.binding.soap.TestUtil;
 import org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor;
+import org.apache.cxf.headers.Header;
 import org.apache.cxf.interceptor.StaxInInterceptor;
 
 
@@ -45,7 +48,7 @@
     public void setUp() throws Exception {
         super.setUp();
 
-        rhi = new ReadHeadersInterceptor();
+        rhi = new ReadHeadersInterceptor(BusFactory.getDefaultBus());
         rhi.setPhase("phase1");
         chain.add(rhi);
 
@@ -71,14 +74,23 @@
         XMLStreamReader xmlReader = soapMessage.getContent(XMLStreamReader.class);
         assertEquals("check the first entry of body", "itinerary", xmlReader.getLocalName());
 
-        Element eleHeaders = soapMessage.getHeaders(Element.class);
+        List<Header> eleHeaders = soapMessage.getHeaders();
         List<Element> headerChilds = new ArrayList<Element>();
-        for (int i = 0; i < eleHeaders.getChildNodes().getLength(); i++) {
-            if (eleHeaders.getChildNodes().item(i) instanceof Element) {
-                Element element = (Element)eleHeaders.getChildNodes().item(i);
-                headerChilds.add(element);
+        Iterator<Header> iter = eleHeaders.iterator();
+        
+        while (iter.hasNext()) {
+            Header hdr = iter.next();
+
+            if (hdr.getObject() instanceof Element) {
+                headerChilds.add((Element) hdr.getObject());
             }
         }
+//        for (int i = 0; i < eleHeaders.getChildNodes().getLength(); i++) {
+//            if (eleHeaders.getChildNodes().item(i) instanceof Element) {
+//                Element element = (Element)eleHeaders.getChildNodes().item(i);
+//                headerChilds.add(element);
+//            }
+//        }
 
         assertEquals(2, headerChilds.size());
     }

Added: incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/headers/HeaderManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/headers/HeaderManagerImpl.java?view=auto&rev=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/headers/HeaderManagerImpl.java (added)
+++ incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/headers/HeaderManagerImpl.java Fri May 11 10:59:35 2007
@@ -0,0 +1,57 @@
+/**
+ * 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.headers;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+import org.apache.cxf.Bus;
+
+public class HeaderManagerImpl implements HeaderManager {
+    Map<String, HeaderProcessor> processors = new ConcurrentHashMap<String, HeaderProcessor>();
+    Bus bus;  
+    
+    public Bus getBus() {
+        return bus;
+    }
+    
+    @Resource
+    public void setBus(Bus bus) {        
+        this.bus = bus;
+    }
+    
+    @PostConstruct
+    public void register() {
+        if (null != bus) {
+            bus.setExtension(this, HeaderManager.class);
+        }
+    }
+    
+    public HeaderProcessor getHeaderProcessor(String namespace) {
+        return processors.get(namespace);
+    }
+
+    public void registerHeaderProcessor(HeaderProcessor processor) {
+        processors.put(processor.getNamespace(), processor);
+    }
+
+}

Propchange: incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/headers/HeaderManagerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/branches/headerwork/rt/core/src/main/java/org/apache/cxf/headers/HeaderManagerImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/bus-extensions.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/bus-extensions.xml?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/bus-extensions.xml (original)
+++ incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/bus-extensions.xml Fri May 11 10:59:35 2007
@@ -39,5 +39,7 @@
        	   interface="org.apache.cxf.transports.http.QueryHandlerRegistry"/> 
     <extension class="org.apache.cxf.endpoint.EndpointResolverRegistryImpl"
        	   interface="org.apache.cxf.endpoint.EndpointResolverRegistry"/>
+    <extension class="org.apache.cxf.headers.HeaderManagerImpl"
+       	   interface="org.apache.cxf.headers.HeaderManager"/>
            
 </extensions>

Modified: incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/cxf/cxf.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/cxf/cxf.xml?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/cxf/cxf.xml (original)
+++ incubator/cxf/branches/headerwork/rt/core/src/main/resources/META-INF/cxf/cxf.xml Fri May 11 10:59:35 2007
@@ -99,4 +99,7 @@
     <bean id="org.apache.cxf.endpoint.EndpointResolverRegistry" class="org.apache.cxf.endpoint.EndpointResolverRegistryImpl">
         <property name="bus" ref="cxf"/>
     </bean>
+    <bean id="org.apache.cxf.headers.HeaderManager" class="org.apache.cxf.headers.HeaderManagerImpl">
+        <property name="bus" ref="cxf"/>
+    </bean>
 </beans>

Modified: incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java Fri May 11 10:59:35 2007
@@ -26,6 +26,7 @@
 
 import org.junit.After;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class AutomaticWorkQueueTest extends Assert {
@@ -326,6 +327,7 @@
     }
 
     @Test
+    @Ignore
     public void testShutdown() {
         workqueue = new AutomaticWorkQueueImpl(DEFAULT_MAX_QUEUE_SIZE, INITIAL_SIZE,
                                                INITIAL_SIZE, INITIAL_SIZE, 250);

Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPMessageContextImpl.java Fri May 11 10:59:35 2007
@@ -19,22 +19,20 @@
 
 package org.apache.cxf.jaxws.handler.soap;
 
-import java.util.ArrayList;
-import java.util.Collection;
+
+import java.util.List;
 import java.util.Set;
 
 import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.ws.handler.MessageContext;
 import javax.xml.ws.handler.soap.SOAPMessageContext;
 
-import org.w3c.dom.Element;
-
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
+import org.apache.cxf.headers.Header;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.XMLMessage;
@@ -80,25 +78,29 @@
 
     // TODO: handle the boolean parameter
     public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) {
-        Element headerElements = getWrappedSoapMessage().getHeaders(Element.class);
+//        Element headerElements = getWrappedSoapMessage().getHeaders(Element.class);
+        List<Header> headerElements = getWrappedSoapMessage().getHeaders();
         if (headerElements == null) {
             return null;
         }
-        Collection<Object> objects = new ArrayList<Object>();
-        for (int i = 0; i < headerElements.getChildNodes().getLength(); i++) {
-            if (headerElements.getChildNodes().item(i) instanceof Element) {
-                Element e = (Element)headerElements.getChildNodes().item(i);
-                if (name.equals(e.getNamespaceURI())) {
-                    try {
-                        objects.add(context.createUnmarshaller().unmarshal(e));
-                    } catch (JAXBException ex) {
-                        // do something
-                    }
-                }
-            }
-        }
-        Object[] headerObjects = new Object[objects.size()];
-        return objects.toArray(headerObjects);
+        
+        
+//        Collection<Object> objects = new ArrayList<Object>();
+//        for (int i = 0; i < headerElements.getChildNodes().getLength(); i++) {
+//            if (headerElements.getChildNodes().item(i) instanceof Element) {
+//                Element e = (Element)headerElements.getChildNodes().item(i);
+//                if (name.equals(e.getNamespaceURI())) {
+//                    try {
+//                        objects.add(context.createUnmarshaller().unmarshal(e));
+//                    } catch (JAXBException ex) {
+//                        // do something
+//                    }
+//                }
+//            }
+//        }
+//        Object[] headerObjects = new Object[objects.size()];
+//        return objects.toArray(headerObjects);
+        return headerElements.toArray();
     }
 
     public Set<String> getRoles() {

Modified: incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java Fri May 11 10:59:35 2007
@@ -58,6 +58,7 @@
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.SoapVersionFactory;
+import org.apache.cxf.headers.Header;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.io.AbstractCachedOutputStream;
@@ -231,8 +232,16 @@
         XMLStreamReader reader = preparemXMLStreamReader("resources/greetMeRpcLitReq.xml");
         message.setContent(XMLStreamReader.class, reader);
         Object[] headerInfo = preparemSOAPHeader();
-        message.setHeaders(Element.class, (Element) headerInfo[1]);
-        message.setContent(Node.class, (Document) headerInfo[0]);
+        
+        message.setContent(Node.class, headerInfo[0]);
+        
+        Node node = ((Element) headerInfo[1]).getChildNodes().item(0);
+        
+        Header hdr = new Header(new QName(node.getNamespaceURI(), node.getLocalName()), node);
+        message.getHeaders().add(hdr);
+        
+//        message.setHeaders(Element.class, (Element) headerInfo[1]);
+//        message.setContent(Node.class, (Document) headerInfo[0]);
         control.replay();
 
         SOAPHandlerInterceptor li = new SOAPHandlerInterceptor(binding);
@@ -253,11 +262,29 @@
         assertEquals("sendReceiveData", qn.getLocalPart());
         
         // Verify Header Element
-        Element element = message.getHeaders(Element.class);      
-        NodeList headerNodeList = element.getElementsByTagNameNS(
-            "http://apache.org/hello_world_rpclit/types", "header1");
-        Element headerElementNew1 = (Element)headerNodeList.item(0);
-        assertEquals("false", headerElementNew1.getAttributeNS(soapVersion.getNamespace(), "mustUnderstand"));
+        List<Header> header = message.getHeaders();
+        Iterator<Header> iter = header.iterator();
+        Element requiredHeader = null;
+        while (iter.hasNext()) {
+            Header localHdr = iter.next();
+            if (localHdr.getObject() instanceof Element) {
+                Element elem = (Element) localHdr.getObject();
+                if (elem.getNamespaceURI().equals("http://apache.org/hello_world_rpclit/types")
+                        && elem.getLocalName().equals("header1")) {
+                    requiredHeader = (Element) localHdr.getObject();
+                    break;                
+                }
+            }
+        }
+        
+        assertNotNull("Should have found header1", requiredHeader);
+        assertEquals("false", requiredHeader.getAttributeNS(soapVersion.getNamespace(), "mustUnderstand"));
+//        Element element = message.getHeaders(Element.class);      
+//        NodeList headerNodeList = element.getElementsByTagNameNS(
+//            "http://apache.org/hello_world_rpclit/types", "header1");
+//        Element headerElementNew1 = (Element)headerNodeList.item(0);
+//        assertEquals("false", headerElementNew1.getAttributeNS(
+//        soapVersion.getNamespace(), "mustUnderstand"));
     }
 
     public void testChangeSOAPHeaderOutBound() throws Exception {

Modified: incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java (original)
+++ incubator/cxf/branches/headerwork/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java Fri May 11 10:59:35 2007
@@ -19,10 +19,10 @@
 
 package org.apache.cxf.ws.addressing.soap;
 
-
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -37,16 +37,20 @@
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
+import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.headers.Header;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
@@ -141,13 +145,21 @@
             cacheExchange(message, maps);
             LOG.log(Level.INFO, "Outbound WS-Addressing headers");
             try {
-                Element header = message.getHeaders(Element.class);
+                List<Header> header = message.getHeaders();
                 discardMAPs(header, maps);
+//                List<Header> extraHdrs = new ArrayList<Header>();
+
+                Document doc = DOMUtils.createDocument();
+                SoapVersion version = Soap11.getInstance();
+                Element hdr = doc.createElementNS(version.getHeader().getNamespaceURI(), 
+                        version.getHeader().getLocalPart());
+                //ubhole: This doesn't seems to matter as marshaller will put the namespace.
+
                 // add WSA namespace declaration to header, instead of
                 // repeating in each individual child node
-                header.setAttributeNS("http://www.w3.org/2000/xmlns/",
-                                      "xmlns:" + Names.WSA_NAMESPACE_PREFIX,
-                                      maps.getNamespaceURI());
+//                header.setAttributeNS("http://www.w3.org/2000/xmlns/",
+//                                      "xmlns:" + Names.WSA_NAMESPACE_PREFIX,
+//                                      maps.getNamespaceURI());
                 JAXBContext jaxbContext = 
                     VersionTransformer.getExposedJAXBContext(
                                                      maps.getNamespaceURI());
@@ -157,38 +169,47 @@
                                 maps.getMessageID(), 
                                 Names.WSA_MESSAGEID_NAME,
                                 AttributedURIType.class, 
-                                header, 
+                                hdr, 
                                 marshaller);
                 encodeAsExposed(maps.getNamespaceURI(),
                                 maps.getTo(), 
                                 Names.WSA_TO_NAME,
                                 AttributedURIType.class,  
-                                header, 
+                                hdr, 
                                 marshaller);
                 encodeAsExposed(maps.getNamespaceURI(),
                                 maps.getReplyTo(), 
                                 Names.WSA_REPLYTO_NAME, 
                                 EndpointReferenceType.class,
-                                header,
+                                hdr,
                                 marshaller);
                 encodeAsExposed(maps.getNamespaceURI(),
                                 maps.getFaultTo(), 
                                 Names.WSA_FAULTTO_NAME, 
                                 EndpointReferenceType.class,
-                                header,
+                                hdr,
                                 marshaller);
                 encodeAsExposed(maps.getNamespaceURI(),
                                 maps.getRelatesTo(),
                                 Names.WSA_RELATESTO_NAME,
                                 RelatesToType.class,
-                                header,
+                                hdr,
                                 marshaller);
                 encodeAsExposed(maps.getNamespaceURI(),
                                 maps.getAction(), 
                                 Names.WSA_ACTION_NAME,
                                 AttributedURIType.class, 
-                                header, 
+                                hdr, 
                                 marshaller);
+
+                for (int i = 0; i < hdr.getChildNodes().getLength(); i++) {
+                    Node node = hdr.getChildNodes().item(i);
+                    Header holder = new Header(
+                            new QName(node.getNamespaceURI(), node.getLocalName()), 
+                            node);
+                    header.add(holder);
+                }
+                
                 encodeReferenceParameters(maps, header, marshaller);
                 propogateAction(maps.getAction(), message);
                 applyMAPValidation(message);
@@ -198,7 +219,7 @@
         }
     }
 
-    private void encodeReferenceParameters(AddressingProperties maps, Element header, 
+    private void encodeReferenceParameters(AddressingProperties maps, List<Header> header, 
                                            Marshaller marshaller) throws JAXBException {
         EndpointReferenceType toEpr = maps.getToEndpointReference();
         if (null != toEpr) {
@@ -216,10 +237,13 @@
                         } else {
                             jaxbEl = (JAXBElement) o;
                         }
+                        Element elem = null;
 
-                        marshaller.marshal(jaxbEl, header);
-                        Element lastAdded = (Element)header.getLastChild();
+                        marshaller.marshal(jaxbEl, elem);
+                        
+                        Element lastAdded = (Element)elem.getLastChild();
                         addIsReferenceParameterMarkerAttribute(lastAdded);
+                        header.add(new Header(jaxbEl.getName(), lastAdded.getChildNodes().item(0)));
                     } else {
                         LOG.log(Level.WARNING, "IGNORE_NON_ELEMENT_REF_PARAM_MSG", o);
                     }
@@ -278,16 +302,19 @@
         // expected header is missing 
         AddressingPropertiesImpl maps = null;
         try {
-            Element header = message.getHeaders(Element.class);
+            List<Header> header = message.getHeaders();
             if (header != null) {
                 LOG.log(Level.INFO, "Inbound WS-Addressing headers");
                 Unmarshaller unmarshaller = null;
                 Set<Element> referenceParameterHeaders = null;
-                NodeList headerElements = header.getChildNodes();
-                int headerCount = headerElements.getLength();
-                for (int i = 0; i < headerCount; i++) {
-                    if (headerElements.item(i) instanceof Element) {
-                        Element headerElement = (Element)headerElements.item(i);
+//                NodeList headerElements = header.getChildNodes();
+//                int headerCount = headerElements.getLength();
+//                for (int i = 0; i < headerCount; i++) {
+                Iterator<Header> iter = header.iterator();
+                while (iter.hasNext()) {
+                    Header hdr = iter.next();
+                    if (hdr.getObject() instanceof Element) {
+                        Element headerElement = (Element)hdr.getObject();
                         String headerURI = headerElement.getNamespaceURI();
                         if (unmarshaller == null) {
                             JAXBContext jaxbContext = 
@@ -453,6 +480,7 @@
                                  Marshaller marshaller) throws JAXBException {
         if (value != null) {
             marshaller.marshal(new JAXBElement<T>(qname, clz, value), header);
+            System.out.println("Last header child is : " + header.getLastChild());
         }
     }
 
@@ -479,7 +507,15 @@
      * @param header the SOAP header
      * @param maps the current MAPs
      */
-    private void discardMAPs(Element header, AddressingProperties maps) {
+    private void discardMAPs(List<Header> header, AddressingProperties maps) {
+        Iterator<Header> iter = header.iterator();
+        while (iter.hasNext()) {
+            Header hdr = iter.next();
+            if (Names.WSA_NAMESPACE_NAME.equals(hdr.getName().getNamespaceURI())) {
+                iter.remove();
+            }
+        }
+        /*
         NodeList headerElements =
             header.getElementsByTagNameNS(maps.getNamespaceURI(), "*");        
         for (int i = 0; i < headerElements.getLength(); i++) {
@@ -487,7 +523,7 @@
             if (Names.WSA_NAMESPACE_NAME.equals(headerElement.getNamespaceURI())) {
                 header.removeChild(headerElement);
             }
-        }
+        } */
     }
 
     /**

Modified: incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java?view=diff&rev=537250&r1=537249&r2=537250
==============================================================================
--- incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java (original)
+++ incubator/cxf/branches/headerwork/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java Fri May 11 10:59:35 2007
@@ -39,6 +39,7 @@
 
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.headers.Header;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
@@ -243,7 +244,8 @@
         String mapProperty = getMAPProperty(requestor, outbound);
         AddressingPropertiesImpl maps = getMAPs(requestor, outbound, exposeAs);
         Element header = control.createMock(Element.class);
-        message.setHeaders(Element.class, header);
+//        message.setHeaders(Element.class, header);
+//        List<Header> header = message.getHeaders();
         JAXBContext jaxbContext = control.createMock(JAXBContext.class);
         ContextUtils.setJAXBContext(jaxbContext);
         VersionTransformer.Names200408.setJAXBContext(jaxbContext);
@@ -256,7 +258,8 @@
                         invalidMAP,
                         preExistingSOAPAction);
         } else {
-            setUpDecode(message, header, maps, mapProperty, requestor);
+            List<Header> hdr = message.getHeaders();
+            setUpDecode(message, hdr, maps, mapProperty, requestor);
         }
         control.replay();
         return message;
@@ -270,16 +273,16 @@
                              boolean invalidMAP,
                              boolean preExistingSOAPAction) throws Exception { 
         message.put(mapProperty, maps);
-        NodeList headerElements = control.createMock(NodeList.class);
-        header.getElementsByTagNameNS(EasyMock.eq(maps.getNamespaceURI()),
-                                      EasyMock.eq("*"));
-        EasyMock.expectLastCall().andReturn(headerElements);
-        headerElements.getLength();
-        EasyMock.expectLastCall().andReturn(0);
-        header.setAttributeNS(EasyMock.eq("http://www.w3.org/2000/xmlns/"),
-                              EasyMock.eq("xmlns:" + Names.WSA_NAMESPACE_PREFIX),
-                              EasyMock.eq(maps.getNamespaceURI()));
-        EasyMock.expectLastCall();
+//        NodeList headerElements = control.createMock(NodeList.class);
+//        header.getElementsByTagNameNS(EasyMock.eq(maps.getNamespaceURI()),
+//                                      EasyMock.eq("*"));
+//        EasyMock.expectLastCall().andReturn(headerElements);
+//        headerElements.getLength();
+//        EasyMock.expectLastCall().andReturn(0);
+//        header.setAttributeNS(EasyMock.eq("http://www.w3.org/2000/xmlns/"),
+//                              EasyMock.eq("xmlns:" + Names.WSA_NAMESPACE_PREFIX),
+//                              EasyMock.eq(maps.getNamespaceURI()));
+//        EasyMock.expectLastCall();
         Marshaller marshaller = control.createMock(Marshaller.class);
         ContextUtils.getJAXBContext().createMarshaller();
         EasyMock.expectLastCall().andReturn(marshaller);
@@ -291,6 +294,9 @@
                                : expectedValues.length;
         for (int i = 0; i < expectedMarshals; i++) {
             EasyMock.reportMatcher(matcher);
+            
+            
+//            Element elem = null;
             EasyMock.eq(header);
             marshaller.marshal(null, header);
             EasyMock.expectLastCall();
@@ -311,7 +317,7 @@
     }
     
     private void setUpDecode(SoapMessage message, 
-                             Element header,
+                             List<Header> header,
                              AddressingPropertiesImpl maps,
                              String mapProperty,
                              boolean requestor) throws Exception {
@@ -319,7 +325,7 @@
         ContextUtils.getJAXBContext().createUnmarshaller();
         EasyMock.expectLastCall().andReturn(unmarshaller);
         NodeList headerElements = control.createMock(NodeList.class);
-        header.getChildNodes();
+//        header.getChildNodes();
         EasyMock.expectLastCall().andReturn(headerElements);
         String uri = maps.getNamespaceURI();
         boolean exposedAsNative = Names.WSA_NAMESPACE_NAME.equals(uri);
@@ -512,6 +518,7 @@
             Object value = expectedValues[expectedIndex];
             boolean ret = false;
             expectedIndex++;
+            System.out.println("Expected index is : " + expectedIndex);
             if (expectedIndex == 5 && !expectRelatesTo) {
                 return true;
             }



Mime
View raw message