svn commit: r662348 - in /activemq/camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ test/java/org/apache/camel/component/cxf/

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r662348 - in /activemq/camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ test/java/org/apache/camel/component/cxf/

ningjiang
Author: ningjiang
Date: Mon Jun  2 00:30:59 2008
New Revision: 662348

URL: http://svn.apache.org/viewvc?rev=662348&view=rev
Log:
CAMEL-569 applied Freeman's patch with thanks

Modified:
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.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/CxfMessage.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java?rev=662348&r1=662347&r2=662348&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java Mon Jun  2 00:30:59 2008
@@ -88,6 +88,10 @@
         CxfMessage out = exchange.getOut();
         if (response != null) {
             out.setMessage(response);
+            DataFormat dataFormat = (DataFormat) exchange.getProperty(CxfExchange.DATA_FORMAT);
+            if (!dataFormat.equals(DataFormat.POJO)) {
+                out.setBody(response);
+            }
         }
     }
 

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=662348&r1=662347&r2=662348&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 Mon Jun  2 00:30:59 2008
@@ -32,7 +32,6 @@
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.feature.AbstractFeature;
-import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.frontend.ServerFactoryBean;
 
 /**

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=662348&r1=662347&r2=662348&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 Mon Jun  2 00:30:59 2008
@@ -32,6 +32,7 @@
  * @version $Revision$
  */
 public class CxfExchange extends DefaultExchange {
+    public static final String DATA_FORMAT = "DATA_FORMAT";
     private Exchange exchange;
 
     public CxfExchange(CamelContext context, Exchange exchange) {

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java?rev=662348&r1=662347&r2=662348&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java Mon Jun  2 00:30:59 2008
@@ -47,6 +47,9 @@
     public void copyFrom(org.apache.camel.Message that) {
         setMessageId(that.getMessageId());
         setBody(that.getBody());
+        if (that.getBody() instanceof Message) {
+            setMessage((Message)that.getBody());
+        }
         getHeaders().putAll(that.getHeaders());
         if (that instanceof CxfMessage) {
             CxfMessage orig = (CxfMessage) that;
@@ -104,4 +107,12 @@
     protected Object createBody() {
         return CxfBinding.extractBodyFromCxf(getExchange(), cxfMessage);
     }
+
+    @Override
+    public void setBody(Object body) {
+        super.setBody(body);
+        if (body instanceof Message) {
+            setMessage((Message) body);
+        }
+    }
 }

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=662348&r1=662347&r2=662348&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 Mon Jun  2 00:30:59 2008
@@ -175,6 +175,7 @@
 
     public void process(CxfExchange exchange) {
         Message inMessage = CxfBinding.createCxfMessage(exchange);
+        exchange.setProperty(CxfExchange.DATA_FORMAT, dataFormat);
         try {
             if (dataFormat.equals(DataFormat.POJO)) {
                 // InputStream is = m.getContent(InputStream.class);

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=662348&r1=662347&r2=662348&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 Mon Jun  2 00:30:59 2008
@@ -55,7 +55,7 @@
     }
 
     protected void startService() {
-     Object implementor = new PersonImpl();
+         Object implementor = new PersonImpl();
         String address = "http://localhost:9000/PersonService/";
         Endpoint.publish(address, implementor);
     }
@@ -77,9 +77,8 @@
 
     public void testInvokingServiceFromCXFClient() throws Exception {
 
-     URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
-        PersonService ss = new PersonService(wsdlURL, new QName("http://camel.apache.org/wsdl-first",
- "PersonService"));
+        URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
+        PersonService ss = new PersonService(wsdlURL, new QName("http://camel.apache.org/wsdl-first", "PersonService"));
         Person client = ss.getSoap();
         ClientProxy.getClient(client).getOutInterceptors().add(new LoggingOutInterceptor());
         Holder<String> personId = new Holder<String>();