camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r628425 - in /activemq/camel/trunk/components/camel-cxf: ./ src/main/java/org/apache/camel/component/cxf/ src/main/java/org/apache/camel/component/cxf/feature/ src/main/java/org/apache/camel/component/cxf/interceptors/ src/test/java/org/apa...
Date Sun, 17 Feb 2008 04:51:26 GMT
Author: ningjiang
Date: Sat Feb 16 20:51:18 2008
New Revision: 628425

URL: http://svn.apache.org/viewvc?rev=628425&view=rev
Log:
CAMEL-338 Getting the cxf-consumer to work with PAYLOAD and MESSAGE data format by setting the features

Added:
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/MessageInvoker.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/AbstractDataFormatFeature.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageInvokerInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterMessageRouterTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadRouterTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointsRouterContext.xml
      - copied unchanged from r628233, activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml
Modified:
    activemq/camel/trunk/components/camel-cxf/pom.xml
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageInInterceptor.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageOutInterceptor.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java
    activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml

Modified: activemq/camel/trunk/components/camel-cxf/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/pom.xml?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/pom.xml (original)
+++ activemq/camel/trunk/components/camel-cxf/pom.xml Sat Feb 16 20:51:18 2008
@@ -222,6 +222,7 @@
       <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+          <forkMode>pertest</forkMode>
           <childDelegation>false</childDelegation>
           <useFile>true</useFile>
           <includes>
@@ -235,7 +236,7 @@
           </systemProperties>             
         </configuration>
       </plugin>
-    </plugins>
+    </plugins>  
   </build>
 
   <profiles>

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java Sat Feb 16 20:51:18 2008
@@ -41,9 +41,10 @@
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.invoker.AbstractInvoker;
 import org.apache.cxf.service.invoker.Invoker;
+import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 
-public class CamelInvoker implements Invoker  {
+public class CamelInvoker implements Invoker, MessageInvoker {
     private static final Logger LOG = Logger.getLogger(CamelInvoker.class.getName());
     private CxfConsumer cxfConsumer;
 
@@ -56,16 +57,11 @@
     * be passed into the camel processor. The return value is the response
     * from the processor
     * @param inMessage
-    * @return outMessage
     */
-    public Message invoke(Message inMessage) {
-        Exchange exchange = inMessage.getExchange();
+    public void invoke(Exchange exchange) {
+        Message inMessage = exchange.getInMessage();
 
-        //Set Request Context into CXF Message
-        Map<String, Object> ctxContainer = new HashMap<String, Object>();
-        Map<String, Object> requestCtx = new HashMap<String, Object>();
-        ctxContainer.put(Client.REQUEST_CONTEXT, requestCtx);
-        updateContext(inMessage, requestCtx);
+        //TODO set the request context here
         CxfEndpoint endpoint = (CxfEndpoint) cxfConsumer.getEndpoint();
         CxfExchange cxfExchange = endpoint.createExchange(inMessage);
         try {
@@ -75,45 +71,44 @@
             throw new Fault(ex);
         }
 
-        // make sure the client has retrun back the message
-        Message outMessage = getCxfMessage(cxfExchange, exchange);
+        // make sure the client has return back the message
+        copybackExchange(cxfExchange, exchange);
 
-        //Set Response Context into CXF Message
-        /*ctxContainer = (Map<String, Object>)outMessage.getProperty(CxfMessageAdapter.REQ_RESP_CONTEXT);
-        Map<String, Object> respCtx = (Map<String, Object>)ctxContainer.get(Client.RESPONSE_CONTEXT);
-        updateContext(respCtx, outMessage);*/
+        Message outMessage = exchange.getOutMessage();
+        // update the outMessageContext
+        outMessage.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
+        BindingOperationInfo boi = exchange.get(BindingOperationInfo.class);
 
-        return outMessage;
+        if (boi != null) {
+            exchange.put(BindingMessageInfo.class, boi.getOutput());
+        }
     }
 
 
-    public Message getCxfMessage(CxfExchange result, Exchange exchange) {
+    public void copybackExchange(CxfExchange result, Exchange exchange) {
+        final Endpoint endpoint = exchange.get(Endpoint.class);
         Message outMessage = null;
         if (result.isFailed()) {
             CxfMessage fault = result.getFault();
             outMessage = exchange.getInFaultMessage();
-            //REVISIT ?
             if (outMessage == null) {
-                outMessage = new MessageImpl();
-                //outMessage.setExchange(exchange);
+                outMessage = endpoint.getBinding().createMessage();
+                outMessage.setExchange(exchange);
                 exchange.setInFaultMessage(outMessage);
             }
             Exception ex = (Exception) fault.getBody();
             outMessage.setContent(Exception.class, ex);
         } else {
+            outMessage = result.getOutMessage();
             if (LOG.isLoggable(Level.FINEST)) {
-                LOG.finest("Payload is a response.");
+                LOG.finest("Get the response outMessage " + outMessage);
             }
-            // get the payload message
-            outMessage = result.getOutMessage();
             if (outMessage == null) {
-                Endpoint ep = exchange.get(Endpoint.class);
-                outMessage = ep.getBinding().createMessage();
-                exchange.setOutMessage(outMessage);
+                outMessage = endpoint.getBinding().createMessage();
             }
+            exchange.setOutMessage(outMessage);
         }
 
-        return outMessage;
     }
 
     @SuppressWarnings("unchecked")
@@ -183,7 +178,6 @@
         } else {
             result = cxfExchange.getOut().getBody();
         }
-
         return result;
     }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java Sat Feb 16 20:51:18 2008
@@ -17,10 +17,14 @@
 package org.apache.camel.component.cxf;
 
 import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
 
 import javax.xml.ws.WebServiceProvider;
 
 import org.apache.camel.Processor;
+import org.apache.camel.component.cxf.feature.MessageDataFormatFeature;
+import org.apache.camel.component.cxf.feature.PayLoadDataFormatFeature;
 import org.apache.camel.component.cxf.spring.CxfEndpointBean;
 import org.apache.camel.component.cxf.util.CxfEndpointUtils;
 import org.apache.camel.component.cxf.util.UriUtils;
@@ -31,12 +35,13 @@
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.endpoint.ServerImpl;
+import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
 
-
 /**
  * A consumer of exchanges for a service in CXF
  *
@@ -51,58 +56,64 @@
         super(endpoint, processor);
         this.endpoint = endpoint;
         boolean isWebServiceProvider = false;
-        try {
-            // now we just use the default bus here
-            Bus bus = BusFactory.getDefaultBus();
-            ServerFactoryBean svrBean = null;
-
-            if (endpoint.isSpringContextEndpoint()) {
-                CxfEndpointBean endpointBean = endpoint.getCxfEndpointBean();
-                svrBean = CxfEndpointUtils.getServerFactoryBean(endpointBean.getServiceClass());
-                isWebServiceProvider = CxfEndpointUtils.hasAnnotation(endpointBean.getServiceClass(), WebServiceProvider.class);
-                endpoint.configure(svrBean);
-                CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
-                if (cxfEndpointBean.getServiceName() != null) {
-                    svrBean.setServiceName(cxfEndpointBean.getServiceName());
-                }
-                if (cxfEndpointBean.getEndpointName() != null) {
-                    svrBean.setEndpointName(cxfEndpointBean.getEndpointName());
-                }
-
-            } else { // setup the serverFactoryBean with the URI paraments
-                Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
-                svrBean = CxfEndpointUtils.getServerFactoryBean(serviceClass);
-                isWebServiceProvider = CxfEndpointUtils.hasAnnotation(serviceClass, WebServiceProvider.class);
-                svrBean.setAddress(endpoint.getAddress());
-                svrBean.setServiceClass(serviceClass);
-                if (endpoint.getServiceName() != null) {
-                    svrBean.setServiceName(CxfEndpointUtils.getServiceName(endpoint));
-                }
-                if (endpoint.getPortName() != null) {
-                    svrBean.setEndpointName(CxfEndpointUtils.getPortName(endpoint));
-                }
-                if (endpoint.getWsdlURL() != null) {
-                    svrBean.setWsdlURL(endpoint.getWsdlURL());
-                }
-            }
-            DataFormat dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
-            if (dataFormat.equals(DataFormat.POJO) || isWebServiceProvider) {
-            	svrBean.setInvoker(new CamelInvoker(this));
-            }
-            svrBean.setBus(bus);
-            svrBean.setStart(false);
-            server = svrBean.create();
-            if(!dataFormat.equals(DataFormat.POJO) && !isWebServiceProvider) {
-                CxfMessageObserver observer = new CxfMessageObserver(this, server.getEndpoint(), bus , dataFormat);
-                //set the message observer for the Message and PayLoad mode message
-                ServerImpl serverImpl = (ServerImpl)server;
-                serverImpl.setMessageObserver(observer);
-            }
-
-        } catch (Exception ex) {
-            // create Consumer endpoint failed
-            ex.printStackTrace();
+
+        // now we just use the default bus here
+        Bus bus = BusFactory.getDefaultBus();
+        ServerFactoryBean svrBean = null;
+
+        if (endpoint.isSpringContextEndpoint()) {
+            CxfEndpointBean endpointBean = endpoint.getCxfEndpointBean();
+            svrBean = CxfEndpointUtils.getServerFactoryBean(endpointBean.getServiceClass());
+            isWebServiceProvider = CxfEndpointUtils.hasAnnotation(endpointBean.getServiceClass(),
+                                                                  WebServiceProvider.class);
+            endpoint.configure(svrBean);
+            CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
+            if (cxfEndpointBean.getServiceName() != null) {
+                svrBean.setServiceName(cxfEndpointBean.getServiceName());
+            }
+            if (cxfEndpointBean.getEndpointName() != null) {
+                svrBean.setEndpointName(cxfEndpointBean.getEndpointName());
+            }
+
+        } else { // setup the serverFactoryBean with the URI paraments
+            Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
+            svrBean = CxfEndpointUtils.getServerFactoryBean(serviceClass);
+            isWebServiceProvider = CxfEndpointUtils.hasAnnotation(serviceClass, WebServiceProvider.class);
+            svrBean.setAddress(endpoint.getAddress());
+            svrBean.setServiceClass(serviceClass);
+            if (endpoint.getServiceName() != null) {
+                svrBean.setServiceName(CxfEndpointUtils.getServiceName(endpoint));
+            }
+            if (endpoint.getPortName() != null) {
+                svrBean.setEndpointName(CxfEndpointUtils.getPortName(endpoint));
+            }
+            if (endpoint.getWsdlURL() != null) {
+                svrBean.setWsdlURL(endpoint.getWsdlURL());
+            }
         }
+        DataFormat dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
+
+        svrBean.setInvoker(new CamelInvoker(this));
+
+        // apply the feature here
+        if (!dataFormat.equals(DataFormat.POJO) && !isWebServiceProvider) {
+            List<AbstractFeature> features = new ArrayList<AbstractFeature>();
+
+            if (dataFormat.equals(DataFormat.PAYLOAD)) {
+                features.add(new PayLoadDataFormatFeature());
+                // add the logging feature here
+                features.add(new LoggingFeature());
+            }
+            if (dataFormat.equals(DataFormat.MESSAGE)) {
+                features.add(new MessageDataFormatFeature());
+            }
+            svrBean.setFeatures(features);
+
+        }
+        svrBean.setBus(bus);
+        svrBean.setStart(false);
+        server = svrBean.create();
+
     }
 
     @Override
@@ -121,6 +132,5 @@
     public CxfEndpoint getEndpoint() {
         return endpoint;
     }
-
 
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java Sat Feb 16 20:51:18 2008
@@ -38,11 +38,17 @@
     public CxfExchange(CamelContext context, Exchange exchange) {
         super(context);
         this.exchange = exchange;
-
-        setIn(new CxfMessage(exchange.getInMessage()));
-        setOut(new CxfMessage(exchange.getOutMessage()));
-        if (exchange.getInFaultMessage() != null) {
-            setFault(new CxfMessage(exchange.getInFaultMessage()));
+        // TO avoid the NPE here
+        if (exchange != null) {
+            if (exchange.getOutMessage() != null) {
+                setOut(new CxfMessage(exchange.getOutMessage()));
+            }
+            if (exchange.getInMessage() != null) {
+                setIn(new CxfMessage(exchange.getInMessage()));
+            }
+            if (exchange.getInFaultMessage() != null) {
+                setFault(new CxfMessage(exchange.getInFaultMessage()));
+            }
         }
     }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Sat Feb 16 20:51:18 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.cxf;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.camel.CamelException;
@@ -76,15 +77,21 @@
 
     private Client createClientForStreamMessge() throws CamelException {
         CxfClientFactoryBean cfb = new CxfClientFactoryBean();
-        if (null != endpoint.getServiceClass()) {
+        Class serviceClass = null;
+        if (endpoint.isSpringContextEndpoint()) {
+            CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
+            serviceClass = cxfEndpointBean.getServiceClass();
+        } else {
             try {
-                Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
-                boolean jsr181Enabled = CxfEndpointUtils.hasWebServiceAnnotation(serviceClass);
-                cfb.setJSR181Enabled(jsr181Enabled);
+                serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
             } catch (ClassNotFoundException e) {
                 throw new CamelException(e);
             }
         }
+
+        boolean jsr181Enabled = CxfEndpointUtils.hasWebServiceAnnotation(serviceClass);
+        cfb.setJSR181Enabled(jsr181Enabled);
+
         return createClientFormClientFactoryBean(cfb);
     }
 
@@ -92,13 +99,12 @@
     private Client createClientFormClientFactoryBean(ClientFactoryBean cfb) throws CamelException {
         Bus bus = BusFactory.getDefaultBus();
         if (endpoint.isSpringContextEndpoint()) {
-            CxfEndpointBean endpointBean = endpoint.getCxfEndpointBean();
+            CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
             if (cfb == null) {
-                cfb = CxfEndpointUtils.getClientFactoryBean(endpointBean.getServiceClass());
+                cfb = CxfEndpointUtils.getClientFactoryBean(cxfEndpointBean.getServiceClass());
             }
             endpoint.configure(cfb);
 
-            CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
             if (cxfEndpointBean.getServiceName() != null) {
                 cfb.setServiceName(cxfEndpointBean.getServiceName());
             }
@@ -163,20 +169,22 @@
             if (dataFormat.equals(DataFormat.POJO)) {
                 //InputStream is = m.getContent(InputStream.class);
                 // now we just deal with the POJO invocations
-                List paraments = inMessage.getContent(List.class);
+                List parameters = inMessage.getContent(List.class);
+                if (parameters == null) {
+                    parameters = new ArrayList();
+                }
                 String operationName = (String)inMessage.get(CxfConstants.OPERATION_NAME);
                 String operationNameSpace = (String)inMessage.get(CxfConstants.OPERATION_NAMESPACE);
                 Message response = new MessageImpl();
-                if (operationName != null && paraments != null) {
-                    // now we just deal with the invoking the paraments
+                if (operationName != null) {
                     // we need to check out the operation Namespace
                     try {
                         Object[] result = null;
                         if (operationNameSpace == null) {
-                            result = client.invoke(operationName, paraments.toArray());
+                            result = client.invoke(operationName, parameters.toArray());
                         } else {
                             QName operation = new QName(operationNameSpace, operationName);
-                            result = client.invoke(operation, paraments.toArray());
+                            result = client.invoke(operation, parameters.toArray());
                         }
                         response.setContent(Object[].class, result);
                         cxfBinding.storeCxfResponse(exchange, response);
@@ -184,6 +192,8 @@
                         response.setContent(Exception.class, ex);
                         cxfBinding.storeCxfFault(exchange, response);
                     }
+                } else {
+                    throw new RuntimeCamelException("Can't find the operation name in the message!");
                 }
             } else {
                 // get the invocation context

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/MessageInvoker.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/MessageInvoker.java?rev=628425&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/MessageInvoker.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/MessageInvoker.java Sat Feb 16 20:51:18 2008
@@ -0,0 +1,36 @@
+/**
+ * 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 org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+
+/**
+ * The interface to provide a CXF message invoke method
+ */
+public interface MessageInvoker {
+
+    /**
+     * This method is called when the incoming message is to
+     * be passed into the camel processor. The return value is the response
+     * from the processor
+     * @param the cxf exchange which holds the in and out message
+     */
+     public void invoke(Exchange exchange);
+
+}

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

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

Added: 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=628425&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/AbstractDataFormatFeature.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/AbstractDataFormatFeature.java Sat Feb 16 20:51:18 2008
@@ -0,0 +1,77 @@
+/**
+ * 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.feature;
+
+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;
+
+/**
+ * The abstract class for the data format feature
+ */
+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) {
+                PhaseInterceptor p = (PhaseInterceptor)i;
+                for (String phaseName : phaseNames) {
+                    if (p.getPhase().equals(phaseName)) {
+                        getLogger().info("removing the interceptor " + p);
+                        interceptors.remove(p);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    protected void removeInterceptorWhichIsOutThePhases(List<Interceptor> interceptors, String[] phaseNames) {
+        for (Interceptor i : interceptors) {
+            boolean outside = false;
+            if (i instanceof PhaseInterceptor) {
+                PhaseInterceptor p = (PhaseInterceptor)i;
+                for (String phaseName : phaseNames) {
+                    if (p.getPhase().equals(phaseName)) {
+                        outside = true;
+                        break;
+                    }
+                }
+                if (!outside) {
+                    getLogger().info("removing the interceptor " + p);
+                    interceptors.remove(p);
+                }
+            }
+        }
+    }
+
+}

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

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

Added: 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=628425&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageDataFormatFeature.java Sat Feb 16 20:51:18 2008
@@ -0,0 +1,81 @@
+/**
+ * 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.feature;
+
+import java.util.logging.Logger;
+
+import org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor;
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.phase.Phase;
+
+/**
+ * This feature just setting up the CXF endpoint interceptor for handling the
+ * Message in Message data format
+ */
+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};
+
+
+    @Override
+    public void initialize(Client client, Bus bus) {
+
+        removeInterceptorWhichIsOutThePhases(client.getInInterceptors(), REMAINING_IN_PHASES);
+        removeInterceptorWhichIsOutThePhases(client.getEndpoint().getService().getInInterceptors(), REMAINING_IN_PHASES);
+        removeInterceptorWhichIsOutThePhases(client.getEndpoint().getInInterceptors(), REMAINING_IN_PHASES);
+        removeInterceptorWhichIsOutThePhases(client.getEndpoint().getBinding().getInInterceptors(), REMAINING_IN_PHASES);
+
+        removeInterceptorWhichIsOutThePhases(client.getOutInterceptors(), REMAINING_IN_PHASES);
+        removeInterceptorWhichIsOutThePhases(client.getEndpoint().getService().getOutInterceptors(), REMAINING_IN_PHASES);
+        removeInterceptorWhichIsOutThePhases(client.getEndpoint().getOutInterceptors(), REMAINING_IN_PHASES);
+        removeInterceptorWhichIsOutThePhases(client.getEndpoint().getBinding().getOutInterceptors(), REMAINING_IN_PHASES);
+
+
+    }
+
+    @Override
+    public void initialize(Server server, Bus bus) {
+        // currently we do not filiter 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();
+
+
+        resetServiceInvokerInterceptor(server);
+        server.getEndpoint().getService().getOutInterceptors().add(new RawMessageContentRedirectInterceptor());
+    }
+
+    @Override
+    protected Logger getLogger() {
+        return LOG;
+    }
+
+}

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

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

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageInvokerInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageInvokerInterceptor.java?rev=628425&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageInvokerInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/MessageInvokerInterceptor.java Sat Feb 16 20:51:18 2008
@@ -0,0 +1,87 @@
+/**
+ * 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.feature;
+
+import java.util.concurrent.Executor;
+
+import org.apache.camel.component.cxf.MessageInvoker;
+import org.apache.cxf.endpoint.Endpoint;
+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.Service;
+
+/**
+ * This interceptor just works for invoking the MessageInvoker implementor
+ *
+ */
+public class MessageInvokerInterceptor extends AbstractPhaseInterceptor<Message> {
+
+
+    public MessageInvokerInterceptor() {
+        super(Phase.INVOKE);
+    }
+
+    public void handleMessage(final Message message) {
+        final Exchange exchange = message.getExchange();
+        final Endpoint endpoint = exchange.get(Endpoint.class);
+        final Service service = endpoint.getService();
+        final MessageInvoker invoker = (MessageInvoker)service.getInvoker();
+
+        // How to deal with the oneway messge
+        Runnable invocation = new Runnable() {
+
+            public void run() {
+                Exchange runableEx = message.getExchange();
+                invoker.invoke(runableEx);
+                if (!exchange.isOneWay()) {
+                    Endpoint ep = exchange.get(Endpoint.class);
+                    Message outMessage = runableEx.getOutMessage();
+                    if (outMessage == null) {
+                        outMessage = ep.getBinding().createMessage();
+                        exchange.setOutMessage(outMessage);
+                    }
+                }
+            }
+
+        };
+
+        Executor executor = getExecutor(endpoint);
+        if (exchange.get(Executor.class) == executor) {
+            // already executing on the appropriate executor
+            invocation.run();
+        } else {
+            exchange.put(Executor.class, executor);
+            executor.execute(invocation);
+        }
+    }
+
+
+    /**
+     * Get the Executor for this invocation.
+     * @param endpoint
+     * @return
+     */
+    private Executor getExecutor(final Endpoint endpoint) {
+        return endpoint.getService().getExecutor();
+    }
+
+}
+
+
+

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

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

Added: 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=628425&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/PayLoadDataFormatFeature.java Sat Feb 16 20:51:18 2008
@@ -0,0 +1,92 @@
+/**
+ * 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.feature;
+
+import java.util.List;
+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.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.feature.AbstractFeature;
+import org.apache.cxf.interceptor.BareInInterceptor;
+import org.apache.cxf.interceptor.DocLiteralInInterceptor;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.WrappedInInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptor;
+
+/**
+ * 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(MessageDataFormatFeature.class);
+    // filiter the unused phase
+    private static final String[] REMOVING_IN_PHASES = {Phase.UNMARSHAL };
+    private static final String[] REMOVING_OUT_PHASES = {Phase.MARSHAL, Phase.MARSHAL_ENDING };
+
+    @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);
+
+        addDataHandlingInterceptors(client.getEndpoint().getBinding());
+    }
+
+    @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);
+
+        // set the invoker interceptor
+        resetServiceInvokerInterceptor(server);
+
+        addDataHandlingInterceptors(server.getEndpoint().getBinding());
+    }
+
+    private void addDataHandlingInterceptors(Binding binding) {
+        binding.getInInterceptors().add(new DOMInInterceptor());
+        binding.getOutInterceptors().add(new DOMOutInterceptor());
+        binding.getOutInterceptors().add(new PayloadContentRedirectInterceptor());
+    }
+
+    @Override
+    protected Logger getLogger() {
+        return LOG;
+    }
+
+}

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

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

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java Sat Feb 16 20:51:18 2008
@@ -40,15 +40,15 @@
  */
 public abstract class AbstractInvokerInterceptor extends AbstractPhaseInterceptor<Message> {
     public static final String ROUTING_INERCEPTOR_PHASE = "Routing-Phase";
-    public static final String BUNDLE = "wsdl-cxf"; 
+    public static final String BUNDLE = "wsdl-cxf";
     public AbstractInvokerInterceptor(String phase) {
         super(phase);
     }
-    
+
     private boolean isRequestor(Message message) {
         return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
     }
-    
+
     /**
      * Send the intercepted message to router
      */
@@ -62,18 +62,19 @@
         Message outMessage = null;
         try {
             CamelInvoker invoker = exchange.get(CamelInvoker.class);
-            outMessage = invoker.invoke(inMessage);
+            invoker.invoke(exchange);
+            outMessage = exchange.getOutMessage();
         } catch (Exception e) {
             throw new Fault(e);
         }
 
         // set back channel conduit in the exchange if it is not present
         setBackChannelConduit(exchange, outMessage);
-        
+
         Exception ex = outMessage.getContent(Exception.class);
         if (ex != null) {
             if (!(ex instanceof Fault)) {
-                ex = new Fault(ex); 
+                ex = new Fault(ex);
             }
             throw (Fault)ex;
         }
@@ -86,16 +87,16 @@
 
         InvokingContext invokingContext = exchange.get(InvokingContext.class);
         assert invokingContext != null;
-        
+
         InterceptorChain chain = invokingContext.getResponseOutInterceptorChain(exchange);
         if (chain != null) {
             outMessage.setInterceptorChain(chain);
-            
+
             //Initiate the OutBound Chain.
             chain.doIntercept(outMessage);
-        }                
+        }
     }
-    
+
     /**
      * Creates a conduit if not present on the exchange. outMessage or faultMessage
      * It will create a back channel in PAYLOAD and MESSAGE case.
@@ -115,9 +116,9 @@
                 throw new Fault(e);
             }
         }
-        
+
         assert conduit != null;
     }
-    
+
     protected abstract Logger getLogger();
 }

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=628425&r1=628424&r2=628425&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 Sat Feb 16 20:51:18 2008
@@ -45,8 +45,8 @@
 
 public class SoapMessageInInterceptor extends AbstractMessageInInterceptor<SoapMessage> {
     private static final Logger LOG = LogUtils.getL7dLogger(SoapMessageInInterceptor.class);
-   
-    public SoapMessageInInterceptor() {       
+
+    public SoapMessageInInterceptor() {
         super(Phase.READ);
     }
 
@@ -112,12 +112,12 @@
         partList.add(rootNode);
         return partList;
     }
-    
+
     protected Element getHeader(SoapMessage inMessage) {
-        // need to revisited 
+        // need to find out the soap header information        
         Element element = null;
         return element;
 	// return inMessage.getHeaders(Element.class);
-    }    
-    
+    }
+
 }

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=628425&r1=628424&r2=628425&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 Sat Feb 16 20:51:18 2008
@@ -45,10 +45,10 @@
 
 public class SoapMessageOutInterceptor extends AbstractMessageOutInterceptor<SoapMessage> {
     private static final Logger LOG = LogUtils.getL7dLogger(SoapMessageInInterceptor.class);
-   
+
 
     public SoapMessageOutInterceptor() {
-        super(Phase.PREPARE_SEND);        
+        super(Phase.PREPARE_SEND);
         addAfter(DOMOutInterceptor.class.getName());
     }
 
@@ -58,12 +58,14 @@
 
     @SuppressWarnings("unchecked")
     public void handleMessage(SoapMessage message) throws Fault {
+        // header is not store as the element
         Element header = message.get(Element.class);
-        List<Element> payload = message.get(List.class);        
-        Exchange exchange = message.getExchange();        
+
+        List<Element> payload = message.get(List.class);
+        Exchange exchange = message.getExchange();
         BindingMessageInfo bmi = exchange.get(BindingMessageInfo.class);
 
-        
+
         //Headers -represent as -Element,Body -represent as StaxStream.
         //Check if BindingOperationInfo contains header
         List<SoapHeaderInfo> bindingHdr = bmi.getExtensors(SoapHeaderInfo.class);
@@ -103,15 +105,15 @@
             }
             payload = newPayload;
         }
-        
+
         //Set SOAP Header Element.
         //Child Elements Could be binding specified parts or user specified headers.
         //REVISTED the soap headers
         //message.setHeaders(Element.class, header);
-        
+
         //TODO Moving Parts from Header to Payload.
-        //For e.g Payload ROuting from SOAP11 <-> SOAP12 
-        
+        //For e.g Payload ROuting from SOAP11 <-> SOAP12
+
         //So write payload and header to outbound message
         if (LOG.isLoggable(Level.INFO)) {
             LOG.info("SoapMessageOutInterceptor binding operation style processing.");
@@ -123,11 +125,11 @@
             //Remove the operation element.
             OperationInfo oi = bmi.getBindingOperation().getOperationInfo();
             Endpoint ep = exchange.get(Endpoint.class);
-            Definition def = 
-                ep.getService().getServiceInfos().get(0).getProperty(WSDLServiceBuilder.WSDL_DEFINITION, 
+            Definition def =
+                ep.getService().getServiceInfos().get(0).getProperty(WSDLServiceBuilder.WSDL_DEFINITION,
                                                              Definition.class);
             String prefix = def.getPrefix(oi.getName().getNamespaceURI());
-            
+
             if ("".equals(prefix)) {
                 prefix = "tns";
             }
@@ -136,7 +138,7 @@
             if (isClient) {
                 opName = new QName(oi.getName().getNamespaceURI(),
                                    oi.getName().getLocalPart(),
-                                   prefix); 
+                                   prefix);
             } else {
                 opName = new QName(oi.getName().getNamespaceURI(),
                                    oi.getName().getLocalPart() + "Response",
@@ -146,7 +148,7 @@
             payload = new ArrayList<Element>();
             payload.add(opEl);
         }
-        
+
         message.put(List.class, payload);
     }
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java Sat Feb 16 20:51:18 2008
@@ -39,43 +39,43 @@
         String address = "http://localhost:9000/SoapContext/SoapPort";
         Endpoint.publish(address, implementor);
     }
-    
+
     @Override
     public void testInvokingServiceFromCXFClient() throws Exception {
         Service service = Service.create(serviceName);
-        service.addPort(routerPortName, "http://schemas.xmlsoap.org/soap/", 
+        service.addPort(routerPortName, "http://schemas.xmlsoap.org/soap/",
                         "http://localhost:9003/CamelContext/RouterPort");
         Greeter greeter = service.getPort(routerPortName, Greeter.class);
-        
+
         try {
-            
+
             String reply = greeter.greetMe("test");
             assertNotNull("No response received from service", reply);
             assertEquals("Got the wrong reply ", "Hello test", reply);
             reply = greeter.sayHi();
             assertNotNull("No response received from service", reply);
             assertEquals("Got the wrong reply ", "Bonjour", reply);
-            
+
             greeter.greetMeOneWay("call greetMe OneWay !");
         } catch (UndeclaredThrowableException ex) {
             throw (Exception)ex.getCause();
         }
     }
-    
+
     @Override
     public void testOnwayInvocation() throws Exception {
     	Service service = Service.create(serviceName);
-        service.addPort(routerPortName, "http://schemas.xmlsoap.org/soap/", 
+        service.addPort(routerPortName, "http://schemas.xmlsoap.org/soap/",
                         "http://localhost:9003/CamelContext/RouterPort");
         Greeter greeter = service.getPort(routerPortName, Greeter.class);
         greeter.greetMeOneWay("call greetMe OneWay !");
     }
-    
+
     @Override
     protected CamelContext createCamelContext() throws Exception {
-        return SpringTestHelper.createSpringCamelContext(this, "org/apache/camel/component/cxf/GreeterEndpointBeans.xml");
+        return SpringTestHelper.createSpringCamelContext(this, "org/apache/camel/component/cxf/GreeterEndpointsRouterContext.xml");
     }
 }
-    
+
 
 

Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterMessageRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterMessageRouterTest.java?rev=628425&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterMessageRouterTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterMessageRouterTest.java Sat Feb 16 20:51:18 2008
@@ -0,0 +1,50 @@
+/**
+ * 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 org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.SpringCamelContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import junit.framework.TestCase;
+
+/**
+ * The Greeter test with the MESSAGE date format
+ */
+public class CxfGreeterMessageRouterTest extends CXFGreeterRouterTest {
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("cxf:bean:routerEndpoint?dataFormat=Message").to("cxf:bean:serviceEndpoint?dataFormat=Message");
+            }
+        };
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return SpringCamelContext.springCamelContext(applicationContext);
+    }
+
+    @Override
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/GreeterEndpointBeans.xml");
+    }
+
+
+}

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

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

Added: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadRouterTest.java?rev=628425&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadRouterTest.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadRouterTest.java Sat Feb 16 20:51:18 2008
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.cxf;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.SpringCamelContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import junit.framework.TestCase;
+
+/**
+ * The Greeter test with the PAYLOAD date format
+ */
+public class CxfGreeterPayLoadRouterTest  extends CXFGreeterRouterTest {
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("cxf:bean:routerEndpoint?dataFormat=PAYLOAD").to("cxf:bean:serviceEndpoint?dataFormat=PAYLOAD");
+            }
+        };
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        return SpringCamelContext.springCamelContext(applicationContext);
+    }
+
+    @Override
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/GreeterEndpointBeans.xml");
+    }
+
+
+
+}

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

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

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java Sat Feb 16 20:51:18 2008
@@ -26,6 +26,7 @@
 import org.apache.cxf.frontend.ClientFactoryBean;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.test.TestUtilities;
 
 
 public class CxfRouterTest extends ContextTestSupport {
@@ -42,8 +43,10 @@
 
     @Override
     protected void setUp() throws Exception {
-        super.setUp();
+
+        BusFactory.setDefaultBus(null);
         bus = BusFactory.getDefaultBus();
+        super.setUp();
         startService();
     }
 
@@ -62,7 +65,10 @@
 
     @Override
     protected void tearDown() throws Exception {
-        //bus.shutdown(true);
+        //TODO need to shutdown the server
+        super.tearDown();
+        //server.stop();
+        //bus.shutdown(false);
         BusFactory.setDefaultBus(null);
     }
 
@@ -80,7 +86,6 @@
 
 
     public void testInvokingServiceFromCXFClient() throws Exception {
-
         ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
         ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
         clientBean.setAddress(ROUTER_ADDRESS);
@@ -101,9 +106,9 @@
         clientBean.setServiceClass(HelloService.class);
         clientBean.setBus(bus);
         HelloService client = (HelloService) proxyFactory.create();
-        int invocationCount = client.getInvocationCount();
+        int count = client.getInvocationCount();
         client.ping();
         //oneway ping invoked, so invocationCount ++
-        assertEquals(client.getInvocationCount() - 1, invocationCount);
+        assertEquals("The ping should be invocated", client.getInvocationCount(), ++count);
     }
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java Sat Feb 16 20:51:18 2008
@@ -29,38 +29,39 @@
 
 public class CxfSpringRouterTest extends CxfRouterTest {
     protected AbstractXmlApplicationContext applicationContext;
-    
+
     @Override
     protected void setUp() throws Exception {
         applicationContext = createApplicationContext();
-        super.setUp();        
+        super.setUp();
         assertNotNull("Should have created a valid spring context", applicationContext);
 
-        
+
     }
 
     @Override
-    protected void tearDown() throws Exception {        
+    protected void tearDown() throws Exception {
         if (applicationContext != null) {
             applicationContext.destroy();
         }
         super.tearDown();
     }
-    
+
+    @Override
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from("cxf:bean:routerEndpoint").to("cxf:bean:serviceEndpoint");              
+                from("cxf:bean:routerEndpoint").to("cxf:bean:serviceEndpoint");
             }
         };
     }
-    
+
     @Override
     protected CamelContext createCamelContext() throws Exception {
         return SpringCamelContext.springCamelContext(applicationContext);
     }
-    
-    
+
+
     protected ClassPathXmlApplicationContext createApplicationContext() {
         return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml");
     }

Modified: activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java Sat Feb 16 20:51:18 2008
@@ -23,8 +23,8 @@
 public class HelloServiceImpl implements HelloService {
     private static final Logger LOG = Logger.getLogger(HelloServiceImpl.class.getName());
     private int invocationCount;
-	
-    public String echo(String text) {        
+
+    public String echo(String text) {
         LOG.info("call for echo with " + text);
         return "echo " + text;
     }
@@ -33,7 +33,7 @@
     	invocationCount ++;
     	LOG.info("call for oneway ping");
     }
-    
+
     public int getInvocationCount() {
     	return invocationCount;
     }
@@ -41,8 +41,8 @@
     public String sayHello() {
         return "hello";
     }
-    
-     
+
+
 }
 
 

Modified: activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml?rev=628425&r1=628424&r2=628425&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml (original)
+++ activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/GreeterEndpointBeans.xml Sat Feb 16 20:51:18 2008
@@ -40,12 +40,4 @@
     		serviceName="s:SOAPService"
     	xmlns:s="http://apache.org/hello_world_soap_http" />
 
-   <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
-    <route>
-      <from uri="cxf:bean:routerEndpoint" />
-      <to uri="cxf:bean:serviceEndpoint" />
-    </route>
-   </camelContext>
-
-
 </beans>



Mime
View raw message