You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2013/07/28 12:05:08 UTC

svn commit: r1507775 - in /webservices/axiom/trunk: axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/ axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/ axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/ axiom-spring-ws/s...

Author: veithen
Date: Sun Jul 28 10:05:07 2013
New Revision: 1507775

URL: http://svn.apache.org/r1507775
Log:
* AXIOM-447 - Iteration 2: Added a WS-Addressing test scenario and implemented the necessary methods (for SOAP 1.1 and 1.2).
* Added a convenience method to SOAPHeader to create a SOAPHeaderBlock from a QName.

Added:
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategy.java
      - copied, changed from r1507596, webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategy.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyInvocationHandler.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyStack.java
      - copied, changed from r1507596, webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategyStack.java
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/EchoEndpoint.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/WSAddressingDOMTest.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/
    webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/client.xml   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/server.xml   (with props)
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQName.java   (with props)
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQNameWithoutNamespace.java   (with props)
Removed:
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/MethodProcessorProxy.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategy.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategyStack.java
Modified:
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomOptimizationEnabler.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomWebServiceMessage.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/PoxMessageImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap11HeaderImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap12HeaderImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapBodyImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapElementImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementIterator.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/CalculatorEndpoint.java
    webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java
    webservices/axiom/trunk/axiom-spring-ws/src/test/resources/log4j.properties
    webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomOptimizationEnabler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomOptimizationEnabler.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomOptimizationEnabler.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomOptimizationEnabler.java Sun Jul 28 10:05:07 2013
@@ -18,8 +18,12 @@
  */
 package org.apache.axiom.spring.ws;
 
+import java.lang.reflect.Proxy;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.axiom.spring.ws.server.endpoint.mapping.AxiomPayloadRootAnnotationMethodEndpointMapping;
 import org.apache.commons.logging.Log;
@@ -29,21 +33,24 @@ import org.springframework.beans.factory
 import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
 import org.springframework.beans.factory.config.BeanPostProcessor;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.core.PriorityOrdered;
 import org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResolver;
+import org.springframework.ws.server.endpoint.adapter.method.dom.DomPayloadMethodProcessor;
 import org.springframework.ws.server.endpoint.adapter.method.dom.JDomPayloadMethodProcessor;
 import org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping;
+import org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping;
 
 /**
  * Post processor that adjusts the bean configurations to enable some Axiom specific optimizations.
  * <p>
- * Its primary responsibility is to associate particular {@link PayloadAccessStrategy} instances
+ * Its primary responsibility is to associate particular {@link SourceExtractionStrategy} instances
  * with different types of {@link MethodArgumentResolver} [TODO: etc.] beans. For these beans, it
- * then creates proxy instances that configure the {@link PayloadAccessStrategy} using
- * {@link AxiomWebServiceMessage#pushPayloadAccessStrategy(PayloadAccessStrategy, Object)} and
- * {@link AxiomWebServiceMessage#popPayloadAccessStrategy(Object)}.
+ * then creates proxy instances that configure the {@link SourceExtractionStrategy} using
+ * {@link AxiomWebServiceMessage#pushSourceExtractionStrategy(SourceExtractionStrategy, Object)} and
+ * {@link AxiomWebServiceMessage#popSourceExtractionStrategy(Object)}.
  * <p>
  * The following table describes the supported bean types and the corresponding
- * {@link PayloadAccessStrategy}:
+ * {@link SourceExtractionStrategy}:
  * <table border="2" rules="all" cellpadding="4" cellspacing="0">
  * <tr>
  * <th>Bean type
@@ -51,7 +58,15 @@ import org.springframework.ws.server.end
  * </tr>
  * <tr>
  * <td>{@link JDomPayloadMethodProcessor}
- * <td>{@link PayloadAccessStrategy#SAX_CONSUME}
+ * <td>{@link SourceExtractionStrategy#SAX_CONSUME}
+ * </tr>
+ * <tr>
+ * <td>{@link DomPayloadMethodProcessor}
+ * <td>{@link SourceExtractionStrategy#DOM_OR_SAX_CONSUME}
+ * </tr>
+ * <tr>
+ * <td>{@link AnnotationActionEndpointMapping}
+ * <td>{@link SourceExtractionStrategy#DOM_OR_SAX_PRESERVE}
  * </tr>
  * </table>
  * <p>
@@ -64,7 +79,7 @@ import org.springframework.ws.server.end
  * {@link AxiomPayloadRootAnnotationMethodEndpointMapping} beans.
  * </ul>
  */
-public class AxiomOptimizationEnabler implements BeanFactoryPostProcessor, BeanPostProcessor {
+public class AxiomOptimizationEnabler implements BeanFactoryPostProcessor, BeanPostProcessor, PriorityOrdered {
     private static final Log log = LogFactory.getLog(AxiomOptimizationEnabler.class);
     
     private static final Map<String,String> replacementClasses;
@@ -97,9 +112,36 @@ public class AxiomOptimizationEnabler im
     public Object postProcessAfterInitialization(Object bean, String beanName)
             throws BeansException {
         if (bean instanceof JDomPayloadMethodProcessor) {
-            return new MethodProcessorProxy(bean, PayloadAccessStrategy.SAX_CONSUME);
+            return createSourceExtractionStrategyProxy(bean, beanName, SourceExtractionStrategy.SAX_CONSUME);
+        } else if (bean instanceof DomPayloadMethodProcessor) {
+            return createSourceExtractionStrategyProxy(bean, beanName, SourceExtractionStrategy.DOM_OR_SAX_CONSUME);
+        } else if (bean instanceof AnnotationActionEndpointMapping) {
+            return createSourceExtractionStrategyProxy(bean, beanName, SourceExtractionStrategy.DOM_OR_SAX_PRESERVE);
         } else {
             return bean;
         }
     }
+    
+    private Object createSourceExtractionStrategyProxy(Object bean, String beanName, SourceExtractionStrategy strategy) {
+        if (log.isDebugEnabled()) {
+            log.debug("Creating proxy to associate extraction strategy " + strategy + " with bean " + beanName);
+        }
+        Set<Class<?>> ifaces = new HashSet<Class<?>>();
+        collectInterfaces(bean.getClass(), ifaces);
+        return Proxy.newProxyInstance(AxiomOptimizationEnabler.class.getClassLoader(), ifaces.toArray(new Class<?>[ifaces.size()]),
+                new SourceExtractionStrategyInvocationHandler(bean, beanName, strategy));
+    }
+    
+    private void collectInterfaces(Class<?> clazz, Set<Class<?>> ifaces) {
+        ifaces.addAll(Arrays.asList(clazz.getInterfaces()));
+        Class<?> superClass = clazz.getSuperclass();
+        if (superClass != Object.class) {
+            collectInterfaces(superClass, ifaces);
+        }
+    }
+
+    // This is here to ensure that this bean post processor is executed before AnnotationActionEndpointMapping
+    public int getOrder() {
+        return 0;
+    }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomWebServiceMessage.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomWebServiceMessage.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomWebServiceMessage.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/AxiomWebServiceMessage.java Sun Jul 28 10:05:07 2013
@@ -26,6 +26,7 @@ import org.apache.axiom.spring.ws.soap.A
 import org.springframework.ws.WebServiceMessage;
 import org.springframework.ws.server.endpoint.support.PayloadRootUtils;
 import org.springframework.ws.soap.SoapBody;
+import org.springframework.ws.soap.SoapElement;
 
 /**
  * Interface implemented by {@link WebServiceMessage} instances created by
@@ -43,11 +44,12 @@ public interface AxiomWebServiceMessage 
     QName getPayloadRootQName();
     
     /**
-     * Set the payload access strategy used in subsequent calls to
-     * {@link WebServiceMessage#getPayloadSource()} and {@link SoapBody#getPayloadSource()}. The
-     * strategy is pushed to a stack and will be in effect as long as it is on top of the stack,
-     * i.e. until the next call to {@link #pushPayloadAccessStrategy(PayloadAccessStrategy, Object)}
-     * or {@link #popPayloadAccessStrategy(Object)}.
+     * Set the extraction strategy used in subsequent calls to
+     * {@link WebServiceMessage#getPayloadSource()}, {@link SoapBody#getPayloadSource()} and
+     * {@link SoapElement#getSource()}. The strategy is pushed to a stack and will be in effect as
+     * long as it is on top of the stack, i.e. until the next call to
+     * {@link #pushSourceExtractionStrategy(SourceExtractionStrategy, Object)} or
+     * {@link #popSourceExtractionStrategy(Object)}.
      * <p>
      * Note: this method is used internally; it is not expected to be called by application code.
      * 
@@ -56,20 +58,20 @@ public interface AxiomWebServiceMessage 
      * @param bean
      *            the bean on behalf of which the strategy is configured; this information is only
      *            used for logging and to detect missing or unexpected calls to
-     *            {@link #popPayloadAccessStrategy(Object)}
+     *            {@link #popSourceExtractionStrategy(Object)}
      */
-    void pushPayloadAccessStrategy(PayloadAccessStrategy strategy, Object bean);
+    void pushSourceExtractionStrategy(SourceExtractionStrategy strategy, Object bean);
     
     /**
-     * Restore the previous payload access strategy. This method removes the top of the stack so
-     * that the previous strategy again comes into effect.
+     * Restore the previous extraction strategy. This method removes the top of the stack so that
+     * the previous strategy again comes into effect.
      * 
      * @param bean
-     *            the bean corresponding to the current payload access strategy (i.e. the strategy
-     *            on top of the stack); must match the reference passed to the corresponding call to
-     *            {@link #pushPayloadAccessStrategy(PayloadAccessStrategy, Object)}.
+     *            the bean corresponding to the current extraction strategy (i.e. the strategy on
+     *            top of the stack); must match the reference passed to the corresponding call to
+     *            {@link #pushSourceExtractionStrategy(SourceExtractionStrategy, Object)}.
      * @throws IllegalStateException
      *             if the stack is empty or if the caller didn't pass the expected bean
      */
-    void popPayloadAccessStrategy(Object bean);
+    void popSourceExtractionStrategy(Object bean);
 }

Copied: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategy.java (from r1507596, webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategy.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategy.java?p2=webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategy.java&p1=webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategy.java&r1=1507596&r2=1507775&rev=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategy.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategy.java Sun Jul 28 10:05:07 2013
@@ -25,12 +25,14 @@ import javax.xml.transform.sax.SAXSource
 import org.apache.axiom.om.OMContainer;
 import org.springframework.ws.WebServiceMessage;
 import org.springframework.ws.soap.SoapBody;
+import org.springframework.ws.soap.SoapElement;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
 /**
- * Strategy interface for {@link WebServiceMessage#getPayloadSource()} and
- * {@link SoapBody#getPayloadSource()}.
+ * Strategy interface for {@link WebServiceMessage#getPayloadSource()},
+ * {@link SoapBody#getPayloadSource()} and {@link SoapElement#getSource()}.
  * <p>
  * Axiom supports several methods to transform an {@link OMContainer} object into a representation
  * based on a different API. E.g.:
@@ -48,30 +50,31 @@ import org.w3c.dom.Element;
  * model has been built before).
  * <p>
  * It is clear that depending on the use case, the choice of the method to use may have significant
- * impact on performance. On the other hand, Spring-WS defines a single API to retrieve the message
- * payload, namely {@link WebServiceMessage#getPayloadSource()} (which delegates to
- * {@link SoapBody#getPayloadSource()} for SOAP messages). That method is expected to return a
- * {@link Source} object, but it neither allows the caller to specify a preference for the type of
- * {@link Source} object ({@link DOMSource}, {@link SAXSource}, etc.). nor to indicate whether the
- * payload may be consumed or needs to be preserved for subsequent calls to
- * {@link WebServiceMessage#getPayloadSource()}.
+ * impact on performance. On the other hand, Spring-WS defines only very simple APIs to retrieve the
+ * message payload ({@link WebServiceMessage#getPayloadSource()}, which delegates to
+ * {@link SoapBody#getPayloadSource()} for SOAP messages) or part of a SOAP message (
+ * {@link SoapElement#getSource()}). These methods are expected to return {@link Source} objects,
+ * but they neither allow the caller to specify a preference for the type of {@link Source} object
+ * ({@link DOMSource}, {@link SAXSource}, etc.). nor to indicate whether the requested part of the
+ * message may be consumed or needs to be preserved for later.
  * <p>
  * This interface allows to define specific strategies that
- * {@link WebServiceMessage#getPayloadSource()} can use to prepare the {@link Source} object for the
- * message payload. A particular strategy can then be temporarily associated with a given
- * {@link WebServiceMessage} using
- * {@link AxiomWebServiceMessage#pushPayloadAccessStrategy(PayloadAccessStrategy, Object)} and
- * {@link AxiomWebServiceMessage#popPayloadAccessStrategy(Object)}. Note that application code is
+ * {@link WebServiceMessage#getPayloadSource()}, {@link SoapBody#getPayloadSource()} and
+ * {@link SoapElement#getSource()} can use to prepare the requested {@link Source} object. A
+ * particular strategy can then be temporarily associated with a given {@link WebServiceMessage}
+ * using
+ * {@link AxiomWebServiceMessage#pushSourceExtractionStrategy(SourceExtractionStrategy, Object)} and
+ * {@link AxiomWebServiceMessage#popSourceExtractionStrategy(Object)}. Note that application code is
  * not expected to use these methods directly. Instead it should configure a
  * {@link AxiomOptimizationEnabler} bean to automatically associate strategies with particular bean
  * type.
  */
-public interface PayloadAccessStrategy {
+public interface SourceExtractionStrategy {
     /**
-     * Payload access strategy that uses {@link OMContainer#getSAXSource(boolean)} with
+     * Extraction strategy that uses {@link OMContainer#getSAXSource(boolean)} with
      * <code>cache</code> set to <code>true</code>.
      */
-    PayloadAccessStrategy SAX_PRESERVE = new PayloadAccessStrategy() {
+    SourceExtractionStrategy SAX_PRESERVE = new SourceExtractionStrategy() {
         public Source getSource(OMContainer container) {
             return container.getSAXSource(true);
         }
@@ -83,10 +86,10 @@ public interface PayloadAccessStrategy {
     };
     
     /**
-     * Payload access strategy that uses {@link OMContainer#getSAXSource(boolean)} with
+     * Extraction strategy that uses {@link OMContainer#getSAXSource(boolean)} with
      * <code>cache</code> set to <code>false</code>.
      */
-    PayloadAccessStrategy SAX_CONSUME = new PayloadAccessStrategy() {
+    SourceExtractionStrategy SAX_CONSUME = new SourceExtractionStrategy() {
         public Source getSource(OMContainer container) {
             return container.getSAXSource(false);
         }
@@ -98,12 +101,51 @@ public interface PayloadAccessStrategy {
     };
     
     /**
-     * The default payload access strategy, {@link #SAX_PRESERVE}.
-     * {@link WebServiceMessage#getPayloadSource()} uses this default strategy if no strategy has
-     * been set explicitly using
-     * {@link AxiomWebServiceMessage#pushPayloadAccessStrategy(PayloadAccessStrategy, Object)}.
+     * Extraction strategy that creates a {@link DOMSource} if the Axiom implementation supports DOM
+     * and falls back to {@link #SAX_PRESERVE} otherwise.
      */
-    PayloadAccessStrategy DEFAULT = SAX_PRESERVE;
+    SourceExtractionStrategy DOM_OR_SAX_PRESERVE = new SourceExtractionStrategy() {
+        public Source getSource(OMContainer container) {
+            if (container instanceof Node) {
+                return new DOMSource((Node)container);
+            } else {
+                return SAX_PRESERVE.getSource(container);
+            }
+        }
+
+        @Override
+        public String toString() {
+            return "DOM_OR_SAX_PRESERVE";
+        }
+    };
+    
+    /**
+     * Extraction strategy that creates a {@link DOMSource} if the Axiom implementation supports DOM
+     * and falls back to {@link #SAX_CONSUME} otherwise.
+     */
+    SourceExtractionStrategy DOM_OR_SAX_CONSUME = new SourceExtractionStrategy() {
+        public Source getSource(OMContainer container) {
+            if (container instanceof Node) {
+                return new DOMSource((Node)container);
+            } else {
+                return SAX_CONSUME.getSource(container);
+            }
+        }
+
+        @Override
+        public String toString() {
+            return "DOM_OR_SAX_CONSUME";
+        }
+    };
+    
+    /**
+     * The default extraction strategy, {@link #SAX_PRESERVE}.
+     * {@link WebServiceMessage#getPayloadSource()}, {@link SoapBody#getPayloadSource()} and
+     * {@link SoapElement#getSource()} use this default strategy if no strategy has been set
+     * explicitly using
+     * {@link AxiomWebServiceMessage#pushSourceExtractionStrategy(SourceExtractionStrategy, Object)}.
+     */
+    SourceExtractionStrategy DEFAULT = SAX_PRESERVE;
 
     /**
      * Create a {@link Source} object for the given {@link OMContainer}.

Added: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyInvocationHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyInvocationHandler.java?rev=1507775&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyInvocationHandler.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyInvocationHandler.java Sun Jul 28 10:05:07 2013
@@ -0,0 +1,66 @@
+/*
+ * 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.axiom.spring.ws;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.springframework.ws.WebServiceMessage;
+import org.springframework.ws.context.MessageContext;
+
+final class SourceExtractionStrategyInvocationHandler implements InvocationHandler {
+    private final Object bean;
+    private final String beanName;
+    private final SourceExtractionStrategy strategy;
+    
+    SourceExtractionStrategyInvocationHandler(Object bean, String beanName, SourceExtractionStrategy strategy) {
+        this.bean = bean;
+        this.beanName = beanName;
+        this.strategy = strategy;
+    }
+
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        AxiomWebServiceMessage message = null;
+        if (args != null) {
+            for (Object arg : args) {
+                if (arg instanceof MessageContext) {
+                    WebServiceMessage candidateMessage = ((MessageContext)arg).getRequest();
+                    if (candidateMessage instanceof AxiomWebServiceMessage) {
+                        message = (AxiomWebServiceMessage)candidateMessage;
+                    }
+                    break;
+                }
+            }
+        }
+        if (message != null) {
+            // Use the beanName here (instead of bean) to improve logging
+            message.pushSourceExtractionStrategy(strategy, beanName);
+        }
+        try {
+            return method.invoke(bean, args);
+        } catch (InvocationTargetException ex) {
+            throw ex.getCause();
+        } finally {
+            if (message != null) {
+                message.popSourceExtractionStrategy(beanName);
+            }
+        }
+    }
+}

Propchange: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyInvocationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyStack.java (from r1507596, webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategyStack.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyStack.java?p2=webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyStack.java&p1=webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategyStack.java&r1=1507596&r2=1507775&rev=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategyStack.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/SourceExtractionStrategyStack.java Sun Jul 28 10:05:07 2013
@@ -23,26 +23,26 @@ import org.apache.commons.logging.LogFac
 
 /**
  * Helper class for implementations of
- * {@link AxiomWebServiceMessage#pushPayloadAccessStrategy(PayloadAccessStrategy, Object)} and
- * {@link AxiomWebServiceMessage#popPayloadAccessStrategy(Object)}.
+ * {@link AxiomWebServiceMessage#pushSourceExtractionStrategy(SourceExtractionStrategy, Object)} and
+ * {@link AxiomWebServiceMessage#popSourceExtractionStrategy(Object)}.
  * <p>
  * Note: this class is used internally; it is not expected to be used by application code.
  */
-public final class PayloadAccessStrategyStack {
-    private static final Log log = LogFactory.getLog(PayloadAccessStrategyStack.class);
+public final class SourceExtractionStrategyStack {
+    private static final Log log = LogFactory.getLog(SourceExtractionStrategyStack.class);
     
-    private PayloadAccessStrategy[] strategies = new PayloadAccessStrategy[4];
+    private SourceExtractionStrategy[] strategies = new SourceExtractionStrategy[4];
     private Object[] beans = new Object[4];
     private int top = -1;
     
-    public void push(PayloadAccessStrategy strategy, Object bean) {
+    public void push(SourceExtractionStrategy strategy, Object bean) {
         if (log.isDebugEnabled()) {
-            log.debug("Set payload access strategy " + strategy + " for bean " + bean);
+            log.debug("Set Source extraction strategy " + strategy + " for bean " + bean);
         }
         top++;
         int capacity = strategies.length;
         if (top == capacity) {
-            PayloadAccessStrategy[] newStrategies = new PayloadAccessStrategy[capacity*2];
+            SourceExtractionStrategy[] newStrategies = new SourceExtractionStrategy[capacity*2];
             System.arraycopy(strategies, 0, newStrategies, 0, capacity);
             strategies = newStrategies;
             Object[] newBeans = new Object[capacity*2];
@@ -60,14 +60,19 @@ public final class PayloadAccessStrategy
         top--;
         if (log.isDebugEnabled()) {
             if (top == -1) {
-                log.debug("Restored default payload access strategy");
+                log.debug("Restored default strategy");
             } else {
-                log.debug("Restored payload access strategy " + strategies[top] + " for bean " + beans[top]);
+                log.debug("Restored strategy " + strategies[top] + " for bean " + beans[top]);
             }
         }
     }
     
-    public PayloadAccessStrategy getCurrent() {
-        return top == -1 ? PayloadAccessStrategy.DEFAULT : strategies[top];
+    public SourceExtractionStrategy getCurrent() {
+        if (top == -1) {
+            log.debug("Stack is empty; returning default strategy");
+            return SourceExtractionStrategy.DEFAULT;
+        } else {
+            return strategies[top];
+        }
     }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/PoxMessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/PoxMessageImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/PoxMessageImpl.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/PoxMessageImpl.java Sun Jul 28 10:05:07 2013
@@ -26,11 +26,11 @@ import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 
 import org.apache.axiom.spring.ws.AxiomWebServiceMessage;
-import org.apache.axiom.spring.ws.PayloadAccessStrategy;
-import org.apache.axiom.spring.ws.PayloadAccessStrategyStack;
+import org.apache.axiom.spring.ws.SourceExtractionStrategy;
+import org.apache.axiom.spring.ws.SourceExtractionStrategyStack;
 
 final class PoxMessageImpl implements AxiomWebServiceMessage {
-    private final PayloadAccessStrategyStack payloadAccessStrategyStack = new PayloadAccessStrategyStack();
+    private final SourceExtractionStrategyStack extractionStrategyStack = new SourceExtractionStrategyStack();
     
     public Source getPayloadSource() {
         // TODO
@@ -52,11 +52,11 @@ final class PoxMessageImpl implements Ax
         throw new UnsupportedOperationException();
     }
 
-    public void pushPayloadAccessStrategy(PayloadAccessStrategy strategy, Object bean) {
-        payloadAccessStrategyStack.push(strategy, bean);
+    public void pushSourceExtractionStrategy(SourceExtractionStrategy strategy, Object bean) {
+        extractionStrategyStack.push(strategy, bean);
     }
 
-    public void popPayloadAccessStrategy(Object bean) {
-        payloadAccessStrategyStack.pop(bean);
+    public void popSourceExtractionStrategy(Object bean) {
+        extractionStrategyStack.pop(bean);
     }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap11HeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap11HeaderImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap11HeaderImpl.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap11HeaderImpl.java Sun Jul 28 10:05:07 2013
@@ -18,37 +18,19 @@
  */
 package org.apache.axiom.spring.ws.soap;
 
-import java.util.Arrays;
 import java.util.Iterator;
-import java.util.List;
 
-import org.apache.axiom.soap.RolePlayer;
 import org.apache.axiom.soap.SOAPHeader;
 import org.springframework.ws.soap.SoapHeaderElement;
 import org.springframework.ws.soap.SoapHeaderException;
 import org.springframework.ws.soap.soap11.Soap11Header;
 
 final class Soap11HeaderImpl extends SoapHeaderImpl implements Soap11Header {
-    Soap11HeaderImpl(SOAPHeader axiomNode) {
-        super(axiomNode);
+    Soap11HeaderImpl(SoapMessageImpl message, SOAPHeader axiomNode) {
+        super(message, axiomNode);
     }
 
     public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] actors) throws SoapHeaderException {
-        RolePlayer rolePlayer;
-        if (actors == null) {
-            rolePlayer = null;
-        } else {
-            final List<String> roles = Arrays.asList(actors);
-            rolePlayer = new RolePlayer() {
-                public List<?> getRoles() {
-                    return roles;
-                }
-    
-                public boolean isUltimateDestination() {
-                    return false;
-                }
-            };
-        }
-        return new SoapHeaderElementIterator(axiomNode.getHeadersToProcess(rolePlayer));
+        return internalExamineHeaderElementsToProcess(actors, false);
     }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap12HeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap12HeaderImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap12HeaderImpl.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/Soap12HeaderImpl.java Sun Jul 28 10:05:07 2013
@@ -28,8 +28,8 @@ import org.springframework.ws.soap.SoapH
 import org.springframework.ws.soap.soap12.Soap12Header;
 
 final class Soap12HeaderImpl extends SoapHeaderImpl implements Soap12Header {
-    Soap12HeaderImpl(SOAPHeader axiomNode) {
-        super(axiomNode);
+    Soap12HeaderImpl(SoapMessageImpl message, SOAPHeader axiomNode) {
+        super(message, axiomNode);
     }
 
     public SoapHeaderElement addNotUnderstoodHeaderElement(QName headerName) {
@@ -43,7 +43,6 @@ final class Soap12HeaderImpl extends Soa
     }
 
     public Iterator<SoapHeaderElement> examineHeaderElementsToProcess(String[] roles, boolean isUltimateReceiver) throws SoapHeaderException {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        return internalExamineHeaderElementsToProcess(roles, isUltimateReceiver);
     }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapBodyImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapBodyImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapBodyImpl.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapBodyImpl.java Sun Jul 28 10:05:07 2013
@@ -24,7 +24,7 @@ import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 
 import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.spring.ws.PayloadAccessStrategy;
+import org.apache.axiom.spring.ws.SourceExtractionStrategy;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.ws.soap.SoapBody;
@@ -34,15 +34,12 @@ import org.springframework.ws.soap.SoapF
 final class SoapBodyImpl extends SoapElementImpl<SOAPBody> implements SoapBody {
     private static final Log log = LogFactory.getLog(SoapBodyImpl.class);
     
-    private final SoapEnvelopeImpl parent;
-    
-    SoapBodyImpl(SoapEnvelopeImpl parent, SOAPBody axiomNode) {
-        super(axiomNode);
-        this.parent = parent;
+    SoapBodyImpl(SoapMessageImpl message, SOAPBody axiomNode) {
+        super(message, axiomNode);
     }
 
     public Source getPayloadSource() {
-        PayloadAccessStrategy strategy = parent.getParent().getPayloadAccessStrategy();
+        SourceExtractionStrategy strategy = getSourceExtractionStrategy();
         if (log.isDebugEnabled()) {
             log.debug("Returning payload using strategy " + strategy);
         }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapElementImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapElementImpl.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapElementImpl.java Sun Jul 28 10:05:07 2013
@@ -24,26 +24,43 @@ import javax.xml.namespace.QName;
 import javax.xml.transform.Source;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.spring.ws.SourceExtractionStrategy;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.springframework.ws.soap.SoapElement;
 
 abstract class SoapElementImpl<T extends OMElement> implements SoapElement {
+    private static final Log log = LogFactory.getLog(SoapElementImpl.class);
+    
+    private final SoapMessageImpl message;
     final T axiomNode;
 
-    SoapElementImpl(T axiomNode) {
+    SoapElementImpl(SoapMessageImpl message, T axiomNode) {
         if (axiomNode == null) {
             throw new IllegalArgumentException();
         }
+        this.message = message;
         this.axiomNode = axiomNode;
     }
+    
+    final SoapMessageImpl getMessage() {
+        return message;
+    }
 
-    public QName getName() {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+    final SourceExtractionStrategy getSourceExtractionStrategy() {
+        return message.getSourceExtractionStrategy();
+    }
+    
+    public final QName getName() {
+        return axiomNode.getQName();
     }
 
-    public Source getSource() {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+    public final Source getSource() {
+        SourceExtractionStrategy strategy = getSourceExtractionStrategy();
+        if (log.isDebugEnabled()) {
+            log.debug("Returning Source for " + getClass().getSimpleName() + " using strategy " + strategy);
+        }
+        return strategy.getSource(axiomNode);
     }
 
     public void addAttribute(QName name, String value) {
@@ -66,8 +83,11 @@ abstract class SoapElementImpl<T extends
         throw new UnsupportedOperationException();
     }
 
-    public void addNamespaceDeclaration(String prefix, String namespaceUri) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+    public final void addNamespaceDeclaration(String prefix, String namespaceUri) {
+        if (prefix == null || prefix.length() == 0) {
+            axiomNode.declareDefaultNamespace(namespaceUri);
+        } else {
+            axiomNode.declareNamespace(namespaceUri, prefix);
+        }
     }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java Sun Jul 28 10:05:07 2013
@@ -33,17 +33,11 @@ import org.springframework.ws.soap.SoapH
 import org.springframework.ws.soap.SoapHeaderException;
 
 final class SoapEnvelopeImpl extends SoapElementImpl<SOAPEnvelope> implements SoapEnvelope {
-    private final SoapMessageImpl parent;
     private SoapHeaderImpl header;
     private SoapBodyImpl body;
     
-    SoapEnvelopeImpl(SoapMessageImpl parent, SOAPEnvelope axiomNode) {
-        super(axiomNode);
-        this.parent = parent;
-    }
-
-    SoapMessageImpl getParent() {
-        return parent;
+    SoapEnvelopeImpl(SoapMessageImpl message, SOAPEnvelope axiomNode) {
+        super(message, axiomNode);
     }
 
     public SoapHeader getHeader() throws SoapHeaderException {
@@ -54,9 +48,9 @@ final class SoapEnvelopeImpl extends Soa
             } else {
                 SOAPVersion soapVersion = ((SOAPFactory)axiomHeader.getOMFactory()).getSOAPVersion();
                 if (soapVersion == SOAP11Version.getSingleton()) {
-                    header = new Soap11HeaderImpl(axiomHeader);
+                    header = new Soap11HeaderImpl(getMessage(), axiomHeader);
                 } else if (soapVersion == SOAP12Version.getSingleton()) {
-                    header = new Soap12HeaderImpl(axiomHeader);
+                    header = new Soap12HeaderImpl(getMessage(), axiomHeader);
                 } else {
                     throw new SoapEnvelopeException("Unrecognized SOAP version");
                 }
@@ -68,7 +62,7 @@ final class SoapEnvelopeImpl extends Soa
     public SoapBody getBody() throws SoapBodyException {
         SOAPBody axiomBody = axiomNode.getBody();
         if (body == null || body.axiomNode != axiomBody) {
-            body = new SoapBodyImpl(this, axiomBody);
+            body = new SoapBodyImpl(getMessage(), axiomBody);
         }
         return body;
     }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementImpl.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementImpl.java Sun Jul 28 10:05:07 2013
@@ -25,8 +25,8 @@ import org.springframework.ws.soap.SoapH
 import org.springframework.ws.soap.SoapHeaderException;
 
 final class SoapHeaderElementImpl extends SoapElementImpl<SOAPHeaderBlock> implements SoapHeaderElement {
-    SoapHeaderElementImpl(SOAPHeaderBlock axiomNode) {
-        super(axiomNode);
+    SoapHeaderElementImpl(SoapMessageImpl message, SOAPHeaderBlock axiomNode) {
+        super(message, axiomNode);
     }
 
     public String getActorOrRole() throws SoapHeaderException {
@@ -40,13 +40,11 @@ final class SoapHeaderElementImpl extend
     }
 
     public boolean getMustUnderstand() throws SoapHeaderException {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        return axiomNode.getMustUnderstand();
     }
 
     public void setMustUnderstand(boolean mustUnderstand) throws SoapHeaderException {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        axiomNode.setMustUnderstand(mustUnderstand);
     }
 
     public Result getResult() throws SoapHeaderException {
@@ -60,7 +58,6 @@ final class SoapHeaderElementImpl extend
     }
 
     public void setText(String content) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        axiomNode.setText(content);
     }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementIterator.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementIterator.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementIterator.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderElementIterator.java Sun Jul 28 10:05:07 2013
@@ -24,9 +24,11 @@ import org.apache.axiom.soap.SOAPHeaderB
 import org.springframework.ws.soap.SoapHeaderElement;
 
 final class SoapHeaderElementIterator implements Iterator<SoapHeaderElement> {
+    private final SoapMessageImpl message;
     private final Iterator<?> parent;
 
-    SoapHeaderElementIterator(Iterator<?> parent) {
+    SoapHeaderElementIterator(SoapMessageImpl message, Iterator<?> parent) {
+        this.message = message;
         this.parent = parent;
     }
 
@@ -35,7 +37,7 @@ final class SoapHeaderElementIterator im
     }
 
     public SoapHeaderElement next() {
-        return new SoapHeaderElementImpl((SOAPHeaderBlock)parent.next());
+        return new SoapHeaderElementImpl(message, (SOAPHeaderBlock)parent.next());
     }
 
     public void remove() {

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapHeaderImpl.java Sun Jul 28 10:05:07 2013
@@ -18,29 +18,30 @@
  */
 package org.apache.axiom.spring.ws.soap;
 
+import java.util.Arrays;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.namespace.QName;
 import javax.xml.transform.Result;
 
+import org.apache.axiom.soap.RolePlayer;
 import org.apache.axiom.soap.SOAPHeader;
 import org.springframework.ws.soap.SoapHeader;
 import org.springframework.ws.soap.SoapHeaderElement;
 import org.springframework.ws.soap.SoapHeaderException;
 
 abstract class SoapHeaderImpl extends SoapElementImpl<SOAPHeader> implements SoapHeader {
-    SoapHeaderImpl(SOAPHeader axiomNode) {
-        super(axiomNode);
+    SoapHeaderImpl(SoapMessageImpl message, SOAPHeader axiomNode) {
+        super(message, axiomNode);
     }
 
-    public Result getResult() {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+    public final Result getResult() {
+        return axiomNode.getSAXResult();
     }
 
-    public SoapHeaderElement addHeaderElement(QName name) throws SoapHeaderException {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+    public final SoapHeaderElement addHeaderElement(QName name) throws SoapHeaderException {
+        return new SoapHeaderElementImpl(getMessage(), axiomNode.addHeaderBlock(name));
     }
 
     public void removeHeaderElement(QName name) throws SoapHeaderException {
@@ -53,13 +54,31 @@ abstract class SoapHeaderImpl extends So
         throw new UnsupportedOperationException();
     }
 
-    public Iterator<SoapHeaderElement> examineAllHeaderElements() throws SoapHeaderException {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+    public final Iterator<SoapHeaderElement> examineAllHeaderElements() throws SoapHeaderException {
+        return new SoapHeaderElementIterator(getMessage(), axiomNode.examineAllHeaderBlocks());
     }
 
     public Iterator<SoapHeaderElement> examineHeaderElements(QName name) throws SoapHeaderException {
         // TODO Auto-generated method stub
         throw new UnsupportedOperationException();
     }
+
+    final Iterator<SoapHeaderElement> internalExamineHeaderElementsToProcess(String[] roles, final boolean isUltimateReceiver) throws SoapHeaderException {
+        RolePlayer rolePlayer;
+        if (roles == null) {
+            rolePlayer = null;
+        } else {
+            final List<String> roleList = Arrays.asList(roles);
+            rolePlayer = new RolePlayer() {
+                public List<?> getRoles() {
+                    return roleList;
+                }
+    
+                public boolean isUltimateDestination() {
+                    return isUltimateReceiver;
+                }
+            };
+        }
+        return new SoapHeaderElementIterator(getMessage(), axiomNode.getHeadersToProcess(rolePlayer));
+    }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java Sun Jul 28 10:05:07 2013
@@ -33,8 +33,8 @@ import org.apache.axiom.soap.SOAPEnvelop
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPMessage;
 import org.apache.axiom.spring.ws.AxiomWebServiceMessage;
-import org.apache.axiom.spring.ws.PayloadAccessStrategy;
-import org.apache.axiom.spring.ws.PayloadAccessStrategyStack;
+import org.apache.axiom.spring.ws.SourceExtractionStrategy;
+import org.apache.axiom.spring.ws.SourceExtractionStrategyStack;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.ws.mime.Attachment;
@@ -50,7 +50,7 @@ final class SoapMessageImpl extends Abst
     private static final Log log = LogFactory.getLog(SoapMessageImpl.class);
     
     private final SOAPMessage axiomMessage;
-    private final PayloadAccessStrategyStack payloadAccessStrategyStack = new PayloadAccessStrategyStack();
+    private final SourceExtractionStrategyStack extractionStrategyStack = new SourceExtractionStrategyStack();
     private SoapEnvelopeImpl envelope;
     
     SoapMessageImpl(SOAPMessage axiomMessage) {
@@ -67,7 +67,7 @@ final class SoapMessageImpl extends Abst
 
     public String getSoapAction() {
         // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
+        return "\"\"";
     }
 
     public void setSoapAction(String soapAction) {
@@ -138,15 +138,15 @@ final class SoapMessageImpl extends Abst
         return qname;
     }
 
-    public void pushPayloadAccessStrategy(PayloadAccessStrategy strategy, Object bean) {
-        payloadAccessStrategyStack.push(strategy, bean);
+    public void pushSourceExtractionStrategy(SourceExtractionStrategy strategy, Object bean) {
+        extractionStrategyStack.push(strategy, bean);
     }
 
-    public void popPayloadAccessStrategy(Object bean) {
-        payloadAccessStrategyStack.pop(bean);
+    public void popSourceExtractionStrategy(Object bean) {
+        extractionStrategyStack.pop(bean);
     }
     
-    PayloadAccessStrategy getPayloadAccessStrategy() {
-        return payloadAccessStrategyStack.getCurrent();
+    SourceExtractionStrategy getSourceExtractionStrategy() {
+        return extractionStrategyStack.getCurrent();
     }
 }

Added: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java?rev=1507775&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java Sun Jul 28 10:05:07 2013
@@ -0,0 +1,91 @@
+/*
+ * 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.axiom.spring.ws.test;
+
+import org.apache.axiom.testutils.suite.MatrixTestCase;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.springframework.context.support.GenericXmlApplicationContext;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.MutablePropertySources;
+import org.springframework.core.env.StandardEnvironment;
+import org.springframework.mock.env.MockPropertySource;
+import org.springframework.web.context.ConfigurableWebApplicationContext;
+import org.springframework.ws.transport.http.MessageDispatcherServlet;
+
+public abstract class ScenarioTestCase extends MatrixTestCase {
+    private Server server;
+    protected GenericXmlApplicationContext context;
+    
+    public ScenarioTestCase(String soapVersion) {
+        addTestParameter("soapVersion", soapVersion);
+    }
+    
+    @Override
+    @SuppressWarnings("serial")
+    protected void setUp() throws Exception {
+        final MatrixTestCasePropertySource testParameters = new MatrixTestCasePropertySource(this);
+        
+        server = new Server();
+        
+        // Set up a custom thread pool to improve thread names (for logging purposes)
+        QueuedThreadPool threadPool = new QueuedThreadPool();
+        threadPool.setName("jetty");
+        server.setThreadPool(threadPool);
+        
+        Connector connector = new SelectChannelConnector();
+        connector.setPort(0);
+        server.setConnectors(new Connector[] { connector });
+        ServletContextHandler handler = new ServletContextHandler(server, "/");
+        ServletHolder servlet = new ServletHolder(new MessageDispatcherServlet() {
+            @Override
+            protected void postProcessWebApplicationContext(ConfigurableWebApplicationContext wac) {
+                wac.getEnvironment().getPropertySources().addFirst(testParameters);
+            }
+        });
+        servlet.setName("spring-ws");
+        servlet.setInitParameter("contextConfigLocation", getClass().getResource("server.xml").toString());
+        servlet.setInitOrder(1);
+        handler.addServlet(servlet, "/*");
+        server.start();
+        
+        context = new GenericXmlApplicationContext();
+        ConfigurableEnvironment environment = context.getEnvironment();
+        MockPropertySource propertySource = new MockPropertySource();
+        propertySource.setProperty("port", connector.getLocalPort());
+        MutablePropertySources propertySources = environment.getPropertySources();
+        propertySources.replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, propertySource);
+        propertySources.addFirst(testParameters);
+        context.load(getClass(), "client.xml");
+        context.refresh();
+    }
+    
+    @Override
+    protected void tearDown() throws Exception {
+        context.close();
+        context = null;
+        
+        server.stop();
+        server = null;
+    }
+}

Propchange: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/ScenarioTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/SpringWSTestSuiteBuilder.java Sun Jul 28 10:05:07 2013
@@ -19,12 +19,18 @@
 package org.apache.axiom.spring.ws.test;
 
 import org.apache.axiom.spring.ws.test.jdom.ClientServerTest;
+import org.apache.axiom.spring.ws.test.wsadom.WSAddressingDOMTest;
 import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
 
 public class SpringWSTestSuiteBuilder extends MatrixTestSuiteBuilder {
     @Override
     protected void addTests() {
-        addTest(new ClientServerTest("SOAP_11"));
-        addTest(new ClientServerTest("SOAP_12"));
+        addTests("SOAP_11");
+        addTests("SOAP_12");
+    }
+    
+    private void addTests(String soapVersion) {
+        addTest(new ClientServerTest(soapVersion));
+        addTest(new WSAddressingDOMTest(soapVersion));
     }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/CalculatorEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/CalculatorEndpoint.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/CalculatorEndpoint.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/CalculatorEndpoint.java Sun Jul 28 10:05:07 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.axiom.spring.ws.test.jdom;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jdom2.Element;
 import org.jdom2.Namespace;
 import org.jdom2.filter.Filters;
@@ -30,6 +32,8 @@ import org.springframework.ws.server.end
 
 @Endpoint
 public class CalculatorEndpoint {
+    private static final Log log = LogFactory.getLog(CalculatorEndpoint.class);
+    
     private static final String NAMESPACE_URI = "urn:calculator";
     private static final Namespace NAMESPACE = Namespace.getNamespace("c", NAMESPACE_URI);
 
@@ -37,9 +41,10 @@ public class CalculatorEndpoint {
 
     @PayloadRoot(namespace = NAMESPACE_URI, localPart = "AddRequest")
     @ResponsePayload
-    public Element handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception {
+    public Element add(@RequestPayload Element addRequest) throws Exception {
+        log.debug("Endpoint invoked");
         double sum = 0d;
-        for (Element operand : operandExpression.evaluate(holidayRequest)) {
+        for (Element operand : operandExpression.evaluate(addRequest)) {
             sum += Double.parseDouble(operand.getTextNormalize());
         }
         Element response = new Element("AddResponse", NAMESPACE);

Modified: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/jdom/ClientServerTest.java Sun Jul 28 10:05:07 2013
@@ -18,73 +18,15 @@
  */
 package org.apache.axiom.spring.ws.test.jdom;
 
-import org.apache.axiom.spring.ws.test.MatrixTestCasePropertySource;
-import org.apache.axiom.testutils.suite.MatrixTestCase;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.nio.SelectChannelConnector;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.apache.axiom.spring.ws.test.ScenarioTestCase;
 import org.jdom2.input.SAXBuilder;
 import org.jdom2.transform.JDOMResult;
 import org.jdom2.transform.JDOMSource;
-import org.springframework.context.support.GenericXmlApplicationContext;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.core.env.MutablePropertySources;
-import org.springframework.core.env.StandardEnvironment;
-import org.springframework.mock.env.MockPropertySource;
-import org.springframework.web.context.ConfigurableWebApplicationContext;
 import org.springframework.ws.client.core.WebServiceTemplate;
-import org.springframework.ws.transport.http.MessageDispatcherServlet;
 
-public class ClientServerTest extends MatrixTestCase {
-    private Server server;
-    private GenericXmlApplicationContext context;
-    
+public class ClientServerTest extends ScenarioTestCase {
     public ClientServerTest(String soapVersion) {
-        addTestParameter("soapVersion", soapVersion);
-    }
-    
-    @Override
-    @SuppressWarnings("serial")
-    protected void setUp() throws Exception {
-        final MatrixTestCasePropertySource testParameters = new MatrixTestCasePropertySource(this);
-        
-        server = new Server();
-        Connector connector = new SelectChannelConnector();
-        connector.setPort(0);
-        server.setConnectors(new Connector[] { connector });
-        ServletContextHandler handler = new ServletContextHandler(server, "/");
-        ServletHolder servlet = new ServletHolder(new MessageDispatcherServlet() {
-            @Override
-            protected void postProcessWebApplicationContext(ConfigurableWebApplicationContext wac) {
-                wac.getEnvironment().getPropertySources().addFirst(testParameters);
-            }
-        });
-        servlet.setName("spring-ws");
-        servlet.setInitParameter("contextConfigLocation", ClientServerTest.class.getResource("server.xml").toString());
-        servlet.setInitOrder(1);
-        handler.addServlet(servlet, "/*");
-        server.start();
-        
-        context = new GenericXmlApplicationContext();
-        ConfigurableEnvironment environment = context.getEnvironment();
-        MockPropertySource propertySource = new MockPropertySource();
-        propertySource.setProperty("port", connector.getLocalPort());
-        MutablePropertySources propertySources = environment.getPropertySources();
-        propertySources.replace(StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, propertySource);
-        propertySources.addFirst(testParameters);
-        context.load(ClientServerTest.class, "client.xml");
-        context.refresh();
-    }
-    
-    @Override
-    protected void tearDown() throws Exception {
-        context.close();
-        context = null;
-        
-        server.stop();
-        server = null;
+        super(soapVersion);
     }
     
     @Override

Added: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/EchoEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/EchoEndpoint.java?rev=1507775&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/EchoEndpoint.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/EchoEndpoint.java Sun Jul 28 10:05:07 2013
@@ -0,0 +1,41 @@
+/*
+ * 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.axiom.spring.ws.test.wsadom;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.ws.server.endpoint.annotation.Endpoint;
+import org.springframework.ws.server.endpoint.annotation.RequestPayload;
+import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
+import org.springframework.ws.soap.addressing.server.annotation.Action;
+import org.w3c.dom.Element;
+
+@Endpoint
+public class EchoEndpoint {
+    private static final Log log = LogFactory.getLog(EchoEndpoint.class);
+    
+    public static final String ACTION = "urn:echo";
+    
+    @Action(ACTION)
+    @ResponsePayload
+    public Element echo(@RequestPayload Element request) {
+        log.debug("Endpoint invoked");
+        return request;
+    }
+}
\ No newline at end of file

Propchange: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/EchoEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/WSAddressingDOMTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/WSAddressingDOMTest.java?rev=1507775&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/WSAddressingDOMTest.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/WSAddressingDOMTest.java Sun Jul 28 10:05:07 2013
@@ -0,0 +1,51 @@
+/*
+ * 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.axiom.spring.ws.test.wsadom;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+
+import org.apache.axiom.spring.ws.test.ScenarioTestCase;
+import org.springframework.ws.client.core.WebServiceTemplate;
+import org.springframework.ws.soap.addressing.client.ActionCallback;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class WSAddressingDOMTest extends ScenarioTestCase {
+    public WSAddressingDOMTest(String soapVersion) {
+        super(soapVersion);
+    }
+    
+    @Override
+    protected void runTest() throws Throwable {
+        DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        Document requestDocument = documentBuilder.newDocument();
+        Element request = requestDocument.createElementNS("urn:test", "p:testRequest");
+        request.setTextContent("test");
+        Document responseDocument = documentBuilder.newDocument();
+        context.getBean(WebServiceTemplate.class).sendSourceAndReceiveToResult(
+                new DOMSource(request), new ActionCallback(EchoEndpoint.ACTION), new DOMResult(responseDocument));
+        Element response = responseDocument.getDocumentElement();
+        assertEquals("urn:test", response.getNamespaceURI());
+        assertEquals("testRequest", response.getLocalName());
+        assertEquals("test", response.getTextContent());
+    }
+}

Propchange: webservices/axiom/trunk/axiom-spring-ws/src/test/java/org/apache/axiom/spring/ws/test/wsadom/WSAddressingDOMTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/axiom-spring-ws/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/resources/log4j.properties?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/resources/log4j.properties (original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/resources/log4j.properties Sun Jul 28 10:05:07 2013
@@ -6,4 +6,4 @@ log4j.rootLogger=INFO, stdout
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.Target=System.out
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
\ No newline at end of file
+log4j.appender.stdout.layout.ConversionPattern=%-6r %-5p %-8t [%c{1}] %m%n
\ No newline at end of file

Added: webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/client.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/client.xml?rev=1507775&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/client.xml (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/client.xml Sun Jul 28 10:05:07 2013
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">
+
+    <bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
+    
+    <bean class="org.springframework.ws.client.core.WebServiceTemplate">
+        <constructor-arg>
+            <bean class="org.apache.axiom.spring.ws.soap.AxiomSoapMessageFactory">
+                <property name="soapVersion">
+                    <util:constant static-field="org.springframework.ws.soap.SoapVersion.${soapVersion}"/>
+                </property>
+            </bean>
+        </constructor-arg>
+        <property name="defaultUri" value="http://localhost:${port}/"/>
+    </bean>
+</beans>

Propchange: webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/client.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/server.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/server.xml?rev=1507775&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/server.xml (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/server.xml Sun Jul 28 10:05:07 2013
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:sws="http://www.springframework.org/schema/web-services"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
+         http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
+         http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd">
+    
+    <bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"/>
+    
+    <context:component-scan base-package="org.apache.axiom.spring.ws.test.wsadom"/>
+    
+    <bean name="messageFactory" class="org.apache.axiom.spring.ws.soap.AxiomSoapMessageFactory">
+        <property name="soapVersion">
+            <util:constant static-field="org.springframework.ws.soap.SoapVersion.${soapVersion}"/>
+        </property>
+    </bean>
+    <bean class="org.apache.axiom.spring.ws.AxiomOptimizationEnabler"/>
+    
+    <sws:annotation-driven/>
+</beans>

Propchange: webservices/axiom/trunk/axiom-spring-ws/src/test/resources/org/apache/axiom/spring/ws/test/wsadom/server.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java (original)
+++ webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java Sun Jul 28 10:05:07 2013
@@ -26,6 +26,8 @@ import org.apache.axiom.om.OMNamespace;
 import java.util.ArrayList;
 import java.util.Iterator;
 
+import javax.xml.namespace.QName;
+
 /** Interface SOAPHeader */
 public interface SOAPHeader extends OMElement {
     /**
@@ -45,6 +47,20 @@ public interface SOAPHeader extends OMEl
     SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException;
 
     /**
+     * Creates a new {@link SOAPHeaderBlock} object initialized with the specified name and adds it
+     * to this {@link SOAPHeader} object.
+     * 
+     * @param qname
+     *            the name of the header block (which must have a non empty namespace URI)
+     * @return the new {@link SOAPHeaderBlock} object that was inserted into this {@link SOAPHeader}
+     *         object
+     * @throws OMException
+     *             if an error occurs, e.g. if the namespace URI specified by the {@link QName} is
+     *             empty
+     */
+    SOAPHeaderBlock addHeaderBlock(QName qname) throws OMException;
+    
+    /**
      * Get the appropriate set of headers for a {@link RolePlayer}.
      * <p>
      * The {@link RolePlayer} indicates whether it is the ultimate destination (in which case

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java Sun Jul 28 10:05:07 2013
@@ -43,6 +43,8 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.xml.namespace.QName;
+
 public abstract class SOAPHeaderImpl extends SOAPElement implements SOAPHeader {
     /** @param envelope  */
     public SOAPHeaderImpl(SOAPEnvelope envelope, SOAPFactory factory)
@@ -79,6 +81,10 @@ public abstract class SOAPHeaderImpl ext
         return soapHeaderBlock;
     }
 
+    public SOAPHeaderBlock addHeaderBlock(QName qname) throws OMException {
+        return addHeaderBlock(qname.getLocalPart(), getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix()));
+    }
+
     public Iterator getHeadersToProcess(RolePlayer rolePlayer) {
         return new HeaderIterator(this, new RolePlayerChecker(rolePlayer));
     }

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java (original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java Sun Jul 28 10:05:07 2013
@@ -46,6 +46,8 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.xml.namespace.QName;
+
 /** A class representing the SOAP Header, primarily allowing access to the contained HeaderBlocks. */
 public abstract class SOAPHeaderImpl extends SOAPElement implements SOAPHeader {
     
@@ -94,6 +96,10 @@ public abstract class SOAPHeaderImpl ext
         return soapHeaderBlock;
     }
 
+    public SOAPHeaderBlock addHeaderBlock(QName qname) throws OMException {
+        return addHeaderBlock(qname.getLocalPart(), getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix()));
+    }
+
     public Iterator getHeadersToProcess(RolePlayer rolePlayer) {
         return new HeaderIterator(this, new RolePlayerChecker(rolePlayer));
     }

Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1507775&r1=1507774&r2=1507775&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Sun Jul 28 10:05:07 2013
@@ -198,6 +198,8 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap.faultdetail.TestWSCommons202(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.faulttext.TestSetLang(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlock(metaFactory, spec));
+        addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlockFromQName(metaFactory, spec));
+        addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlockFromQNameWithoutNamespace(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlockWithoutNamespace1(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.header.TestAddHeaderBlockWithoutNamespace2(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.header.TestDiscardIncomplete(metaFactory, spec));

Added: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQName.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQName.java?rev=1507775&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQName.java (added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQName.java Sun Jul 28 10:05:07 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.axiom.ts.soap.header;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests the behavior of {@link SOAPHeader#addHeaderBlock(QName)}.
+ */
+public class TestAddHeaderBlockFromQName extends SOAPTestCase {
+    public TestAddHeaderBlockFromQName(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec);
+    }
+
+    protected void runTest() throws Throwable {
+        SOAPEnvelope env = soapFactory.getDefaultEnvelope();
+        SOAPHeader header = env.getOrCreateHeader();
+        SOAPHeaderBlock headerBlock = header.addHeaderBlock(new QName("urn:test", "test", "p"));
+        assertSame(headerBlock, header.getFirstOMChild());
+        assertEquals("test", headerBlock.getLocalName());
+        assertEquals("p", headerBlock.getPrefix());
+        assertEquals("urn:test", headerBlock.getNamespaceURI());
+    }
+}

Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQName.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQNameWithoutNamespace.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQNameWithoutNamespace.java?rev=1507775&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQNameWithoutNamespace.java (added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQNameWithoutNamespace.java Sun Jul 28 10:05:07 2013
@@ -0,0 +1,49 @@
+/*
+ * 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.axiom.ts.soap.header;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Tests the behavior of {@link SOAPHeader#addHeaderBlock(QName)} when passing a
+ * {@link QName} with no namespace.
+ */
+public class TestAddHeaderBlockFromQNameWithoutNamespace extends SOAPTestCase {
+    public TestAddHeaderBlockFromQNameWithoutNamespace(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec);
+    }
+
+    protected void runTest() throws Throwable {
+        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
+        SOAPHeader header = soapFactory.createSOAPHeader(envelope);
+        try {
+            header.addHeaderBlock(new QName("test"));
+            fail("Expected OMException");
+        } catch (OMException ex) {
+            // Expected
+        }
+    }
+}

Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/header/TestAddHeaderBlockFromQNameWithoutNamespace.java
------------------------------------------------------------------------------
    svn:eol-style = native