You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2010/05/06 11:22:15 UTC

svn commit: r941623 - in /camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ main/java/org/apache/camel/component/cxf/cxfbean/ main/java/org/apache/camel/component/cxf/feature/ main/java/org/apache/camel/component/cxf/inter...

Author: ningjiang
Date: Thu May  6 09:22:14 2010
New Revision: 941623

URL: http://svn.apache.org/viewvc?rev=941623&view=rev
Log:
CAMEL-2614 supports multi part message in PAYLOAD mode

Added:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HybridSourceDataBinding.java   (with props)
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/ConfigureDocLitWrapperInterceptor.java   (with props)
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RemoveClassTypeInterceptor.java   (with props)
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFWsdlOnlyPayloadModeMultiPartNoSpringTest.java   (with props)
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonMultiPartImpl.java   (with props)
Removed:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageInInterceptor.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageOutInterceptor.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageInInterceptor.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageOutInterceptor.java
Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstPayloadModeTest.java
    camel/trunk/components/camel-cxf/src/test/resources/person.wsdl

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=941623&r1=941622&r2=941623&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java Thu May  6 09:22:14 2010
@@ -52,7 +52,7 @@ public class CxfConsumer extends Default
 
             // we receive a CXF request when this method is called
             public Object invoke(Exchange cxfExchange, Object o) {
-                
+
                 if (LOG.isTraceEnabled()) {
                     LOG.trace("Received CXF Request: " + cxfExchange);
                 }
@@ -63,8 +63,15 @@ public class CxfConsumer extends Default
 
                 // create a Camel exchange
                 org.apache.camel.Exchange camelExchange = endpoint.createExchange();
+                DataFormat dataFormat = endpoint.getDataFormat();
+
+                BindingOperationInfo boi = cxfExchange.getBindingOperationInfo();
+                if (dataFormat == DataFormat.PAYLOAD && boi.isUnwrapped()) {
+                    boi = boi.getWrappedOperation();
+                    cxfExchange.put(BindingOperationInfo.class, boi);
+                }
                 
-                BindingOperationInfo boi = cxfExchange.get(BindingOperationInfo.class);
+                //BindingOperationInfo boi = cxfExchange.get(BindingOperationInfo.class);
                 if (boi != null) {
                     camelExchange.setProperty(BindingOperationInfo.class.getName(), boi);
                     if (LOG.isTraceEnabled()) {
@@ -73,7 +80,6 @@ public class CxfConsumer extends Default
                 }
                 
                 // set data format mode in Camel exchange
-                DataFormat dataFormat = endpoint.getDataFormat();
                 camelExchange.setProperty(CxfConstants.DATA_FORMAT_PROPERTY, dataFormat);   
                 if (LOG.isTraceEnabled()) {
                     LOG.trace("Set Exchange property: " + DataFormat.class.getName() 

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=941623&r1=941622&r2=941623&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Thu May  6 09:22:14 2010
@@ -23,6 +23,8 @@ import java.util.concurrent.atomic.Atomi
 
 import javax.xml.ws.WebServiceProvider;
 
+import org.w3c.dom.Element;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelException;
 import org.apache.camel.Consumer;
@@ -41,12 +43,12 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
-import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.util.ClassHelper;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientImpl;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.frontend.ClientFactoryBean;
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
@@ -57,6 +59,9 @@ import org.apache.cxf.jaxws.JaxWsProxyFa
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
 import org.springframework.context.ApplicationContext;
 
 /**
@@ -83,6 +88,7 @@ public class CxfEndpoint extends Default
     private HeaderFilterStrategy headerFilterStrategy;
     private AtomicBoolean getBusHasBeenCalled = new AtomicBoolean(false);
     private boolean isSetDefaultBus;
+    private boolean loggingFeatureEnabled;
 
     public CxfEndpoint(String remaining, CxfComponent cxfComponent) {
         super(remaining, cxfComponent);
@@ -144,6 +150,14 @@ public class CxfEndpoint extends Default
             }
         }
         
+        if (loggingFeatureEnabled) {
+            sfb.getFeatures().add(new LoggingFeature());
+        }
+
+        if (getDataFormat() == DataFormat.PAYLOAD) {
+            sfb.setDataBinding(new HybridSourceDataBinding());
+        }        
+        
         sfb.setBus(getBus());
         sfb.setStart(false);
     }
@@ -237,6 +251,11 @@ public class CxfEndpoint extends Default
             factoryBean.getFeatures().add(new MessageDataFormatFeature());
         } else if (getDataFormat() == DataFormat.PAYLOAD) {
             factoryBean.getFeatures().add(new PayLoadDataFormatFeature());
+            factoryBean.setDataBinding(new HybridSourceDataBinding());
+        }
+        
+        if (loggingFeatureEnabled) {
+            factoryBean.getFeatures().add(new LoggingFeature());
         }
         
         factoryBean.setBus(getBus());
@@ -267,6 +286,11 @@ public class CxfEndpoint extends Default
             factoryBean.getFeatures().add(new MessageDataFormatFeature());
         } else if (getDataFormat() == DataFormat.PAYLOAD) {
             factoryBean.getFeatures().add(new PayLoadDataFormatFeature());
+            factoryBean.setDataBinding(new HybridSourceDataBinding());
+        }
+        
+        if (loggingFeatureEnabled) {
+            factoryBean.getFeatures().add(new LoggingFeature());
         }
         
         factoryBean.setBus(getBus());        
@@ -453,6 +477,14 @@ public class CxfEndpoint extends Default
     public boolean isSetDefaultBus() {
         return isSetDefaultBus;
     }
+    
+    public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) {
+        this.loggingFeatureEnabled = loggingFeatureEnabled;
+    }
+
+    public boolean isLoggingFeatureEnabled() {
+        return loggingFeatureEnabled;
+    }    
 
     public void start() throws Exception {
         if (headerFilterStrategy == null) {
@@ -496,8 +528,21 @@ public class CxfEndpoint extends Default
             }
             
             if (DataFormat.PAYLOAD == message.get(DataFormat.class)) {
+                
                 CxfPayload<?> payload = (CxfPayload<?>)params[0];
-                message.put(List.class, payload.getBody());
+                List<Element> elements = payload.getBody();
+                
+                BindingOperationInfo boi = message.get(BindingOperationInfo.class);
+                MessageContentsList content = new MessageContentsList();
+                int i = 0;
+                
+                for (MessagePartInfo partInfo : boi.getOperationInfo().getInput().getMessageParts()) {
+                    if (elements.size() > i) {
+                        content.put(partInfo, elements.get(i++));
+                    }
+                }
+
+                message.setContent(List.class, content);
                 message.put(Header.HEADER_LIST, payload.getHeaders());
             } else {
                 super.setParameters(params, message);

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=941623&r1=941622&r2=941623&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Thu May  6 09:22:14 2010
@@ -17,7 +17,6 @@
 package org.apache.camel.component.cxf;
 
 import java.io.InputStream;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -113,14 +112,21 @@ public class CxfProducer extends Default
         BindingOperationInfo boi = getBindingOperationInfo(camelExchange);
         ObjectHelper.notNull(boi, "BindingOperationInfo");
         
+        // keep the message wrapper in PAYLOAD mode
+        if (dataFormat == DataFormat.PAYLOAD && boi.isUnwrapped()) {
+            boi = boi.getWrappedOperation();
+            cxfExchange.put(BindingOperationInfo.class, boi);
+            
+        } 
+        
         // store the original boi in the exchange
         camelExchange.setProperty(BindingOperationInfo.class.getName(), boi);
         if (LOG.isTraceEnabled()) {
             LOG.trace("Set exchange property: BindingOperationInfo: " + boi);
         }
-        
+
         // Unwrap boi before passing it to make a client call
-        if (!endpoint.isWrapped() && boi != null) {
+        if (dataFormat != DataFormat.PAYLOAD && !endpoint.isWrapped() && boi != null) {
             if (boi.isUnwrappedCapable()) {
                 boi = boi.getUnwrappedOperation();
                 if (LOG.isTraceEnabled()) {
@@ -128,7 +134,7 @@ public class CxfProducer extends Default
                 }
             }
         }
-        
+     
         // bind the request CXF exchange
         binding.populateCxfRequestFromExchange(cxfExchange, camelExchange, 
                 requestContext);

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java?rev=941623&r1=941622&r2=941623&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java Thu May  6 09:22:14 2010
@@ -27,8 +27,11 @@ import java.util.Set;
 
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.Holder;
 
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
@@ -43,6 +46,8 @@ import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.frontend.MethodDispatcher;
 import org.apache.cxf.headers.Header;
 import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.message.Message;
@@ -50,6 +55,8 @@ import org.apache.cxf.message.MessageCon
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
 
 /**
  * The Default CXF binding implementation.
@@ -267,6 +274,9 @@ public class DefaultCxfBinding implement
         DataFormat dataFormat = camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY,  
                 DataFormat.class);
         
+        // make sure the "requestor role" property does not get propagated as we do switch role
+        responseContext.remove(Message.REQUESTOR_ROLE);
+        
         // propagate contexts
         if (dataFormat != DataFormat.POJO) {
             // copying response context to out message seems to cause problem in POJO mode
@@ -284,7 +294,7 @@ public class DefaultCxfBinding implement
         if (outBody != null) {
             if (dataFormat == DataFormat.PAYLOAD) {
                 CxfPayload<?> payload = (CxfPayload<?>)outBody;
-                outMessage.put(List.class, payload.getBody());
+                outMessage.setContent(List.class, getResponsePayloadList(cxfExchange, payload.getBody()));
                 outMessage.put(Header.HEADER_LIST, payload.getHeaders());
             } else {
                 if (responseContext.get(Header.HEADER_LIST) != null) {
@@ -333,7 +343,6 @@ public class DefaultCxfBinding implement
         
     }
 
-    
     // HeaderFilterStrategyAware Methods
     // -------------------------------------------------------------------------
     
@@ -350,6 +359,30 @@ public class DefaultCxfBinding implement
     // Non public methods
     // -------------------------------------------------------------------------
     
+    protected MessageContentsList getResponsePayloadList(org.apache.cxf.message.Exchange exchange, 
+                                                         List<Element> elements) {
+        BindingOperationInfo boi = exchange.getBindingOperationInfo();
+
+        if (boi.isUnwrapped()) {
+            boi = boi.getWrappedOperation();
+            exchange.put(BindingOperationInfo.class, boi);
+        }
+        
+        MessageContentsList answer = new MessageContentsList();
+
+        int i = 0;
+        
+        for (MessagePartInfo partInfo : boi.getOperationInfo().getOutput().getMessageParts()) {
+            if (elements.size() > i) {
+                answer.put(partInfo, elements.get(i++));
+                
+            }
+        }
+
+        return answer;
+        
+    }
+    
     /**
      * @param camelExchange
      * @param cxfContext Request or Response context
@@ -500,7 +533,6 @@ public class DefaultCxfBinding implement
         }        
     }
 
-    @SuppressWarnings("unchecked")
     protected static Object getContentFromCxf(Message message, DataFormat dataFormat) {
         Set<Class<?>> contentFormats = message.getContentFormats();
         Object answer = null;
@@ -522,11 +554,9 @@ public class DefaultCxfBinding implement
                     }
                 }
             } else if (dataFormat == DataFormat.PAYLOAD) {
-                // TODO handle other message types in the future.  Currently, this binding only 
-                // deal with SOAP in PayLoad mode.
-                List<Element> body = message.get(List.class);
                 List<SoapHeader> headers = CastUtils.cast((List<?>)message.get(Header.HEADER_LIST));
-                answer = new CxfPayload<SoapHeader>(headers, body);
+                answer = new CxfPayload<SoapHeader>(headers, getPayloadBodyElements(message));
+                
             } else if (dataFormat == DataFormat.MESSAGE) {
                 answer = message.getContent(InputStream.class);
             }
@@ -538,6 +568,68 @@ public class DefaultCxfBinding implement
         return answer;
     }
     
+
+    protected static List<Element> getPayloadBodyElements(Message message) {
+        MessageContentsList inObjects = MessageContentsList.getContentsList(message);
+        org.apache.cxf.message.Exchange exchange = message.getExchange();
+        BindingOperationInfo boi = exchange.getBindingOperationInfo();
+
+        OperationInfo op = boi.getOperationInfo();
+        
+        if (boi.isUnwrapped()) {
+            op = boi.getWrappedOperation().getOperationInfo();
+        } 
+        
+        
+        List<MessagePartInfo> partInfos = null;
+        boolean client = Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
+        if (client) {
+            // it is a response
+            partInfos = op.getOutput().getMessageParts();            
+            
+        } else {
+            // it is a request
+            partInfos = op.getInput().getMessageParts();            
+        }
+        
+        List<Element> answer = new ArrayList<Element>();
+
+        for (MessagePartInfo partInfo : partInfos) {
+            if (!inObjects.hasValue(partInfo)) {
+                continue;
+            }
+            
+            Object part = inObjects.get(partInfo);
+            
+            if (part instanceof Holder) {
+                part = ((Holder)part).value;
+            }
+                        
+            if (part instanceof DOMSource) {
+                Element element = getFirstElement(((DOMSource)part).getNode());
+
+                if (element != null) {
+                    answer.add(element);
+                }
+                
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Extract body element " 
+                              + (element == null ? "null" : XMLUtils.toString(element)));
+                }
+                
+            } else if (part instanceof Element) {
+                answer.add((Element)part);
+            } else {
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Unhandled part type '" + part.getClass());
+                }
+            }
+        }
+
+        return answer;
+    }
+
+
     public static Object getBodyFromCamel(org.apache.camel.Message out,
             DataFormat dataFormat) {
         Object answer = null;
@@ -552,6 +644,14 @@ public class DefaultCxfBinding implement
         return answer;
     }
 
+    private static Element getFirstElement(Node node) {
+        if (node.getNodeType() == Node.ELEMENT_NODE) {
+            return (Element)node;
+        } 
+        
+        return DOMUtils.getFirstElement(node);
+    }
+    
     public void copyJaxWsContext(org.apache.cxf.message.Exchange cxfExchange, Map<String, Object> context) {
         if (cxfExchange.getOutMessage() != null) {
             org.apache.cxf.message.Message outMessage = cxfExchange.getOutMessage();

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HybridSourceDataBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HybridSourceDataBinding.java?rev=941623&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HybridSourceDataBinding.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HybridSourceDataBinding.java Thu May  6 09:22:14 2010
@@ -0,0 +1,89 @@
+/**
+ * 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.camel.component.cxf;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Node;
+
+import org.apache.cxf.databinding.DataReader;
+import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.databinding.source.NodeDataReader;
+import org.apache.cxf.databinding.source.NodeDataWriter;
+import org.apache.cxf.databinding.source.XMLStreamDataReader;
+import org.apache.cxf.databinding.source.XMLStreamDataWriter;
+import org.apache.cxf.jaxb.JAXBDataBinding;
+
+/**
+ * This is a hybrid DataBinding of {@link JAXBDataBinding} and {@link org.apache.cxf.databinding.source.SourceDataBinding}.
+ * Like the SourceDataBinding, this DataBinding de/serializes parameters as DOMSource objects.  And like the JAXBDataBinding, the 
+ * {@link #initialize(org.apache.cxf.service.Service)}
+ * method can initialize the service model's message part schema based on the service class in the message part info.  
+ * Hence, this DataBinding supports DOMSource object de/serialization without requiring users to provide a WSDL.
+ * 
+ * @version @Revision: 789534 $
+ */
+public class HybridSourceDataBinding extends JAXBDataBinding {
+    private XMLStreamDataReader xsrReader;
+    private XMLStreamDataWriter xswWriter;
+    private NodeDataWriter nodeWriter;
+    private NodeDataReader nodeReader;
+    
+    public HybridSourceDataBinding() {
+        super();
+        this.xsrReader = new XMLStreamDataReader();
+        this.xswWriter = new XMLStreamDataWriter();
+
+        this.nodeReader = new NodeDataReader();
+        this.nodeWriter = new NodeDataWriter(); 
+    }
+    
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T> DataReader<T> createReader(Class<T> cls) {
+        if (cls == XMLStreamReader.class) {
+            return (DataReader<T>) xsrReader;
+        } else if (cls == Node.class) {
+            return (DataReader<T>) nodeReader;
+        } else {
+            throw new UnsupportedOperationException("The type " + cls.getName() + " is not supported.");
+        }
+    }
+
+    @Override
+    public Class<?>[] getSupportedReaderFormats() {
+        return new Class[] {XMLStreamReader.class, Node.class};
+    }
+    
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T> DataWriter<T> createWriter(Class<T> cls) {
+        if (cls == XMLStreamWriter.class) {
+            return (DataWriter<T>) xswWriter;
+        } else if (cls == Node.class) {
+            return (DataWriter<T>) nodeWriter;
+        } else {
+            throw new UnsupportedOperationException("The type " + cls.getName() + " is not supported.");
+        }
+    }
+    
+    @Override
+    public Class<?>[] getSupportedWriterFormats() {
+        return new Class[] {XMLStreamWriter.class, Node.class};
+    }
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HybridSourceDataBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HybridSourceDataBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java?rev=941623&r1=941622&r2=941623&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanEndpoint.java Thu May  6 09:22:14 2010
@@ -29,6 +29,7 @@ import org.apache.camel.util.CamelContex
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.apache.cxf.transport.ConduitInitiatorManager;
@@ -48,7 +49,8 @@ public class CxfBeanEndpoint extends Pro
     private boolean isSetDefaultBus;
     private CxfBeanBinding cxfBeanBinding = new DefaultCxfBeanBinding();
     private HeaderFilterStrategy headerFilterStrategy = new CxfHeaderFilterStrategy();
-    
+    private boolean loggingFeatureEnabled;
+
     public CxfBeanEndpoint(String remaining, CxfBeanComponent component) {
         super(remaining, component);
     }
@@ -101,15 +103,21 @@ public class CxfBeanEndpoint extends Pro
             bean.setBus(bus);
             bean.setStart(true);
             bean.setAddress("camel://" + createEndpointUri());
+            if (loggingFeatureEnabled) {
+                bean.getFeatures().add(new LoggingFeature());
+            }            
             server = bean.create();
         } else {
-            JAXRSServerFactoryBean answer = new JAXRSServerFactoryBean();
-            answer.setServiceBeans(serviceBeans);
-            answer.setAddress("camel://" + createEndpointUri());
-            answer.setStart(true);
-            answer.setTransportId(CxfBeanTransportFactory.TRANSPORT_ID);
-            answer.setBus(bus);
-            server = answer.create();
+            JAXRSServerFactoryBean bean = new JAXRSServerFactoryBean();
+            bean.setServiceBeans(serviceBeans);
+            bean.setAddress("camel://" + createEndpointUri());
+            bean.setStart(true);
+            bean.setTransportId(CxfBeanTransportFactory.TRANSPORT_ID);
+            bean.setBus(bus);
+            if (loggingFeatureEnabled) {
+                bean.getFeatures().add(new LoggingFeature());
+            }  
+            server = bean.create();
         }
     }
     
@@ -167,5 +175,13 @@ public class CxfBeanEndpoint extends Pro
     public HeaderFilterStrategy getHeaderFilterStrategy() {
         return headerFilterStrategy;
     }
+    
+    public void setLoggingFeatureEnabled(boolean loggingFeatureEnabled) {
+        this.loggingFeatureEnabled = loggingFeatureEnabled;
+    }
+
+    public boolean isLoggingFeatureEnabled() {
+        return loggingFeatureEnabled;
+    }     
 
 }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java?rev=941623&r1=941622&r2=941623&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java Thu May  6 09:22:14 2010
@@ -20,86 +20,40 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.logging.Logger;
 
-import org.apache.camel.component.cxf.interceptors.DOMInInterceptor;
-import org.apache.camel.component.cxf.interceptors.DOMOutInterceptor;
-import org.apache.camel.component.cxf.interceptors.PayloadContentRedirectInterceptor;
+import org.apache.camel.component.cxf.interceptors.ConfigureDocLitWrapperInterceptor;
+import org.apache.camel.component.cxf.interceptors.RemoveClassTypeInterceptor;
 import org.apache.cxf.Bus;
-import org.apache.cxf.binding.Binding;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.interceptor.ClientFaultConverter;
-import org.apache.cxf.phase.Phase;
 
 /**
  * This feature just setting up the CXF endpoint interceptor for handling the
  * Message in PAYLOAD data format
  */
 public class PayLoadDataFormatFeature extends AbstractDataFormatFeature {
-    private static final Logger LOG = LogUtils.getL7dLogger(PayLoadDataFormatFeature.class);
-    // filter the unused phase
-    
-    // PRE_INVOKE needs to be removed.  Otherwise, HolderInInterceptor will interfere us
-    private static final String[] REMOVING_IN_PHASES = {
-        Phase.UNMARSHAL, Phase.PRE_LOGICAL, Phase.PRE_LOGICAL_ENDING, Phase.POST_LOGICAL,
-        Phase.POST_LOGICAL_ENDING, Phase.PRE_INVOKE
-    };
-
-    private static final String[] REMOVING_OUT_PHASES = {
-        Phase.MARSHAL, Phase.MARSHAL_ENDING, Phase.PRE_LOGICAL, Phase.PRE_LOGICAL_ENDING, Phase.POST_LOGICAL,
-        Phase.POST_LOGICAL_ENDING
-    };
-    
+    private static final Logger LOG = LogUtils.getL7dLogger(PayLoadDataFormatFeature.class);    
+
     private static final Collection<Class> REMOVING_FAULT_IN_INTERCEPTORS;
-    
+
+
     static {
         REMOVING_FAULT_IN_INTERCEPTORS = new ArrayList<Class>();
-        // remove ClientFaultConverter as it tries to unmarshal to java object.  
         REMOVING_FAULT_IN_INTERCEPTORS.add(ClientFaultConverter.class);
     }
     
     @Override
     public void initialize(Client client, Bus bus) {
-        removeInterceptorWhichIsInThePhases(client.getInInterceptors(), REMOVING_IN_PHASES);
-        removeInterceptorWhichIsInThePhases(client.getEndpoint().getService().getInInterceptors(), REMOVING_IN_PHASES);
-        removeInterceptorWhichIsInThePhases(client.getEndpoint().getInInterceptors(), REMOVING_IN_PHASES);
-        removeInterceptorWhichIsInThePhases(client.getEndpoint().getBinding().getInInterceptors(), REMOVING_IN_PHASES);
-
-        removeInterceptorWhichIsInThePhases(client.getOutInterceptors(), REMOVING_OUT_PHASES);
-        removeInterceptorWhichIsInThePhases(client.getEndpoint().getService().getOutInterceptors(), REMOVING_OUT_PHASES);
-        removeInterceptorWhichIsInThePhases(client.getEndpoint().getOutInterceptors(), REMOVING_OUT_PHASES);
-        removeInterceptorWhichIsInThePhases(client.getEndpoint().getBinding().getOutInterceptors(), REMOVING_OUT_PHASES);
-        
-        removeInterceptors(client.getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
-        removeInterceptors(client.getEndpoint().getService().getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
-        removeInterceptors(client.getEndpoint().getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
-        removeInterceptors(client.getEndpoint().getBinding().getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
-
-        addDataHandlingInterceptors(client.getEndpoint().getBinding());        
+        removeFaultInInterceptorFromClient(client);
+        client.getEndpoint().getBinding().getInInterceptors().add(new ConfigureDocLitWrapperInterceptor(true));
+        client.getEndpoint().getBinding().getInInterceptors().add(new RemoveClassTypeInterceptor());
     }
 
     @Override
-    public void initialize(Server server, Bus bus) {
-
-        removeInterceptorWhichIsInThePhases(server.getEndpoint().getService().getInInterceptors(), REMOVING_IN_PHASES);
-        removeInterceptorWhichIsInThePhases(server.getEndpoint().getInInterceptors(), REMOVING_IN_PHASES);
-        removeInterceptorWhichIsInThePhases(server.getEndpoint().getBinding().getInInterceptors(), REMOVING_IN_PHASES);
-
-        removeInterceptorWhichIsInThePhases(server.getEndpoint().getService().getOutInterceptors(), REMOVING_OUT_PHASES);
-        removeInterceptorWhichIsInThePhases(server.getEndpoint().getOutInterceptors(), REMOVING_OUT_PHASES);
-        removeInterceptorWhichIsInThePhases(server.getEndpoint().getBinding().getOutInterceptors(), REMOVING_OUT_PHASES);
-        
-        removeInterceptors(server.getEndpoint().getService().getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
-        removeInterceptors(server.getEndpoint().getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
-        removeInterceptors(server.getEndpoint().getBinding().getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
-
-        addDataHandlingInterceptors(server.getEndpoint().getBinding());        
-    }
-
-    private void addDataHandlingInterceptors(Binding binding) {
-        binding.getInInterceptors().add(new DOMInInterceptor());
-        binding.getOutInterceptors().add(new DOMOutInterceptor());
-        binding.getOutInterceptors().add(new PayloadContentRedirectInterceptor());
+    public void initialize(Server server, Bus bus) {               
+        server.getEndpoint().getBinding().getInInterceptors().add(new ConfigureDocLitWrapperInterceptor(true));
+        server.getEndpoint().getBinding().getInInterceptors().add(new RemoveClassTypeInterceptor());
     }
 
     @Override
@@ -107,5 +61,12 @@ public class PayLoadDataFormatFeature ex
         return LOG;
     }
     
+    private void removeFaultInInterceptorFromClient(Client client) {
+        removeInterceptors(client.getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
+        removeInterceptors(client.getEndpoint().getService().getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
+        removeInterceptors(client.getEndpoint().getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);
+        removeInterceptors(client.getEndpoint().getBinding().getInFaultInterceptors(), REMOVING_FAULT_IN_INTERCEPTORS);        
+    }
+
 
 }

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/ConfigureDocLitWrapperInterceptor.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/ConfigureDocLitWrapperInterceptor.java?rev=941623&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/ConfigureDocLitWrapperInterceptor.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/ConfigureDocLitWrapperInterceptor.java Thu May  6 09:22:14 2010
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.cxf.interceptors;
+
+import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
+import org.apache.cxf.interceptor.DocLiteralInInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+
+/**
+ * This interface configures the flag {@link DocLiteralInInterceptor#KEEP_PARAMETERS_WRAPPER}.
+ * 
+ * @version @Revision: 789534 $
+ */
+public class ConfigureDocLitWrapperInterceptor extends AbstractInDatabindingInterceptor {
+
+    boolean unwrapParameterFlag;
+    
+    public ConfigureDocLitWrapperInterceptor(boolean unwrapParameterFlag) {
+        super(Phase.UNMARSHAL);        
+        addBefore(DocLiteralInInterceptor.class.getName());
+        this.unwrapParameterFlag = unwrapParameterFlag;
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        message.put(DocLiteralInInterceptor.KEEP_PARAMETERS_WRAPPER, unwrapParameterFlag);
+    }
+    
+    public boolean isUnwrapParameterFlag() {
+        return unwrapParameterFlag;
+    }
+
+    public void setUnwrapParameterFlag(boolean unwrapParameterFlag) {
+        this.unwrapParameterFlag = unwrapParameterFlag;
+    }
+
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/ConfigureDocLitWrapperInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/ConfigureDocLitWrapperInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RemoveClassTypeInterceptor.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RemoveClassTypeInterceptor.java?rev=941623&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RemoveClassTypeInterceptor.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RemoveClassTypeInterceptor.java Thu May  6 09:22:14 2010
@@ -0,0 +1,89 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+import org.apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingMessageInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+
+/**
+ * This interceptor traverses the {@link BindingOperationInfo} and  
+ * invokes the {@link MessagePartInfo#setTypeQName(javax.xml.namespace.QName)} method to set
+ * the service class to null.  The reason we may want to set the service class to null is 
+ * because CXF will try to use JAXB if the service class is present.  It affects DomSource
+ * payload to be processed correctly.
+ *  
+ * @version @Revision: 789534 $
+ */
+public class RemoveClassTypeInterceptor extends AbstractPhaseInterceptor<Message> {
+
+    public RemoveClassTypeInterceptor() {
+        super(Phase.UNMARSHAL);
+        addBefore(SoapHeaderInterceptor.class.getName());
+
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        Exchange exchange = message.getExchange();
+        BindingOperationInfo bop = exchange.getBindingOperationInfo();
+        
+        if (bop == null) {
+            return;    
+        }
+        
+        if (bop.isUnwrapped()) {
+            bop = bop.getWrappedOperation();
+        }
+
+        if (bop.isUnwrappedCapable()) {
+            removePartTypeClass(bop.getWrappedOperation().getOperationInfo().getInput());
+            removePartTypeClass(bop.getWrappedOperation().getOperationInfo().getOutput());
+            removePartTypeClass(bop.getWrappedOperation().getInput());
+            removePartTypeClass(bop.getWrappedOperation().getOutput());
+        } else {
+            removePartTypeClass(bop.getOperationInfo().getInput());
+            removePartTypeClass(bop.getOperationInfo().getOutput());
+            removePartTypeClass(bop.getInput());
+            removePartTypeClass(bop.getOutput());
+        }
+        
+    }
+
+    protected void removePartTypeClass(BindingMessageInfo bmi) {
+        if (bmi != null) {
+            for (MessagePartInfo part : bmi.getMessageParts()) {
+                part.setTypeClass(null);
+            }     
+        }
+    }
+
+    protected void removePartTypeClass(MessageInfo msgInfo) {
+        if (msgInfo != null) {
+            for (MessagePartInfo part : msgInfo.getMessageParts()) {
+                part.setTypeClass(null);
+            }     
+        }
+    }
+
+}

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RemoveClassTypeInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RemoveClassTypeInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFWsdlOnlyPayloadModeMultiPartNoSpringTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFWsdlOnlyPayloadModeMultiPartNoSpringTest.java?rev=941623&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFWsdlOnlyPayloadModeMultiPartNoSpringTest.java (added)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFWsdlOnlyPayloadModeMultiPartNoSpringTest.java Thu May  6 09:22:14 2010
@@ -0,0 +1,98 @@
+/**
+ * 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.camel.component.cxf;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Holder;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.wsdl_first.PersonMultiPartImpl;
+import org.apache.camel.wsdl_first.PersonMultiPartPortType;
+import org.apache.camel.wsdl_first.PersonMultiPartService;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Unit test that verifies multi part SOAP message functionality
+ * 
+ * @version @Revision: 789534 $
+ */
+public class CXFWsdlOnlyPayloadModeMultiPartNoSpringTest extends CamelTestSupport {
+    
+    protected static final String SERVICE_NAME_PROP =  "serviceName=";
+    protected static final String PORT_NAME_PROP = "portName={http://camel.apache.org/wsdl-first}PersonMultiPartPort";
+    protected static final String WSDL_URL_PROP = "wsdlURL=classpath:person.wsdl";
+    protected static final String SERVICE_ADDRESS = "http://localhost:9093/PersonMultiPart";
+    protected Endpoint endpoint;
+
+    @Before
+    public void startService() {
+        endpoint = Endpoint.publish(SERVICE_ADDRESS, new PersonMultiPartImpl());
+    }
+    
+    @After
+    public void stopService() {
+        if (endpoint != null) {
+            endpoint.stop();
+        }
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("cxf://http://localhost:9000/PersonMultiPart?" + PORT_NAME_PROP + "&" + SERVICE_NAME_PROP + getServiceName() + "&" + WSDL_URL_PROP + "&dataFormat=" 
+                     + getDataFormat() + "&loggingFeatureEnabled=true")                
+                    .to("cxf://http://localhost:9093/PersonMultiPart?" + PORT_NAME_PROP + "&" + SERVICE_NAME_PROP + getServiceName() + "&" + WSDL_URL_PROP + "&dataFormat=" 
+                        + getDataFormat() + "&loggingFeatureEnabled=true");
+            }
+        };
+    }
+ 
+    protected String getDataFormat() {
+        return "PAYLOAD";
+    }
+    
+    @Test
+    public void testMultiPartMessage() {
+        URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
+        PersonMultiPartService ss = new PersonMultiPartService(wsdlURL, QName.valueOf(getServiceName()));
+
+        PersonMultiPartPortType client = ss.getPersonMultiPartPort();       
+        
+        Holder<Integer> ssn = new Holder<Integer>();
+        ssn.value = 0;
+        
+        Holder<String> name = new Holder<String>();
+        name.value = "Unknown name";
+        
+        client.getPersonMultiPartOperation("foo", 0, name, ssn);
+        assertEquals("New Person Name", name.value);
+        assertTrue(123456789 == ssn.value);
+       
+    }
+    
+    protected String getServiceName() {
+        return "{http://camel.apache.org/wsdl-first}PersonMultiPartService";
+    }
+}

Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFWsdlOnlyPayloadModeMultiPartNoSpringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFWsdlOnlyPayloadModeMultiPartNoSpringTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstPayloadModeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstPayloadModeTest.java?rev=941623&r1=941622&r2=941623&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstPayloadModeTest.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstPayloadModeTest.java Thu May  6 09:22:14 2010
@@ -68,10 +68,14 @@ public class CxfWsdlFirstPayloadModeTest
         
         assertTrue(t instanceof UnknownPersonFault);
         
-        // Note: Since unmarshal phase has been removed in PAYLOAD mode,
-        // it is not able to validate against the schema.
+        // schema validation will throw a parse exception
         personId.value = "Invoking getPerson with invalid length string, expecting exception...xxxxxxxxx";
-        client.getPerson(personId, ssn, name);      
+        try {            
+            client.getPerson(personId, ssn, name);
+            fail("We expect to get a message schema validation failure");        
+        } catch (Exception ex) {
+            assertEquals("Could not parse the XML stream.", ex.getMessage());         
+        }
 
         verifyJaxwsHandlers(fromHandler, toHandler);
     }
@@ -83,11 +87,11 @@ public class CxfWsdlFirstPayloadModeTest
     
     @Override
     protected void verifyJaxwsHandlers(JaxwsTestHandler fromHandler, JaxwsTestHandler toHandler) { 
-        assertEquals(1, fromHandler.getFaultCount());
-        assertEquals(5, fromHandler.getMessageCount());
+        assertEquals(2, fromHandler.getFaultCount());
+        assertEquals(4, fromHandler.getMessageCount());
       //From CXF 2.2.7 the soap handler's getHeader() method will not be called if the SOAP message don't have headers
         //assertEquals(8, toHandler.getGetHeadersCount());
-        assertEquals(10, toHandler.getMessageCount());
+        assertEquals(8, toHandler.getMessageCount());
         assertEquals(6, toHandler.getFaultCount());
     }
 

Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonMultiPartImpl.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonMultiPartImpl.java?rev=941623&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonMultiPartImpl.java (added)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonMultiPartImpl.java Thu May  6 09:22:14 2010
@@ -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.camel.wsdl_first;
+
+import javax.xml.ws.Holder;
+
+/**
+ * Test Impl class for PersonMultiPartType port type that verifies multi part SOAP message
+ * functionality.
+ * 
+ * @version @Revision: 789534 $
+ */
+
+
+public class PersonMultiPartImpl implements PersonMultiPartPortType {
+
+    public void getPersonMultiPartOperation(String nameIn, int ssnIn, Holder<String> nameOut,
+                                            Holder<Integer> ssnOut) {
+        
+        nameOut.value = "New Person Name";
+        ssnOut.value = 123456789;
+        
+    }
+
+}

Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonMultiPartImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/wsdl_first/PersonMultiPartImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-cxf/src/test/resources/person.wsdl
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/person.wsdl?rev=941623&r1=941622&r2=941623&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/person.wsdl (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/person.wsdl Thu May  6 09:22:14 2010
@@ -64,6 +64,13 @@
 					</xsd:sequence>
 				</xsd:complexType>
 			</xsd:element>
+
+			<xsd:element name="StringInputElem" type="xsd:string" />
+			<xsd:element name="IntegerInputElem" type="xsd:int" />
+
+			<xsd:element name="StringOutputElem" type="xsd:string" />
+			<xsd:element name="IntegerOutputElem" type="xsd:int" />
+				
 		</xsd:schema>
   </wsdl:types>
 	
@@ -76,6 +83,15 @@
 	<wsdl:message name="UnknownPersonFault">
 		<wsdl:part name="payload" element="typens:UnknownPersonFault"/>
 	</wsdl:message>
+	
+    <wsdl:message name="GetPersonMultiPartRequest">
+		<wsdl:part name="nameIn" element="typens:StringInputElem" />
+		<wsdl:part name="ssnIn" element="typens:IntegerInputElem" />
+	</wsdl:message>
+	<wsdl:message name="GetPersonMultiPartResponse">
+		<wsdl:part name="nameOut" element="typens:StringOutputElem" />
+		<wsdl:part name="ssnOut" element="typens:IntegerOutputElem" />
+	</wsdl:message>
 
     <wsdl:portType name="Person">
 		<wsdl:operation name="GetPerson">
@@ -85,6 +101,13 @@
 		</wsdl:operation>
 	</wsdl:portType>
 	
+	<wsdl:portType name="PersonMultiPartPortType">
+		<wsdl:operation name="GetPersonMultiPartOperation">
+			<wsdl:input message="tns:GetPersonMultiPartRequest" />
+			<wsdl:output message="tns:GetPersonMultiPartResponse" />
+		</wsdl:operation>
+	</wsdl:portType>
+	
     <wsdl:binding name="PersonSOAPBinding" type="tns:Person">
     	<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
 		<wsdl:operation name="GetPerson">
@@ -116,11 +139,11 @@
       </wsdl:operation>
    </wsdl:binding>   
    
-       <wsdl:binding name="PersonSOAPBinding2" type="tns:Person">
-    	<soap:binding style="document" transport="http://cxf.apache.org/transports/camel" />
-		<wsdl:operation name="GetPerson">
-			<wsdl:input>
-				<soap:body use="literal" />
+   <wsdl:binding name="PersonSOAPBinding2" type="tns:Person">
+       <soap:binding style="document" transport="http://cxf.apache.org/transports/camel" />
+	   <wsdl:operation name="GetPerson">
+           <wsdl:input>
+			    <soap:body use="literal" />
 			</wsdl:input>
 			<wsdl:output>
 				<soap:body use="literal" />
@@ -130,6 +153,22 @@
 			</wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
+   
+   <wsdl:binding name="PersonMultiPartSOAPBinding"
+		type="tns:PersonMultiPartPortType">
+		<soap:binding style="document"
+			transport="http://schemas.xmlsoap.org/soap/http" />
+		<wsdl:operation name="GetPersonMultiPartOperation">
+			<soap:operation soapAction="" style="document" />
+			<wsdl:input>
+				<soap:body use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<soap:body use="literal" />
+			</wsdl:output>
+
+		</wsdl:operation>
+	</wsdl:binding>
 
 	<wsdl:service name="PersonService">
     	<wsdl:port binding="tns:PersonSOAPBinding" name="soap">
@@ -148,5 +187,11 @@
        <soap12:address location="http://localhost:8092/PersonService/" />
        </wsdl:port>
    </wsdl:service>      
+   
+	<wsdl:service name="PersonMultiPartService">
+		<wsdl:port name="PersonMultiPartPort" binding="tns:PersonMultiPartSOAPBinding">
+			<soap:address location="http://localhost:9000/PersonMultiPart" />
+		</wsdl:port>
+	</wsdl:service>   
 
 </wsdl:definitions>