camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject svn commit: r735592 [2/2] - in /activemq/camel/trunk: ./ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/ components/camel-cxf/src/main/java/org/apache/camel...
Date Mon, 19 Jan 2009 01:48:42 GMT
Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java?rev=735592&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java Sun Jan 18 17:48:41 2009
@@ -0,0 +1,476 @@
+/**
+ * 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.io.InputStream;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.HeaderFilterStrategyAware;
+import org.apache.camel.component.cxf.transport.CamelTransportConstants;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.binding.soap.SoapHeader;
+import org.apache.cxf.endpoint.Client;
+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.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingMessageInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+
+/**
+ * The Default CXF binding implementation.
+ * 
+ * @version $Revision$
+ */
+public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware {
+    private static final Log LOG = LogFactory.getLog(DefaultCxfBinding.class);
+    private HeaderFilterStrategy headerFilterStrategy;
+
+    // CxfBinding Methods
+    // -------------------------------------------------------------------------
+    
+    /**
+     * <p>
+     * This method is called by {@link CxfProducer#process(Exchange)}. It populates 
+     * the CXF exchange and invocation context (i.e. request/response) contexts, it 
+     * but does not create and populate a CXF message as a ClientImpl's invoke method
+     * will create a new CXF Message.  That method will put all properties from the 
+     * CXF exchange and request context to the CXF message.
+     * </p>
+     */
+    public void populateCxfRequestFromExchange(
+            org.apache.cxf.message.Exchange cxfExchange, Exchange camelExchange,
+            Map<String, Object> requestContext) {
+               
+        // propagate request context
+        Map<String, Object> camelHeaders = camelExchange.getIn().getHeaders();
+        extractInvocationContextFromCamel(camelExchange, camelHeaders,
+                requestContext, Client.REQUEST_CONTEXT);
+                
+        // propagate headers
+        propagateHeadersFromCamelToCxf(camelExchange, camelHeaders, cxfExchange, 
+                requestContext);
+        
+    }
+    
+    /**
+     * This method is called by {@link CxfProducer#process(Exchange)}.  It propagates 
+     * information from CXF Exchange to Camel Exchange.  The CXF Exchange contains a 
+     * request from a CXF server.
+     */
+    public void populateExchangeFromCxfResponse(Exchange camelExchange,
+            org.apache.cxf.message.Exchange cxfExchange, 
+            Map<String, Object> responseContext) {
+      
+        Message cxfMessage = cxfExchange.getInMessage();
+        
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("Populate exchange from CXF response message: " + cxfMessage);
+        }
+        
+        // propagate body
+        camelExchange.getOut().setBody(DefaultCxfBinding.getContentFromCxf(cxfMessage, 
+                camelExchange.getProperty(DataFormat.class.getName(), DataFormat.class)));
+        
+        // propagate response context
+        if (responseContext != null && responseContext.size() > 0) {
+            camelExchange.getOut().setHeader(Client.RESPONSE_CONTEXT, responseContext);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Set header = " + Client.RESPONSE_CONTEXT + " value = " 
+                        + responseContext);
+            }
+        }
+        
+        // propagate protocol headers
+        propagateHeadersFromCxfToCamel(cxfMessage, camelExchange.getOut());
+    }
+    
+    /**
+     * This method is called by {@link CxfConsumer}.
+     */
+    public void populateExchangeFromCxfRequest(org.apache.cxf.message.Exchange cxfExchange,
+            Exchange camelExchange) {
+        
+        Method method = null;
+        QName operationName = null;
+        ExchangePattern mep = ExchangePattern.InOut;
+        
+        // extract binding operation information
+        BindingOperationInfo bop = cxfExchange.get(BindingOperationInfo.class);
+        if (bop != null) {
+            camelExchange.setProperty(BindingOperationInfo.class.getName(), bop);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Set exchange property: BindingOperationInfo: " + bop);
+            }
+
+            Service service = (Service)cxfExchange.get(Service.class); 
+            if (service != null) {
+                MethodDispatcher md = (MethodDispatcher)service
+                    .get(MethodDispatcher.class.getName());
+                if (md != null) {
+                    method = md.getMethod(bop);
+                }
+            }
+            
+            if (bop.getOperationInfo().isOneWay()) {
+                mep = ExchangePattern.InOnly;
+            }
+                
+            operationName = bop.getName();
+        }
+        
+        // set operation name in header
+        if (operationName != null) {
+            camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, 
+                    bop.getName().getNamespaceURI());
+            camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, 
+                    bop.getName().getLocalPart());
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Set IN header: " + CxfConstants.OPERATION_NAMESPACE + "=" 
+                         + bop.getName().getNamespaceURI());
+                LOG.trace("Set IN header: " + CxfConstants.OPERATION_NAME + "=" 
+                        + bop.getName().getLocalPart());
+            }
+        } else if (method != null) {
+            camelExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, method.getName());
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Set IN header: " + CxfConstants.OPERATION_NAME + "=" 
+                        + method.getName());
+            }
+        }
+        
+        // set message exchange pattern
+        camelExchange.setPattern(mep);
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("Set exchange MEP: " + mep);
+        }
+
+        // propagate headers
+        Message cxfMessage = cxfExchange.getInMessage();
+        propagateHeadersFromCxfToCamel(cxfMessage, camelExchange.getIn());
+        
+        // Propagating properties from CXF Exchange to Camel Exchange has an  
+        // side effect of copying reply side stuff when the producer is retried.
+        // So, we do not want to do this.
+        //camelExchange.getProperties().putAll(cxfExchange);
+        
+        // propagate request context
+        Object value = cxfMessage.get(Client.REQUEST_CONTEXT);
+        if (value != null && !headerFilterStrategy.applyFilterToExternalHeaders(
+                Client.REQUEST_CONTEXT, value)) {
+            camelExchange.getIn().setHeader(Client.REQUEST_CONTEXT, value);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Populate context from CXF message " + Client.REQUEST_CONTEXT 
+                        + " value=" + value);
+            }
+        }
+           
+        // set body
+        Object body = DefaultCxfBinding.getContentFromCxf(cxfMessage, 
+                camelExchange.getProperty(DataFormat.class.getName(), DataFormat.class));
+        if (body != null) {
+            camelExchange.getIn().setBody(body);
+        }  
+    }
+
+    /**
+     * This method is called by {@link CxfConsumer} to populate a CXF response exchange 
+     * from a Camel exchange.
+     */
+    public void populateCxfResponseFromExchange(Exchange camelExchange, 
+            org.apache.cxf.message.Exchange cxfExchange) {
+        
+        // create response context
+        Map<String, Object> responseContext = new HashMap<String, Object>();
+        
+        // propagate response context
+        Map<String, Object> camelHeaders = camelExchange.getOut().getHeaders();
+        extractInvocationContextFromCamel(camelExchange, camelHeaders, 
+                responseContext, Client.RESPONSE_CONTEXT);
+      
+        propagateHeadersFromCamelToCxf(camelExchange, camelHeaders, cxfExchange, 
+                responseContext);
+        // create out message
+        Endpoint ep = cxfExchange.get(Endpoint.class);
+        Message outMessage = ep.getBinding().createMessage();
+        cxfExchange.setOutMessage(outMessage);       
+
+        DataFormat dataFormat = camelExchange.getProperty(DataFormat.class.getName(), 
+                DataFormat.class);
+        
+        // propagate contexts
+        if (dataFormat != DataFormat.POJO) {
+            // copying response context to out message seems to cause problem in POJO mode
+            outMessage.putAll(responseContext);
+        }
+        outMessage.put(Client.RESPONSE_CONTEXT, responseContext);      
+        
+        // set body
+        Object outBody = DefaultCxfBinding.getBodyFromCamel(camelExchange.getOut(), dataFormat);
+        
+        if (outBody != null) {
+            if (dataFormat == DataFormat.PAYLOAD) {
+                CxfPayload<?> payload = (CxfPayload)outBody;
+                outMessage.put(List.class, payload.getBody());
+                outMessage.put(Header.HEADER_LIST, payload.getHeaders());
+            } else {
+                MessageContentsList resList = null;
+                if (outBody instanceof MessageContentsList) {
+                    resList = (MessageContentsList)outBody;
+                } else if (outBody instanceof List) {
+                    resList = new MessageContentsList((List)outBody);
+                } else if (outBody.getClass().isArray()) {
+                    resList = new MessageContentsList((Object[])outBody);
+                } else {
+                    resList = new MessageContentsList(outBody);
+                }
+
+                if (resList != null) {
+                    outMessage.setContent(List.class, resList);
+                    if (LOG.isTraceEnabled()) {
+                        LOG.trace("Set Out CXF message content = " + resList);
+                    }
+                }
+            }
+        }         
+       
+        BindingOperationInfo boi = cxfExchange.get(BindingOperationInfo.class);
+        if (boi != null) {
+            cxfExchange.put(BindingMessageInfo.class, boi.getOutput());
+        }
+        
+    }
+
+    
+    // HeaderFilterStrategyAware Methods
+    // -------------------------------------------------------------------------
+    
+
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return headerFilterStrategy;
+    }
+
+    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
+        this.headerFilterStrategy = strategy;
+    }
+
+       
+    // Non public methods
+    // -------------------------------------------------------------------------
+    
+    /**
+     * @param camelExchange
+     * @param cxfContext Request or Response context
+     * @param camelHeaders 
+     * @param contextKey 
+     */
+    @SuppressWarnings("unchecked")
+    protected void extractInvocationContextFromCamel(Exchange camelExchange,
+            Map<String, Object> camelHeaders, Map<String, Object> cxfContext,
+            String contextKey) {
+        
+        // extract from header
+        Map context = (Map)camelHeaders.get(contextKey);
+        if (context != null) {
+            cxfContext.putAll(context);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Propagate " + contextKey + " from header context = " 
+                        + ((context instanceof WrappedMessageContext) 
+                                ? ((WrappedMessageContext)context).getWrappedMap() 
+                                        : context));
+            }
+        }
+        
+        // extract from exchange property
+        context = (Map)camelExchange.getProperty(contextKey);
+        if (context != null) {
+            cxfContext.putAll(context);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Propagate " + contextKey + " from exchange property context = " 
+                        + ((context instanceof WrappedMessageContext) 
+                                ? ((WrappedMessageContext)context).getWrappedMap() 
+                                        : context));
+            }
+        }
+        
+        // copy camel exchange properties into context
+        if (camelExchange.getProperties() != null) {
+            cxfContext.putAll(camelExchange.getProperties());
+        }
+        
+        camelExchange.setProperty(contextKey, cxfContext);
+    }
+
+    /**
+     * @param cxfMessage
+     * @param camelMessage
+     */
+    protected void propagateHeadersFromCxfToCamel(Message cxfMessage,
+            org.apache.camel.Message camelMessage) {
+        
+        Map<String, List<String>> cxfHeaders =
+            CastUtils.cast((Map)cxfMessage.get(Message.PROTOCOL_HEADERS));
+        Map<String, Object> camelHeaders = camelMessage.getHeaders();
+
+        if (cxfHeaders != null) {
+            for (Map.Entry<String, List<String>> entry : cxfHeaders.entrySet()) {
+                if (!headerFilterStrategy.applyFilterToExternalHeaders(entry.getKey(), entry.getValue())) {
+                    camelHeaders.put(entry.getKey(), entry.getValue().get(0));
+                    if (LOG.isTraceEnabled()) {
+                        LOG.trace("Populate header from CXF header=" + entry.getKey() + " value="
+                                + entry.getValue());
+                    }
+                }
+            }
+        }
+
+        // propagate content type
+        String key = Message.CONTENT_TYPE;
+        Object value = cxfMessage.get(key);
+        if (value != null && !headerFilterStrategy.applyFilterToExternalHeaders(key, value)) {
+            camelHeaders.put(CamelTransportConstants.CONTENT_TYPE, value);
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Populate header from CXF header=" + key + " value=" + value);
+            }
+        }
+              
+    }
+
+    protected void propagateHeadersFromCamelToCxf(Exchange camelExchange, 
+            Map<String, Object> camelHeaders,
+            org.apache.cxf.message.Exchange cxfExchange, 
+            Map<String, Object> cxfContext) {
+        
+        // get cxf transport headers (if any) from camel exchange
+        Map<String, List<String>> transportHeaders = new HashMap<String, List<String>>();
+        if (camelExchange != null) {
+            Map<String, List<String>> h = (Map)camelExchange.getProperty(Message.PROTOCOL_HEADERS);
+            if (h != null) {
+                transportHeaders.putAll(h);
+            }
+        }
+        Map<String, List<String>> headers = (Map)camelHeaders.get(Message.PROTOCOL_HEADERS);
+        if (headers != null) {
+            transportHeaders.putAll(headers);
+        }
+            
+        for (Map.Entry<String, Object> entry : camelHeaders.entrySet()) {    
+            // this header should be filtered, continue to the next header
+            if (headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue())) {
+                continue;
+            }
+            
+            // put content type in exchange
+            if (CamelTransportConstants.CONTENT_TYPE.equals(entry.getKey())) {
+                cxfExchange.put(Message.CONTENT_TYPE, entry.getValue());
+                continue;
+            }
+            
+            // put response code in request context so it will be copied to CXF message's property
+            if (Message.RESPONSE_CODE.equals(entry.getKey())) {
+                cxfContext.put(entry.getKey(), entry.getValue());
+                continue;
+            }
+            
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Propagate to CXF header: " + entry.getKey() + " value: " + entry.getValue());
+            }
+            
+            // things that are not filtered and not specifically copied will be put in transport headers
+            if (entry.getValue() instanceof List) {
+                transportHeaders.put(entry.getKey(), (List<String>)entry.getValue());
+            } else {
+                List<String> listValue = new ArrayList<String>();
+                listValue.add(entry.getValue().toString());
+                transportHeaders.put(entry.getKey(), listValue);
+            }
+        }
+        
+        if (transportHeaders.size() > 0) {
+            cxfContext.put(Message.PROTOCOL_HEADERS, transportHeaders);
+        }        
+    }
+
+    protected static Object getContentFromCxf(Message message, DataFormat dataFormat) {
+        Set<Class<?>> contentFormats = message.getContentFormats();
+        Object answer = null;
+        if (contentFormats != null) {
+            
+            if (LOG.isTraceEnabled()) {
+                for (Class<?> contentFormat : contentFormats) {
+                    LOG.trace("Content format=" + contentFormat + " value=" 
+                            + message.getContent(contentFormat));
+                }
+            }
+            
+            if (dataFormat == DataFormat.POJO) {
+                answer = message.getContent(List.class);  
+                if (answer == null) {
+                    answer = message.getContent(Object.class);
+                    if (answer != null) {
+                        answer = new MessageContentsList(answer);
+                    }
+                }
+            } 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);
+            } else if (dataFormat == DataFormat.MESSAGE) {
+                answer = message.getContent(InputStream.class);
+            }
+
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Extracted body from CXF message = " + answer);
+            }
+        }
+        return answer;
+    }
+    
+    public static Object getBodyFromCamel(org.apache.camel.Message out,
+            DataFormat dataFormat) {
+        Object answer = null;
+        
+        if (dataFormat == DataFormat.POJO) {
+            answer = out.getBody();
+        } else if (dataFormat == DataFormat.PAYLOAD) {
+            answer = out.getBody();
+        } else if (dataFormat == DataFormat.MESSAGE) {
+            answer = out.getBody(InputStream.class);
+        }
+        return answer;
+    }
+
+}

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

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

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfConverter.java Sun Jan 18 17:48:41 2009
@@ -17,19 +17,15 @@
 package org.apache.camel.component.cxf.converter;
 
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Map;
 
-import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
 
 import org.apache.camel.Converter;
-import org.apache.camel.Endpoint;
+import org.apache.camel.component.cxf.DataFormat;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.cxf.message.MessageContentsList;
 
-
 /**
  * The <a href="http://activemq.apache.org/camel/type-converter.html">Type Converters</a>
  * for CXF related types' converting .
@@ -72,8 +68,9 @@
         return baos.toString();
     }
 
-
-
-
+    @Converter
+    public static DataFormat toDataFormat(final String name) {
+        return DataFormat.valueOf(name.toUpperCase());
+    }
 
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/AbstractDataFormatFeature.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/AbstractDataFormatFeature.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/AbstractDataFormatFeature.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/AbstractDataFormatFeature.java Sun Jan 18 17:48:41 2009
@@ -20,10 +20,8 @@
 import java.util.List;
 import java.util.logging.Logger;
 
-import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.Interceptor;
-import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptor;
 
 /**
@@ -31,15 +29,8 @@
  */
 public abstract class AbstractDataFormatFeature extends AbstractFeature {
 
-
     protected abstract Logger getLogger();
 
-    protected void resetServiceInvokerInterceptor(Server server) {
-        List<Interceptor> serviceInterceptor = server.getEndpoint().getService().getInInterceptors();
-        removeInterceptorWhichIsInThePhases(serviceInterceptor, new String[]{Phase.INVOKE});
-        serviceInterceptor.add(new MessageInvokerInterceptor());
-    }
-
     protected void removeInterceptorWhichIsInThePhases(List<Interceptor> interceptors, String[] phaseNames) {
         for (Interceptor i : interceptors) {
             if (i instanceof PhaseInterceptor) {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java Sun Jan 18 17:48:41 2009
@@ -28,16 +28,27 @@
 import org.apache.cxf.phase.Phase;
 
 /**
- * This feature just setting up the CXF endpoint interceptor for handling the
- * Message in Message data format
+ * <p> 
+ * MessageDataFormatFeature sets up the CXF endpoint interceptor for handling the
+ * Message in Message data format.  Only the interceptors of these phases are 
+ * <b>preserved</b>:
+ * </p>
+ * <p>
+ * In phases: {Phase.RECEIVE , Phase.INVOKE, Phase.POST_INVOKE}
+ * </p>
+ * <p>
+ * Out phases: {Phase.PREPARE_SEND, Phase.WRITE, Phase.SEND, Phase.PREPARE_SEND_ENDING}
+ * </p>
  */
 public class MessageDataFormatFeature extends AbstractDataFormatFeature {
+    
     private static final Logger LOG = LogUtils.getL7dLogger(MessageDataFormatFeature.class);
-    // interceptor filiter
-    // filiter the unused phase interceptor
-    private static final String[] REMAINING_IN_PHASES = {Phase.RECEIVE , Phase.POST_INVOKE};
-    private static final String[] REMAINING_OUT_PHASES = {Phase.PREPARE_SEND, Phase.WRITE, Phase.SEND, Phase.PREPARE_SEND_ENDING};
-
+    // filter the unused in phase interceptor
+    private static final String[] REMAINING_IN_PHASES = {Phase.RECEIVE , Phase.INVOKE,
+        Phase.POST_INVOKE};
+    // filter the unused in phase interceptor
+    private static final String[] REMAINING_OUT_PHASES = {Phase.PREPARE_SEND, Phase.WRITE, 
+        Phase.SEND, Phase.PREPARE_SEND_ENDING};
 
     @Override
     public void initialize(Client client, Bus bus) {
@@ -56,22 +67,20 @@
 
     @Override
     public void initialize(Server server, Bus bus) {
-        // currently we do not filiter the bus
+        // currently we do not filter the bus
         // remove the interceptors
         removeInterceptorWhichIsOutThePhases(server.getEndpoint().getService().getInInterceptors(), REMAINING_IN_PHASES);
         removeInterceptorWhichIsOutThePhases(server.getEndpoint().getInInterceptors(), REMAINING_IN_PHASES);
+        
         // Do not using the binding interceptor any more
         server.getEndpoint().getBinding().getInInterceptors().clear();
 
         removeInterceptorWhichIsOutThePhases(server.getEndpoint().getService().getOutInterceptors(), REMAINING_OUT_PHASES);
         removeInterceptorWhichIsOutThePhases(server.getEndpoint().getOutInterceptors(), REMAINING_OUT_PHASES);
+        
         // Do not use the binding interceptor any more
         server.getEndpoint().getBinding().getOutInterceptors().clear();
-
         server.getEndpoint().getBinding().getOutFaultInterceptors().add(new FaultOutInterceptor());
-
-
-        resetServiceInvokerInterceptor(server);
         server.getEndpoint().getOutInterceptors().add(new RawMessageContentRedirectInterceptor());
     }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java Sun Jan 18 17:48:41 2009
@@ -36,9 +36,11 @@
 public class PayLoadDataFormatFeature extends AbstractDataFormatFeature {
     private static final Logger LOG = LogUtils.getL7dLogger(PayLoadDataFormatFeature.class);
     // filter the unused phase
-    private static final String[] REMOVING_IN_PHASES = {Phase.UNMARSHAL, Phase.PRE_LOGICAL, Phase.PRE_LOGICAL_ENDING, Phase.POST_LOGICAL, Phase.POST_LOGICAL_ENDING };
+    private static final String[] REMOVING_IN_PHASES = {Phase.UNMARSHAL, Phase.PRE_LOGICAL, 
+        Phase.PRE_LOGICAL_ENDING, Phase.POST_LOGICAL, Phase.POST_LOGICAL_ENDING };
 
-    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 String[] REMOVING_OUT_PHASES = {Phase.MARSHAL, Phase.MARSHAL_ENDING, 
+        Phase.PRE_LOGICAL, Phase.PRE_LOGICAL_ENDING, Phase.POST_LOGICAL, Phase.POST_LOGICAL_ENDING };
 
     @Override
     public void initialize(Client client, Bus bus) {
@@ -67,9 +69,6 @@
         removeInterceptorWhichIsInThePhases(server.getEndpoint().getOutInterceptors(), REMOVING_OUT_PHASES);
         removeInterceptorWhichIsInThePhases(server.getEndpoint().getBinding().getOutInterceptors(), REMOVING_OUT_PHASES);
 
-        // set the invoker interceptor
-        resetServiceInvokerInterceptor(server);
-
         addDataHandlingInterceptors(server.getEndpoint().getBinding());
         server.getEndpoint().getBinding().getOutFaultInterceptors().add(new FaultOutInterceptor());
     }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java Sun Jan 18 17:48:41 2009
@@ -17,7 +17,6 @@
 package org.apache.camel.component.cxf.interceptors;
 
 import java.util.List;
-import java.util.ResourceBundle;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -28,8 +27,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import org.apache.cxf.common.i18n.BundleUtils;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java Sun Jan 18 17:48:41 2009
@@ -17,8 +17,7 @@
 package org.apache.camel.component.cxf.interceptors;
 
 import java.util.List;
-//import java.util.ResourceBundle;
-//import java.util.logging.Level;
+
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
@@ -27,7 +26,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-//import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java Sun Jan 18 17:48:41 2009
@@ -16,13 +16,10 @@
  */
 package org.apache.camel.component.cxf.interceptors;
 
-import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor;
-import org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor;
-import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
@@ -39,10 +36,6 @@
         this.addAfter(CheckFaultInterceptor.class.getName());
     }
 
-    public boolean isRequestor(Message message) {
-        return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
-    }
-
     public void handleMessage(Message message) throws Fault {
         if (message instanceof XMLMessage) {
             xmlInterceptor.handleMessage((XMLMessage)message);

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java Sun Jan 18 17:48:41 2009
@@ -16,13 +16,9 @@
  */
 package org.apache.camel.component.cxf.interceptors;
 
-import java.util.ResourceBundle;
 import java.util.logging.Logger;
-//import java.util.logging.Level;
-//import java.util.logging.Logger;
 
 import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.MessageSenderInterceptor;
@@ -42,10 +38,6 @@
         super(Phase.PREPARE_SEND);
         this.addBefore(MessageSenderInterceptor.class.getName());
     }
-
-    public boolean isRequestor(Message message) {
-        return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
-    }
     
     @SuppressWarnings("unchecked")
     public void handleMessage(Message message) throws Fault {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java Sun Jan 18 17:48:41 2009
@@ -29,7 +29,6 @@
 import org.apache.cxf.message.XMLMessage;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
-import org.apache.cxf.service.model.BindingOperationInfo;
 
 public class FaultOutInterceptor extends AbstractPhaseInterceptor<Message> {
     private static final Logger LOG = LogUtils.getL7dLogger(FaultOutInterceptor.class);
@@ -40,8 +39,6 @@
 
     @SuppressWarnings("unchecked")
     public void handleMessage(Message message) throws Fault {
-        // To walk around the FaultOutInterceptor NPE issue of CXF 2.0.4
-        checkBindingOperationInfor(message);
 
         Throwable ex = message.getContent(Throwable.class);
 
@@ -67,19 +64,4 @@
         }
     }
 
-    /*
-     * This method is used to walk around the NPE issue of CXF 2.0.4
-     * org.apache.cxf.interceptor.FaultOutInterceptor.
-     * This issue was fixed in CXF 2.0.5 and CXF 2.1, when we upgrade CXF to that version
-     * we could remove this method from the interceptor
-     */
-    private void checkBindingOperationInfor(Message message) {
-        BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
-        if (bop == null) {
-            bop = new FakeBindingOperationInfo();
-            message.getExchange().put(BindingOperationInfo.class, bop);
-        }
-
-
-    }
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java Sun Jan 18 17:48:41 2009
@@ -18,6 +18,7 @@
 
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.List;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.cxf.interceptor.Fault;
@@ -41,7 +42,8 @@
             }
         }
 
-        InputStream is = message.getContent(InputStream.class);
+        List<?> params = message.getContent(List.class);
+        InputStream is = (InputStream)params.get(0);
         OutputStream os = message.getContent(OutputStream.class);
 
         try {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageInInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageInInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageInInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageInInterceptor.java Sun Jan 18 17:48:41 2009
@@ -115,8 +115,4 @@
         return partList;
     }
 
-   
-
-    
-
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageOutInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageOutInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageOutInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageOutInterceptor.java Sun Jan 18 17:48:41 2009
@@ -18,7 +18,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.ResourceBundle;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -28,10 +27,7 @@
 import org.w3c.dom.Element;
 
 import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
-import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
-import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.Fault;
@@ -39,7 +35,6 @@
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
-import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
@@ -61,7 +56,7 @@
 
         List<Element> payload = message.get(List.class);
         Exchange exchange = message.getExchange();
-        BindingMessageInfo bmi = exchange.get(BindingMessageInfo.class);
+        BindingMessageInfo bmi = message.get(BindingMessageInfo.class);
         //The soap header is handled by the SoapOutInterceptor
 
         if (LOG.isLoggable(Level.INFO)) {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageInInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageInInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageInInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageInInterceptor.java Sun Jan 18 17:48:41 2009
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import java.util.ResourceBundle;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -34,7 +33,6 @@
 import org.apache.cxf.binding.xml.XMLConstants;
 import org.apache.cxf.binding.xml.XMLFault;
 import org.apache.cxf.bindings.xformat.XMLBindingMessageFormat;
-import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.Fault;

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageOutInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageOutInterceptor.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageOutInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageOutInterceptor.java Sun Jan 18 17:48:41 2009
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import java.util.ResourceBundle;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -30,14 +29,12 @@
 import org.w3c.dom.NodeList;
 
 import org.apache.cxf.bindings.xformat.XMLBindingMessageFormat;
-import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.XMLMessage;
 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.MessagePartInfo;
 
 public class XMLMessageOutInterceptor extends AbstractMessageOutInterceptor<XMLMessage> {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java Sun Jan 18 17:48:41 2009
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.cxf.spring;
 
-
 import java.util.List;
 
 import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/transport/CamelConduit.java Sun Jan 18 17:48:41 2009
@@ -22,7 +22,6 @@
 import java.util.logging.Logger;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java Sun Jan 18 17:48:41 2009
@@ -17,53 +17,29 @@
 package org.apache.camel.component.cxf.util;
 
 import java.lang.annotation.Annotation;
-import java.net.URI;
-import java.net.URL;
-import java.util.logging.Logger;
 
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceProvider;
 
-import org.apache.camel.CamelContext;
 import org.apache.camel.CamelException;
 import org.apache.camel.component.cxf.CxfConstants;
 import org.apache.camel.component.cxf.CxfEndpoint;
-import org.apache.camel.component.cxf.DataFormat;
+import org.apache.camel.component.cxf.CxfSpringEndpoint;
 import org.apache.camel.component.cxf.spring.CxfEndpointBean;
 import org.apache.camel.util.ObjectHelper;
-import org.apache.cxf.Bus;
-import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.ClassHelper;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
-import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
-import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.wsdl11.WSDLServiceFactory;
-
 
 public final class CxfEndpointUtils {
-    public static final String PROP_NAME_PORT = "port";
-    public static final String PROP_NAME_SERVICE = "service";
-    public static final String PROP_NAME_SERVICECLASS = "serviceClass";
-    public static final String PROP_NAME_DATAFORMAT = "dataFormat";
-    public static final String DATAFORMAT_POJO = "pojo";
-    public static final String DATAFORMAT_MESSAGE = "message";
-    public static final String DATAFORMAT_PAYLOAD = "payload";
-    private static final Logger LOG = LogUtils.getL7dLogger(CxfEndpointUtils.class);
 
     private CxfEndpointUtils() {
         // not constructed
     }
 
-    static QName getQName(final String name) {
+    public static QName getQName(final String name) {
         QName qName = null;
         if (name != null) {
             try {
@@ -74,38 +50,14 @@
         }
         return qName;
     }
-    
-    public static Class getServiceClass(CxfEndpoint cxfEndpoint) throws ClassNotFoundException {
-        Class<?> answer = null;
-        if (cxfEndpoint.isSpringContextEndpoint()) {
-            answer = cxfEndpoint.getCxfEndpointBean().getServiceClass();
-            if (answer != null) {
-                return answer;
-            }
-        }
-        if (cxfEndpoint.getServiceClassInstance() != null) {        
-            Object bean = cxfEndpoint.getCamelContext().getRegistry().lookup(cxfEndpoint.getServiceClassInstance());
-            if (bean != null) {
-                answer = ClassHelper.getRealClass(bean);
-            } else {
-                throw new ClassNotFoundException("Can't find serviceClass instace with name" + cxfEndpoint.getServiceClassInstance() + " from CamelContext registry.");
-            }
-        } else {
-            if (ObjectHelper.isNotEmpty(cxfEndpoint.getServiceClass())) {
-                answer = ClassLoaderUtils.loadClass(cxfEndpoint.getServiceClass(), CxfEndpointUtils.class);
-            } else {
-                throw new ClassNotFoundException("Can't find serviceClass from uri, please check the cxf endpoint configuration");
-            }
-        }
-        return answer;
-    }
 
+    // only used by test currently
     public static QName getPortName(final CxfEndpoint endpoint) {
         if (endpoint.getPortName() != null) {
             return getQName(endpoint.getPortName());
         } else {
-            String portLocalName = getCxfEndpointPropertyValue(endpoint, CxfConstants.PORT_LOCALNAME);
-            String portNamespace = getCxfEndpointPropertyValue(endpoint, CxfConstants.PORT_NAMESPACE);
+            String portLocalName = getCxfEndpointPropertyValue((CxfSpringEndpoint)endpoint, CxfConstants.PORT_LOCALNAME);
+            String portNamespace = getCxfEndpointPropertyValue((CxfSpringEndpoint)endpoint, CxfConstants.PORT_NAMESPACE);
             if (portLocalName != null) {
                 return new QName(portNamespace, portLocalName);
             } else {
@@ -114,12 +66,13 @@
         }
     }
 
+    // only used by test currently
     public static QName getServiceName(final CxfEndpoint endpoint) {
         if (endpoint.getServiceName() != null) {
             return getQName(endpoint.getServiceName());
         } else {
-            String serviceLocalName = getCxfEndpointPropertyValue(endpoint, CxfConstants.SERVICE_LOCALNAME);
-            String serviceNamespace = getCxfEndpointPropertyValue(endpoint, CxfConstants.SERVICE_NAMESPACE);
+            String serviceLocalName = getCxfEndpointPropertyValue((CxfSpringEndpoint)endpoint, CxfConstants.SERVICE_LOCALNAME);
+            String serviceNamespace = getCxfEndpointPropertyValue((CxfSpringEndpoint)endpoint, CxfConstants.SERVICE_NAMESPACE);
             if (serviceLocalName != null) {
                 return new QName(serviceNamespace, serviceLocalName);
             } else {
@@ -128,23 +81,6 @@
         }
     }
 
-    public static EndpointInfo getEndpointInfo(final Service service, final CxfEndpoint endpoint) {
-        EndpointInfo endpointInfo = null;
-        final java.util.Collection<EndpointInfo> endpoints = service.getServiceInfos().get(0).getEndpoints();
-        if (endpoints.size() == 1) {
-            endpointInfo = endpoints.iterator().next();
-        } else {
-            final String port = endpoint.getPortName();
-            if (port != null) {
-                final QName endpointName = QName.valueOf(port);
-                endpointInfo = service.getServiceInfos().get(0).getEndpoint(endpointName);
-            }
-            //TBD may be delegate to the EndpointUri params.
-        }
-
-        return endpointInfo;
-    }   
-
     public static boolean hasWebServiceAnnotation(Class<?> cls) {
         return hasAnnotation(cls, WebService.class) || hasAnnotation(cls, WebServiceProvider.class);
     }
@@ -166,7 +102,6 @@
         return hasAnnotation(cls.getSuperclass(), annotation);
     }
 
-
     public static ServerFactoryBean getServerFactoryBean(Class<?> cls) throws CamelException {
         ServerFactoryBean serverFactory  = null;
         try {
@@ -202,108 +137,25 @@
             throw new CamelException(e);
         }
     }
-
-    //TODO check the CxfEndpoint information integration
-    public static void checkEndpointIntegration(CxfEndpoint endpoint, Bus bus) throws CamelException {
-
-        String wsdlLocation = endpoint.getWsdlURL();
-        QName serviceQName = CxfEndpointUtils.getQName(endpoint.getServiceName());
-        String serviceClassName = endpoint.getServiceClass();
-        DataFormat dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
-        URL wsdlUrl = null;
-        if (wsdlLocation != null) {
-            try {
-                wsdlUrl = UriUtils.getWsdlUrl(new URI(wsdlLocation));
-            } catch (Exception e) {
-                throw new CamelException(e);
-            }
-        }
-        if (serviceQName == null) {
-            throw new CamelException(new Message("SVC_QNAME_NOT_FOUND_X", LOG, endpoint.getServiceName()).toString());
-        }
-
-        if (serviceClassName == null && dataFormat == DataFormat.POJO) {
-            throw new CamelException(new Message("SVC_CLASS_PROP_IS_REQUIRED_X", LOG).toString());
-        }
-        AbstractServiceFactoryBean serviceFactory = null;
-        try {
-
-            if (serviceClassName != null) {
-                Class<?> cls = ClassLoaderUtils.loadClass(serviceClassName, CxfEndpointUtils.class);
-
-                boolean isJSR181SEnabled = CxfEndpointUtils.hasWebServiceAnnotation(cls);
-
-                serviceFactory = isJSR181SEnabled
-                    ? new JaxWsServiceFactoryBean() : new ReflectionServiceFactoryBean();
-                serviceFactory.setBus(bus);
-                if (wsdlUrl != null) {
-                    ((ReflectionServiceFactoryBean)serviceFactory).setWsdlURL(wsdlUrl);
-                }
-                if (serviceQName != null) {
-                    ((ReflectionServiceFactoryBean)serviceFactory).setServiceName(serviceQName);
-                }
-                ((ReflectionServiceFactoryBean)serviceFactory).setServiceClass(cls);
-
-            } else {
-                if (wsdlUrl == null) {
-                    throw new CamelException(new Message("SVC_WSDL_URL_IS_NULL_X", LOG, wsdlLocation).toString());
-                }
-                serviceFactory = new WSDLServiceFactory(bus, wsdlUrl, serviceQName);
-            }
-
-        } catch (ClassNotFoundException cnfe) {
-            throw new CamelException(new Message("CLASS_X_NOT_FOUND ", LOG, serviceClassName).toString(), cnfe);
-        } catch (Exception e) {
-            throw new CamelException(e);
+    
+    // only used by test currently
+    public static void checkServiceClassName(String className) throws CamelException {
+        if (ObjectHelper.isEmpty(className)) {
+            throw new CamelException("serviceClass is required for CXF endpoint configuration");
         }
     }
-
-    public static boolean getSetDefaultBus(CxfEndpoint endpoint) {
-        Boolean isSetDefaultBus = null;
-        // check the value of cxfEndpointBean's property
-        CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
-        if (cxfEndpointBean != null && cxfEndpointBean.getProperties() != null) {
-            String value =  (String)cxfEndpointBean.getProperties().get(CxfConstants.SET_DEFAULT_BUS);
-            isSetDefaultBus = Boolean.valueOf(value);
-        }
-        // We will get the value from the cxfEndpontBean's properties
-        if (isSetDefaultBus != null && endpoint.isSetDefaultBus() == null) {
-            return isSetDefaultBus.booleanValue();
-        } else if (endpoint.isSetDefaultBus() != null) {
-            return endpoint.isSetDefaultBus().booleanValue();
-        } else { // return the default value false
-            return false;
-        }
-    }   
     
-    public static String getCxfEndpointPropertyValue(CxfEndpoint endpoint, String property) {
+    // only used by test currently
+    public static String getCxfEndpointPropertyValue(CxfSpringEndpoint endpoint, String property) {
         String result = null;
-        CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
+        CxfEndpointBean cxfEndpointBean = endpoint.getBean();
         if (cxfEndpointBean != null && cxfEndpointBean.getProperties() != null) {
             result = (String) cxfEndpointBean.getProperties().get(property);
         }
         return result;
     }
     
-    public static DataFormat getDataFormat(CxfEndpoint endpoint) throws CamelException {
-        String dataFormatString = endpoint.getDataFormat();
-        if (dataFormatString == null) {
-            dataFormatString = getCxfEndpointPropertyValue(endpoint, CxfConstants.DATA_FORMAT);           
-        }
-
-        // return the default value if nothing is set
-        if (dataFormatString == null) {
-            return DataFormat.POJO;
-        }
-
-        DataFormat retval = DataFormat.asEnum(dataFormatString);
-
-        if (retval == DataFormat.UNKNOWN) {
-            throw new CamelException(new Message("INVALID_MESSAGE_FORMAT_XXXX", LOG, dataFormatString).toString());
-        }
-
-        return retval;
-    }
+    
 }
 
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfHeaderHelper.java Sun Jan 18 17:48:41 2009
@@ -40,7 +40,6 @@
     private CxfHeaderHelper() {
     }
 
-
     /**
      * Progagates Camel headers to CXF message.
      *

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java Sun Jan 18 17:48:41 2009
@@ -18,21 +18,23 @@
 package org.apache.camel.component.cxf;
 
 import junit.framework.TestCase;
-import org.apache.camel.CamelContext;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+/**
+ * A unit test for spring configured cxf endpoint.
+ * 
+ * @version $Revision$
+ */
 public class CxfEndpointTest extends TestCase {
 
     public void testSpringCxfEndpoint() throws Exception {
         ClassPathXmlApplicationContext ctx =
             new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml"});
-        CamelContext camelContext = new SpringCamelContext(ctx);
-        CxfComponent cxfComponent = new CxfComponent(camelContext);
-        CxfEndpoint endpoint = (CxfEndpoint)cxfComponent.createEndpoint("cxf://bean:serviceEndpoint");
+        CxfComponent cxfComponent = new CxfComponent(new SpringCamelContext(ctx));
+        CxfSpringEndpoint endpoint = (CxfSpringEndpoint)cxfComponent.createEndpoint("cxf://bean:serviceEndpoint");
 
-        assertTrue("The endpoint should be the spring context endpoint", endpoint.isSpringContextEndpoint());
         ServerFactoryBean svf = new ServerFactoryBean();
         endpoint.configure(svf);
         assertEquals("Got the wrong endpoint address", svf.getAddress(), "http://localhost:9002/helloworld");

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java Sun Jan 18 17:48:41 2009
@@ -19,7 +19,10 @@
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**
- * The Greeter Payload mode test that is configured with CXF features.
+ * A unit test for testing a CXF client invoking a CXF server via route 
+ * in PAYLOAD mode and with CXF features specified in the Spring config.
+ * 
+ * @version $Revision$
  */
 public class CxfGreeterPayLoadWithFeatureRouterTest extends CXFGreeterRouterTest {
 
@@ -31,8 +34,10 @@
         CxfEndpoint endpoint = getMandatoryEndpoint("cxf:bean:serviceEndpoint?dataFormat=PAYLOAD", 
                 CxfEndpoint.class);
         
-        assertEquals(TestCxfFeature.class, endpoint.getCxfEndpointBean().getFeatures().get(0).getClass());
-        assertEquals(DataFormat.PAYLOAD.toString(), endpoint.getDataFormat());
+        assertEquals(TestCxfFeature.class, ((CxfSpringEndpoint)endpoint).getBean()
+                .getFeatures().get(0).getClass());
+        
+        assertEquals(DataFormat.PAYLOAD, endpoint.getDataFormat());
     }   
 
     @Override

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java Sun Jan 18 17:48:41 2009
@@ -21,10 +21,14 @@
 import org.w3c.dom.Element;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 
+/**
+ * A unit test for testing reading SOAP body in PAYLOAD mode.
+ * 
+ * @version $Revision$
+ */
 public class CxfPayLoadMessageRouterTest extends CxfSimpleRouterTest {
     private String routerEndpointURI = "cxf://" + ROUTER_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=PAYLOAD";
     private String serviceEndpointURI = "cxf://" + SERVICE_ADDRESS + "?" + SERVICE_CLASS + "&dataFormat=PAYLOAD";
@@ -34,14 +38,11 @@
                 // START SNIPPET: payload
                 from(routerEndpointURI).process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
-                        Message inMessage = exchange.getIn();
-                        if (inMessage instanceof CxfMessage) {
-                            CxfMessage message = (CxfMessage) inMessage;
-                            List<Element> elements = message.getMessage().get(List.class);
-                            assertNotNull("We should get the elements here" , elements);
-                            assertEquals("Get the wrong elements size" , elements.size(), 1);
-                            assertEquals("Get the wrong namespace URI" , elements.get(0).getNamespaceURI(), "http://cxf.component.camel.apache.org/");
-                        }                        
+                        CxfPayload<?> payload = exchange.getIn().getBody(CxfPayload.class);
+                        List<Element> elements = payload.getBody();
+                        assertNotNull("We should get the elements here" , elements);
+                        assertEquals("Get the wrong elements size" , elements.size(), 1);
+                        assertEquals("Get the wrong namespace URI" , elements.get(0).getNamespaceURI(), "http://cxf.component.camel.apache.org/");
                     }
                     
                 })

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderTest.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderTest.java Sun Jan 18 17:48:41 2009
@@ -26,7 +26,6 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
-import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.pizza.Pizza;
@@ -37,14 +36,10 @@
 import org.apache.camel.pizza.types.ToppingsListType;
 import org.apache.camel.spring.SpringCamelContext;
 import org.apache.cxf.binding.soap.SoapHeader;
-import org.apache.cxf.headers.Header;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-
-
 public class CxfPayLoadSoapHeaderTest extends CxfRouterTestSupport {
     protected AbstractXmlApplicationContext applicationContext; 
     private final QName serviceName = new QName("http://camel.apache.org/pizza", "PizzaService");
@@ -53,6 +48,7 @@
     private String routerEndpointURI = "cxf:bean:routerEndpoint?dataFormat=PAYLOAD";
     private String serviceEndpointURI = "cxf:bean:serviceEndpoint?dataFormat=PAYLOAD";
     
+    @Override
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
@@ -60,18 +56,19 @@
                 from(routerEndpointURI).process(new Processor() {
                     @SuppressWarnings("unchecked")
                     public void process(Exchange exchange) throws Exception {
-                        Message inMessage = exchange.getIn();
-                        CxfMessage message = (CxfMessage) inMessage;
-                        List<Element> elements = message.getMessage().get(List.class);
-                        assertNotNull("We should get the payload elements here" , elements);
-                        assertEquals("Get the wrong elements size" , elements.size(), 1);
-                        assertEquals("Get the wrong namespace URI" , elements.get(0).getNamespaceURI(), "http://camel.apache.org/pizza/types");
+                        CxfPayload<SoapHeader> payload = exchange.getIn().getBody(CxfPayload.class);
+                        List<Element> elements = payload.getBody();
+                        assertNotNull("We should get the elements here", elements);
+                        assertEquals("Get the wrong elements size", 1, elements.size());
+                        assertEquals("Get the wrong namespace URI", "http://camel.apache.org/pizza/types", 
+                                elements.get(0).getNamespaceURI());
                             
-                        List<SoapHeader> headers = CastUtils.cast((List<?>)message.getMessage().get(Header.HEADER_LIST));
+                        List<SoapHeader> headers = payload.getHeaders();
                         assertNotNull("We should get the headers here", headers);
                         assertEquals("Get the wrong headers size", headers.size(), 1);
-                        assertEquals("Get the wrong namespace URI" , ((Element)(headers.get(0).getObject())).getNamespaceURI(), "http://camel.apache.org/pizza/types");
-                        
+                        assertEquals("Get the wrong namespace URI", 
+                                ((Element)(headers.get(0).getObject())).getNamespaceURI(), 
+                                "http://camel.apache.org/pizza/types");         
                     }
                     
                 })
@@ -86,8 +83,6 @@
         applicationContext = createApplicationContext();
         super.setUp();
         assertNotNull("Should have created a valid spring context", applicationContext);
-
-
     }
 
     @Override
@@ -97,7 +92,7 @@
         }
         super.tearDown();
     }
-
+    
     @Override
     protected void startService() {
         Object implementor = new PizzaImpl();
@@ -105,7 +100,7 @@
         EndpointImpl endpoint = (EndpointImpl) Endpoint.publish(address, implementor);
         server = endpoint.getServer();
     }
-    
+
     public void testPizzaService() {
         Pizza port = getPort();
 
@@ -138,7 +133,6 @@
         return SpringCamelContext.springCamelContext(applicationContext);
     }
 
-
     protected ClassPathXmlApplicationContext createApplicationContext() {
         return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/PizzaEndpoints.xml");
     }

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java Sun Jan 18 17:48:41 2009
@@ -26,7 +26,6 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.cxf.endpoint.Client;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Message;
 
 // We use context to change the producer's endpoint address here
@@ -39,26 +38,31 @@
     private static final String TEST_VALUE = "exchange property value should get passed through request context";
 
     public void testExchangePropertyPropagation() throws Exception {
-        CxfExchange exchange = sendSimpleMessage();
+        Exchange exchange = sendSimpleMessage();
 
+        // No direct access to native CXF Message but we can verify the 
+        // request context from the Camel exchange
         assertNotNull(exchange);
-        assertNotNull(exchange.getInMessage());
-        assertNotNull(exchange.getInMessage().get(Client.REQUEST_CONTEXT));
-        Map<String, Object> requestContext = CastUtils.cast((Map)exchange.getInMessage().get(Client.REQUEST_CONTEXT));
+        Map<String, Object> requestContext = (Map)exchange.getProperty(Client.REQUEST_CONTEXT);
+        assertNotNull(requestContext);
         String actualValue = (String)requestContext.get(TEST_KEY);
         assertEquals("exchange property should get propagated to the request context", TEST_VALUE, actualValue);
+
     }
 
+    @Override   
     protected String getSimpleEndpointUri() {
         return "cxf://http://localhost:9000/simple?serviceClass=org.apache.camel.component.cxf.HelloService";
     }
 
+    @Override   
     protected String getJaxwsEndpointUri() {
         return "cxf://http://localhost:9000/jaxws?serviceClass=org.apache.hello_world_soap_http.Greeter";
-
     }
-    protected CxfExchange sendSimpleMessage() {
-        CxfExchange exchange = (CxfExchange)template.send(getSimpleEndpointUri(), new Processor() {
+    
+    @Override   
+    protected Exchange sendSimpleMessage() {
+        Exchange exchange = template.send(getSimpleEndpointUri(), new Processor() {
             public void process(final Exchange exchange) {
                 final List<String> params = new ArrayList<String>();
                 params.add(TEST_MESSAGE);
@@ -73,8 +77,10 @@
         return exchange;
 
     }
-    protected CxfExchange sendJaxWsMessage() {
-        CxfExchange exchange = (CxfExchange)template.send(getJaxwsEndpointUri(), new Processor() {
+    
+    @Override   
+    protected Exchange sendJaxWsMessage() {
+        Exchange exchange = (Exchange)template.send(getJaxwsEndpointUri(), new Processor() {
             public void process(final Exchange exchange) {
                 final List<String> params = new ArrayList<String>();
                 params.add(TEST_MESSAGE);
@@ -87,4 +93,9 @@
         });
         return exchange;
     }
+    
+    @Override
+    public void testInvokingJaxWsServerWithParams() throws Exception {
+        super.testInvokingJaxWsServerWithParams();
+    }
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java Sun Jan 18 17:48:41 2009
@@ -37,7 +37,6 @@
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.interceptor.Fault;
 import org.apache.hello_world_soap_http.GreeterImpl;
 
 /**
@@ -61,7 +60,6 @@
 
     @Override
     protected void setUp() throws Exception {
-
         // start a simple front service
         ServerFactoryBean svrBean = new ServerFactoryBean();
         svrBean.setAddress(SIMPLE_SERVER_ADDRESS);
@@ -89,7 +87,7 @@
 
 
     public void testInvokingSimpleServerWithParams() throws Exception {
-        CxfExchange exchange = sendSimpleMessage();
+        Exchange exchange = sendSimpleMessage();
 
         org.apache.camel.Message out = exchange.getOut();
         String result = out.getBody(String.class);
@@ -108,12 +106,10 @@
         } catch (RuntimeCamelException ex) {
             // only catch the RuntimeCamelException
         }
-
     }
 
-
     public void testInvokingJaxWsServerWithParams() throws Exception {
-        CxfExchange exchange = sendJaxWsMessage();
+        Exchange exchange = sendJaxWsMessage();
 
         org.apache.camel.Message out = exchange.getOut();
         String result = out.getBody(String.class);
@@ -137,12 +133,12 @@
         return "cxf://" + WRONG_SERVER_ADDRESS + "?serviceClass=org.apache.camel.component.cxf.HelloService";
     }
 
-    protected CxfExchange sendSimpleMessage() {
+    protected Exchange sendSimpleMessage() {
         return sendSimpleMessage(getSimpleEndpointUri());
     }
 
-    private CxfExchange sendSimpleMessage(String endpointUri) {
-        CxfExchange exchange = (CxfExchange)template.send(endpointUri, new Processor() {
+    private Exchange sendSimpleMessage(String endpointUri) {
+        Exchange exchange = template.send(endpointUri, new Processor() {
             public void process(final Exchange exchange) {
                 final List<String> params = new ArrayList<String>();
                 params.add(TEST_MESSAGE);
@@ -153,8 +149,8 @@
         return exchange;
 
     }
-    protected CxfExchange sendJaxWsMessage() {
-        CxfExchange exchange = (CxfExchange)template.send(getJaxwsEndpointUri(), new Processor() {
+    protected Exchange sendJaxWsMessage() {
+        Exchange exchange = template.send(getJaxwsEndpointUri(), new Processor() {
             public void process(final Exchange exchange) {
                 final List<String> params = new ArrayList<String>();
                 params.add(TEST_MESSAGE);

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java Sun Jan 18 17:48:41 2009
@@ -121,8 +121,8 @@
     }
 
     protected void verifyJaxwsHandlers(JaxwsTestHandler fromHandler, JaxwsTestHandler toHandler) {
-        assertEquals(8, fromHandler.getFaultCount());
-        assertEquals(11, fromHandler.getMessageCount());
+        assertEquals(2, fromHandler.getFaultCount());
+        assertEquals(4, fromHandler.getMessageCount());
         assertEquals(7, toHandler.getGetHeadersCount());
         
     }

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java Sun Jan 18 17:48:41 2009
@@ -26,7 +26,6 @@
 import org.apache.camel.component.cxf.CxfComponent;
 import org.apache.camel.component.cxf.CxfEndpoint;
 import org.apache.camel.component.cxf.DataFormat;
-import org.apache.camel.component.cxf.HelloServiceImpl;
 import org.apache.camel.impl.DefaultCamelContext;
 
 public class CxfEndpointUtilsTest extends TestCase {
@@ -61,28 +60,27 @@
     protected CxfEndpoint createEndpoint(String uri) throws Exception {
         CamelContext context = getCamelContext();
         return (CxfEndpoint)new CxfComponent(context).createEndpoint(uri);
-    }      
+    }
 
     public void testGetProperties() throws Exception {
         CxfEndpoint endpoint = createEndpoint(getEndpointURI());
         QName service = CxfEndpointUtils.getQName(endpoint.getServiceName());
         assertEquals("We should get the right service name", service, SERVICE_NAME);
-        assertEquals("We should get the setDefaultBus value", CxfEndpointUtils.getSetDefaultBus(endpoint) , true);
     }
 
     public void testGetDataFormat() throws Exception {
         CxfEndpoint endpoint = createEndpoint(getEndpointURI() + "&dataFormat=MESSAGE");
-        assertEquals("We should get the Message DataFormat", CxfEndpointUtils.getDataFormat(endpoint), DataFormat.MESSAGE);
+        assertEquals("We should get the Message DataFormat", DataFormat.MESSAGE, endpoint.getDataFormat());
     }
 
     public void testCheckServiceClassWithTheEndpoint() throws Exception {
         CxfEndpoint endpoint = createEndpoint(getNoServiceClassURI());
         try {
-            CxfEndpointUtils.getServiceClass(endpoint);
+            CxfEndpointUtils.checkServiceClassName(endpoint.getServiceClass());
             fail("Should get a CamelException here");
-        } catch (ClassNotFoundException exception) {
-            assertNotNull("Should get a ClassNotFoundExceptionException here", exception);
-            assertEquals("Can't find serviceClass from uri, please check the cxf endpoint configuration", exception.getMessage());
+        } catch (CamelException exception) {
+            assertNotNull("Should get a CamelException here", exception);
+            assertEquals("serviceClass is required for CXF endpoint configuration", exception.getMessage());
         }
     }
 
@@ -90,9 +88,8 @@
         CxfEndpoint endpoint = createEndpoint(getNoServiceClassURI());
         try {
             endpoint.createProducer();
-        } catch (ClassNotFoundException exception) {
-            assertNotNull("Should get a ClassNotFoundException here", exception);
-            assertEquals("Can't find serviceClass from uri, please check the cxf endpoint configuration", exception.getMessage());
+        } catch (IllegalArgumentException exception) {
+            assertNotNull("Should get a CamelException here", exception);
         }
     }
 
@@ -100,9 +97,9 @@
         CxfEndpoint endpoint = createEndpoint(getNoServiceClassURI());
         try {
             endpoint.createConsumer(new NullProcessor());
-        } catch (ClassNotFoundException exception) {
-            assertNotNull("Should get a ClassNotFoundException here", exception);
-            assertEquals("Can't find serviceClass from uri, please check the cxf endpoint configuration", exception.getMessage());
+        } catch (IllegalArgumentException exception) {
+            assertNotNull("Should get a CamelException here", exception);
+            assertTrue(exception.getMessage().startsWith("serviceClass must be specified"));
         }
     }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java Sun Jan 18 17:48:41 2009
@@ -20,8 +20,8 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.component.cxf.CxfEndpoint;
+import org.apache.camel.component.cxf.CxfSpringEndpoint;
 import org.apache.camel.component.cxf.DataFormat;
-import org.apache.camel.component.cxf.HelloServiceImpl;
 import org.apache.camel.spring.SpringCamelContext;
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -61,36 +61,24 @@
     protected String getNoServiceClassURI() {
         return "cxf:bean:noServiceClassEndpoint";
     }
-    
+
     public void testGetServiceClass() throws Exception {
-        CxfEndpoint endpoint = createEndpoint("cxf:bean:helloServiceEndpoint?serviceClassInstance=helloServiceImpl");        
-        Class clazz = CxfEndpointUtils.getServiceClass(endpoint);
-        assertNotNull("The service calss should not be null ", clazz);
-        assertTrue("The service class should be the instance of HelloServiceImpl", clazz.equals(HelloServiceImpl.class));
+        CxfEndpoint endpoint = createEndpoint("cxf:bean:helloServiceEndpoint?serviceClass=#helloServiceImpl");      
+        assertEquals("org.apache.camel.component.cxf.HelloServiceImpl", endpoint.getServiceClass());
     }
-
+    
     public void testGetDataFormat() throws Exception {
         CxfEndpoint endpoint = createEndpoint(getEndpointURI() + "?dataFormat=MESSAGE");
-        assertEquals("We should get the Message DataFormat", CxfEndpointUtils.getDataFormat(endpoint),
-                     DataFormat.MESSAGE);
-    }
-
-    public void testGetURIOverCxfEndpointProperties() throws Exception {
-        CxfEndpoint endpoint = createEndpoint(getEndpointURI() + "?setDefaultBus=false");
-        assertEquals("We should get the setDefaultBus value", CxfEndpointUtils.getSetDefaultBus(endpoint),
-                     false);
-
+        assertEquals("We should get the Message DataFormat", DataFormat.MESSAGE, endpoint.getDataFormat());
     }
 
     public void testGetProperties() throws Exception {
-        CxfEndpoint endpoint = createEndpoint(getEndpointURI());
-        QName service = endpoint.getCxfEndpointBean().getServiceName();
+        CxfSpringEndpoint endpoint = (CxfSpringEndpoint)createEndpoint(getEndpointURI());
+        QName service = endpoint.getBean().getServiceName();
         assertEquals("We should get the right service name", service, SERVICE_NAME);
-        assertEquals("We should get the setDefaultBus value", CxfEndpointUtils.getSetDefaultBus(endpoint),
-                     true);
-        assertEquals("The cxf endpoint's DataFromat should be MESSAGE", CxfEndpointUtils.getDataFormat(endpoint), DataFormat.MESSAGE);
+        assertEquals("The cxf endpoint's DataFromat should be MESSAGE", DataFormat.MESSAGE, endpoint.getDataFormat());
         
-        endpoint = createEndpoint("cxf:bean:testPropertiesEndpoint");
+        endpoint = (CxfSpringEndpoint)createEndpoint("cxf:bean:testPropertiesEndpoint");
         service = CxfEndpointUtils.getServiceName(endpoint);
         assertEquals("We should get the right service name", service, SERVICE_NAME);
         QName port = CxfEndpointUtils.getPortName(endpoint);
@@ -99,8 +87,7 @@
 
     public void testGetDataFormatFromCxfEndpontProperties() throws Exception {
         CxfEndpoint endpoint = createEndpoint(getEndpointURI() + "?dataFormat=PAYLOAD");
-        assertEquals("We should get the PAYLOAD DataFormat", CxfEndpointUtils.getDataFormat(endpoint),
-                     DataFormat.PAYLOAD);
+        assertEquals("We should get the PAYLOAD DataFormat", DataFormat.PAYLOAD, endpoint.getDataFormat());
     }
 
 

Modified: activemq/camel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/pom.xml?rev=735592&r1=735591&r2=735592&view=diff
==============================================================================
--- activemq/camel/trunk/pom.xml (original)
+++ activemq/camel/trunk/pom.xml Sun Jan 18 17:48:41 2009
@@ -43,7 +43,7 @@
     <!-- Note that activemq dependency is only used for testing! -->
     <activemq-version>5.2.0</activemq-version>
     <apacheds-version>1.5.4</apacheds-version>
-    <cxf-version>2.1.3</cxf-version>
+    <cxf-version>2.2-SNAPSHOT</cxf-version>
     <felix-version>1.4.1</felix-version>
     <felix-osgi-version>1.2.0</felix-osgi-version>
     <httpcore-version>4.0-beta3</httpcore-version>



Mime
View raw message