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/24 08:35:28 UTC

svn commit: r1506407 - in /webservices/axiom/trunk/axiom-spring-ws/src: main/java/org/apache/axiom/spring/ws/ main/java/org/apache/axiom/spring/ws/pox/ main/java/org/apache/axiom/spring/ws/soap/ test/resources/

Author: veithen
Date: Wed Jul 24 06:35:28 2013
New Revision: 1506407

URL: http://svn.apache.org/r1506407
Log:
AXIOM-447: Implemented another optimization strategy to select the optimal strategy to be used by getPayloadSource().

Added:
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/MethodProcessorProxy.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategy.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategyStack.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/AxiomPoxMessageFactory.java   (with props)
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/PoxMessageImpl.java   (with props)
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/soap/SoapBodyImpl.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/SoapMessageImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/test/resources/log4j.properties

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=1506407&r1=1506406&r2=1506407&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 Wed Jul 24 06:35:28 2013
@@ -27,18 +27,44 @@ import org.apache.commons.logging.LogFac
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.config.BeanPostProcessor;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResolver;
+import org.springframework.ws.server.endpoint.adapter.method.dom.JDomPayloadMethodProcessor;
 import org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping;
 
 /**
- * {@link BeanFactoryPostProcessor} that adjusts the configuration to enable some Axiom specific
- * optimizations. Currently, the following optimizations are done:
+ * Post processor that adjusts the bean configurations to enable some Axiom specific optimizations.
+ * <p>
+ * Its primary responsibility is to associate particular {@link PayloadAccessStrategy} 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)}.
+ * <p>
+ * The following table describes the supported bean types and the corresponding
+ * {@link PayloadAccessStrategy}:
+ * <table border="2" rules="all" cellpadding="4" cellspacing="0">
+ * <tr>
+ * <th>Bean type
+ * <th>Strategy
+ * </tr>
+ * <tr>
+ * <td>{@link JDomPayloadMethodProcessor}
+ * <td>{@link PayloadAccessStrategy#SAX_CONSUME}
+ * </tr>
+ * </table>
+ * <p>
+ * TODO: note about the implications of the fact that proxies for {@link MethodArgumentResolver} use
+ * strategies that consume the payload
+ * <p>
+ * In addition, the post processor carries out the following optimizations:
  * <ul>
  * <li>{@link PayloadRootAnnotationMethodEndpointMapping} beans are replaced by
  * {@link AxiomPayloadRootAnnotationMethodEndpointMapping} beans.
  * </ul>
  */
-public class AxiomOptimizationEnabler implements BeanFactoryPostProcessor {
+public class AxiomOptimizationEnabler implements BeanFactoryPostProcessor, BeanPostProcessor {
     private static final Log log = LogFactory.getLog(AxiomOptimizationEnabler.class);
     
     private static final Map<String,String> replacementClasses;
@@ -62,4 +88,18 @@ public class AxiomOptimizationEnabler im
             }
         }
     }
+
+    public Object postProcessBeforeInitialization(Object bean, String beanName)
+            throws BeansException {
+        return bean;
+    }
+
+    public Object postProcessAfterInitialization(Object bean, String beanName)
+            throws BeansException {
+        if (bean instanceof JDomPayloadMethodProcessor) {
+            return new MethodProcessorProxy(bean, PayloadAccessStrategy.SAX_CONSUME);
+        } else {
+            return bean;
+        }
+    }
 }

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=1506407&r1=1506406&r2=1506407&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 Wed Jul 24 06:35:28 2013
@@ -25,6 +25,7 @@ import javax.xml.transform.TransformerFa
 import org.apache.axiom.spring.ws.soap.AxiomSoapMessageFactory;
 import org.springframework.ws.WebServiceMessage;
 import org.springframework.ws.server.endpoint.support.PayloadRootUtils;
+import org.springframework.ws.soap.SoapBody;
 
 /**
  * Interface implemented by {@link WebServiceMessage} instances created by
@@ -40,4 +41,35 @@ public interface AxiomWebServiceMessage 
      * @return the qualified name of they payload root element
      */
     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)}.
+     * <p>
+     * Note: this method is used internally; it is not expected to be called by application code.
+     * 
+     * @param strategy
+     *            the strategy
+     * @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)}
+     */
+    void pushPayloadAccessStrategy(PayloadAccessStrategy 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.
+     * 
+     * @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)}.
+     * @throws IllegalStateException
+     *             if the stack is empty or if the caller didn't pass the expected bean
+     */
+    void popPayloadAccessStrategy(Object bean);
 }

Added: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/MethodProcessorProxy.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/MethodProcessorProxy.java?rev=1506407&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/MethodProcessorProxy.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/MethodProcessorProxy.java Wed Jul 24 06:35:28 2013
@@ -0,0 +1,63 @@
+/*
+ * 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 org.springframework.core.MethodParameter;
+import org.springframework.ws.WebServiceMessage;
+import org.springframework.ws.context.MessageContext;
+import org.springframework.ws.server.endpoint.adapter.method.MethodArgumentResolver;
+import org.springframework.ws.server.endpoint.adapter.method.MethodReturnValueHandler;
+
+final class MethodProcessorProxy implements MethodArgumentResolver, MethodReturnValueHandler {
+    private final Object target;
+    private final PayloadAccessStrategy strategy;
+
+    MethodProcessorProxy(Object target, PayloadAccessStrategy strategy) {
+        this.target = target;
+        this.strategy = strategy;
+    }
+
+    public boolean supportsParameter(MethodParameter parameter) {
+        return ((MethodArgumentResolver)target).supportsParameter(parameter);
+    }
+
+    public Object resolveArgument(MessageContext messageContext, MethodParameter parameter)
+            throws Exception {
+        WebServiceMessage request = messageContext.getRequest();
+        if (request instanceof AxiomWebServiceMessage) {
+            ((AxiomWebServiceMessage)request).pushPayloadAccessStrategy(strategy, this);
+        }
+        try {
+            return ((MethodArgumentResolver)target).resolveArgument(messageContext, parameter);
+        } finally {
+            if (request instanceof AxiomWebServiceMessage) {
+                ((AxiomWebServiceMessage)request).popPayloadAccessStrategy(this);
+            }
+        }
+    }
+
+    public boolean supportsReturnType(MethodParameter returnType) {
+        return ((MethodReturnValueHandler)target).supportsReturnType(returnType);
+    }
+
+    public void handleReturnValue(MessageContext messageContext, MethodParameter returnType,
+            Object returnValue) throws Exception {
+        ((MethodReturnValueHandler)target).handleReturnValue(messageContext, returnType, returnValue);
+    }
+}

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

Added: 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/PayloadAccessStrategy.java?rev=1506407&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategy.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategy.java Wed Jul 24 06:35:28 2013
@@ -0,0 +1,116 @@
+/*
+ * 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 javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+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.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Strategy interface for {@link WebServiceMessage#getPayloadSource()} and
+ * {@link SoapBody#getPayloadSource()}.
+ * <p>
+ * Axiom supports several methods to transform an {@link OMContainer} object into a representation
+ * based on a different API. E.g.:
+ * <ul>
+ * <li>{@link OMContainer#getXMLStreamReader(boolean)} can be used to get a StAX
+ * {@link XMLStreamReader} from any {@link OMContainer} object.
+ * <li>{@link OMContainer#getSAXSource(boolean)} can be used to transform an {@link OMContainer}
+ * into a sequence of SAX events.
+ * <li>An Axiom implementation can support DOM directly. If such an implementation is used, then an
+ * {@link OMContainer} object can be processed using DOM code by simply casting it to the
+ * corresponding DOM interface ({@link Document} or {@link Element}).
+ * </ul>
+ * In the first two cases, Axiom can also be instructed to skip building the Axiom object model and
+ * instead retrieve the XML events directly from the underlying parser (unless the Axiom object
+ * 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()}.
+ * <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
+ * 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 {
+    /**
+     * Payload access strategy that uses {@link OMContainer#getSAXSource(boolean)} with
+     * <code>cache</code> set to <code>true</code>.
+     */
+    PayloadAccessStrategy SAX_PRESERVE = new PayloadAccessStrategy() {
+        public Source getSource(OMContainer container) {
+            return container.getSAXSource(true);
+        }
+
+        @Override
+        public String toString() {
+            return "SAX_PRESERVE";
+        }
+    };
+    
+    /**
+     * Payload access strategy that uses {@link OMContainer#getSAXSource(boolean)} with
+     * <code>cache</code> set to <code>false</code>.
+     */
+    PayloadAccessStrategy SAX_CONSUME = new PayloadAccessStrategy() {
+        public Source getSource(OMContainer container) {
+            return container.getSAXSource(false);
+        }
+
+        @Override
+        public String toString() {
+            return "SAX_CONSUME";
+        }
+    };
+    
+    /**
+     * 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)}.
+     */
+    PayloadAccessStrategy DEFAULT = SAX_PRESERVE;
+
+    /**
+     * Create a {@link Source} object for the given {@link OMContainer}.
+     * 
+     * @param container
+     *            the {@link OMDocument} or {@link OMElement}
+     * @return the corresponding {@link Source} object
+     */
+    Source getSource(OMContainer container);
+}

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

Added: 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/PayloadAccessStrategyStack.java?rev=1506407&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategyStack.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/PayloadAccessStrategyStack.java Wed Jul 24 06:35:28 2013
@@ -0,0 +1,73 @@
+/*
+ * 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 org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Helper class for implementations of
+ * {@link AxiomWebServiceMessage#pushPayloadAccessStrategy(PayloadAccessStrategy, Object)} and
+ * {@link AxiomWebServiceMessage#popPayloadAccessStrategy(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);
+    
+    private PayloadAccessStrategy[] strategies = new PayloadAccessStrategy[4];
+    private Object[] beans = new Object[4];
+    private int top = -1;
+    
+    public void push(PayloadAccessStrategy strategy, Object bean) {
+        if (log.isDebugEnabled()) {
+            log.debug("Set payload access strategy " + strategy + " for bean " + bean);
+        }
+        top++;
+        int capacity = strategies.length;
+        if (top == capacity) {
+            PayloadAccessStrategy[] newStrategies = new PayloadAccessStrategy[capacity*2];
+            System.arraycopy(strategies, 0, newStrategies, 0, capacity);
+            strategies = newStrategies;
+            Object[] newBeans = new Object[capacity*2];
+            System.arraycopy(beans, 0, newBeans, 0, capacity);
+            beans = newBeans;
+        }
+        strategies[top] = strategy;
+        beans[top] = bean;
+    }
+    
+    public void pop(Object bean) {
+        if (top == -1 || beans[top] != bean) {
+            throw new IllegalStateException();
+        }
+        top--;
+        if (log.isDebugEnabled()) {
+            if (top == -1) {
+                log.debug("Restored default payload access strategy");
+            } else {
+                log.debug("Restored payload access strategy " + strategies[top] + " for bean " + beans[top]);
+            }
+        }
+    }
+    
+    public PayloadAccessStrategy getCurrent() {
+        return top == -1 ? PayloadAccessStrategy.DEFAULT : strategies[top];
+    }
+}

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

Added: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/AxiomPoxMessageFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/AxiomPoxMessageFactory.java?rev=1506407&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/AxiomPoxMessageFactory.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/AxiomPoxMessageFactory.java Wed Jul 24 06:35:28 2013
@@ -0,0 +1,39 @@
+/*
+ * 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.pox;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.springframework.ws.InvalidXmlException;
+import org.springframework.ws.WebServiceMessage;
+import org.springframework.ws.WebServiceMessageFactory;
+
+public class AxiomPoxMessageFactory implements WebServiceMessageFactory {
+    public WebServiceMessage createWebServiceMessage() {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    public WebServiceMessage createWebServiceMessage(InputStream inputStream)
+            throws InvalidXmlException, IOException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+}

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

Added: 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=1506407&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/PoxMessageImpl.java (added)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/pox/PoxMessageImpl.java Wed Jul 24 06:35:28 2013
@@ -0,0 +1,62 @@
+/*
+ * 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.pox;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.namespace.QName;
+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;
+
+final class PoxMessageImpl implements AxiomWebServiceMessage {
+    private final PayloadAccessStrategyStack payloadAccessStrategyStack = new PayloadAccessStrategyStack();
+    
+    public Source getPayloadSource() {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    public Result getPayloadResult() {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    public void writeTo(OutputStream outputStream) throws IOException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    public QName getPayloadRootQName() {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    public void pushPayloadAccessStrategy(PayloadAccessStrategy strategy, Object bean) {
+        payloadAccessStrategyStack.push(strategy, bean);
+    }
+
+    public void popPayloadAccessStrategy(Object bean) {
+        payloadAccessStrategyStack.pop(bean);
+    }
+}

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

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=1506407&r1=1506406&r2=1506407&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 Wed Jul 24 06:35:28 2013
@@ -24,17 +24,29 @@ 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.springframework.ws.soap.SoapBody;
 import org.springframework.ws.soap.SoapFault;
 import org.springframework.ws.soap.SoapFaultException;
 
 final class SoapBodyImpl extends SoapElementImpl<SOAPBody> implements SoapBody {
-    SoapBodyImpl(SOAPBody axiomNode) {
+    private static final Log log = LogFactory.getLog(SoapBodyImpl.class);
+    
+    private final SoapEnvelopeImpl parent;
+    
+    SoapBodyImpl(SoapEnvelopeImpl parent, SOAPBody axiomNode) {
         super(axiomNode);
+        this.parent = parent;
     }
 
     public Source getPayloadSource() {
-        return axiomNode.getFirstElement().getSAXSource(false);
+        PayloadAccessStrategy strategy = parent.getParent().getPayloadAccessStrategy();
+        if (log.isDebugEnabled()) {
+            log.debug("Returning payload using strategy " + strategy);
+        }
+        return strategy.getSource(axiomNode.getFirstElement());
     }
 
     public Result getPayloadResult() {

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=1506407&r1=1506406&r2=1506407&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 Wed Jul 24 06:35:28 2013
@@ -33,11 +33,17 @@ 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(SOAPEnvelope axiomNode) {
+    SoapEnvelopeImpl(SoapMessageImpl parent, SOAPEnvelope axiomNode) {
         super(axiomNode);
+        this.parent = parent;
+    }
+
+    SoapMessageImpl getParent() {
+        return parent;
     }
 
     public SoapHeader getHeader() throws SoapHeaderException {
@@ -62,7 +68,7 @@ final class SoapEnvelopeImpl extends Soa
     public SoapBody getBody() throws SoapBodyException {
         SOAPBody axiomBody = axiomNode.getBody();
         if (body == null || body.axiomNode != axiomBody) {
-            body = new SoapBodyImpl(axiomBody);
+            body = new SoapBodyImpl(this, axiomBody);
         }
         return body;
     }

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=1506407&r1=1506406&r2=1506407&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 Wed Jul 24 06:35:28 2013
@@ -33,6 +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.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.ws.mime.Attachment;
@@ -48,6 +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 SoapEnvelopeImpl envelope;
     
     SoapMessageImpl(SOAPMessage axiomMessage) {
@@ -57,7 +60,7 @@ final class SoapMessageImpl extends Abst
     public SoapEnvelope getEnvelope() throws SoapEnvelopeException {
         SOAPEnvelope axiomEnvelope = axiomMessage.getSOAPEnvelope();
         if (envelope == null || envelope.axiomNode != axiomEnvelope) {
-            envelope = new SoapEnvelopeImpl(axiomEnvelope);
+            envelope = new SoapEnvelopeImpl(this, axiomEnvelope);
         }
         return envelope;
     }
@@ -134,4 +137,16 @@ final class SoapMessageImpl extends Abst
         }
         return qname;
     }
+
+    public void pushPayloadAccessStrategy(PayloadAccessStrategy strategy, Object bean) {
+        payloadAccessStrategyStack.push(strategy, bean);
+    }
+
+    public void popPayloadAccessStrategy(Object bean) {
+        payloadAccessStrategyStack.pop(bean);
+    }
+    
+    PayloadAccessStrategy getPayloadAccessStrategy() {
+        return payloadAccessStrategyStack.getCurrent();
+    }
 }

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=1506407&r1=1506406&r2=1506407&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 Wed Jul 24 06:35:28 2013
@@ -1,6 +1,7 @@
 log4j.rootLogger=INFO, stdout
 
 #log4j.logger.org.apache.axiom=DEBUG
+#log4j.logger.org.springframework.ws=DEBUG
 
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.Target=System.out