camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r676805 - in /activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf: CxfBinding.java CxfMessage.java CxfSoapBinding.java
Date Tue, 15 Jul 2008 06:12:19 GMT
Author: ningjiang
Date: Mon Jul 14 23:12:19 2008
New Revision: 676805

URL: http://svn.apache.org/viewvc?rev=676805&view=rev
Log:
CAMEL-719 Applied patch with thanks to Freeman

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/CxfMessage.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapBinding.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=676805&r1=676804&r2=676805&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 Jul 14 23:12:19 2008
@@ -56,29 +56,25 @@
 
     public static Message createCxfMessage(CxfExchange exchange) {
         Message answer = exchange.getInMessage();
-
-        // CXF uses StAX which is based on the stream API to parse the XML,
-        // so the CXF transport is also based on the stream API.
-        // And the interceptors are also based on the stream API,
-        // so let's use an InputStream to host the CXF on wire message.
-
         CxfMessage in = exchange.getIn();
-        Object body = in.getBody(InputStream.class);
-        if (body == null) {
-            body = in.getBody();
-        }
-        if (body instanceof InputStream) {
-            answer.setContent(InputStream.class, body);
-            // we need copy context
-        } else if (body instanceof List) {
+        // Check the body if the POJO parameter list first
+        Object body = in.getBody(List.class);
+        if (body instanceof List) {
             // just set the operation's parameter
             answer.setContent(List.class, body);
             // just set the method name
             answer.put(CxfConstants.OPERATION_NAME, (String)in.getHeader(CxfConstants.OPERATION_NAME));
-            answer.put(CxfConstants.OPERATION_NAMESPACE, (String)in
-                .getHeader(CxfConstants.OPERATION_NAMESPACE));
+            answer.put(CxfConstants.OPERATION_NAMESPACE, (String)in.getHeader(CxfConstants.OPERATION_NAMESPACE));
+        } else {
+            // CXF uses StAX which is based on the stream API to parse the XML,
+            // so the CXF transport is also based on the stream API.
+            // And the interceptors are also based on the stream API,
+            // so let's use an InputStream to host the CXF on wire message.
+            body = in.getBody(InputStream.class);
+            if (body instanceof InputStream) {
+                answer.setContent(InputStream.class, body);
+            }
         }
-
         return answer;
     }
 

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=676805&r1=676804&r2=676805&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 Jul 14 23:12:19 2008
@@ -20,8 +20,8 @@
 
 import org.apache.camel.impl.DefaultMessage;
 import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.message.MessageImpl;
 
 /**
  * An Apache CXF {@link Message} which provides access to the underlying CXF

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapBinding.java?rev=676805&r1=676804&r2=676805&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapBinding.java
(original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSoapBinding.java
Mon Jul 14 23:12:19 2008
@@ -25,16 +25,20 @@
 
 import javax.xml.transform.Source;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 
 public final class CxfSoapBinding {
+    private static final Log LOG = LogFactory.getLog(CxfSoapBinding.class);
+
     private CxfSoapBinding() {
 
     }
-    //TODO use the type converter to do this kind of thing
+
     public static org.apache.cxf.message.Message getCxfInMessage(org.apache.camel.Exchange
exchange, boolean isClient) {
         MessageImpl answer = new MessageImpl();
         org.apache.cxf.message.Exchange cxfExchange = exchange.getProperty(CxfConstants.CXF_EXCHANGE,
@@ -61,14 +65,10 @@
         answer.put(Message.PROTOCOL_HEADERS, getProtocolHeader(headers));
 
         Object body = message.getBody(InputStream.class);
-        if (body == null) {
-            body = message.getBody();
-        }
-        // we could do some message transform here
         if (body instanceof InputStream) {
             answer.setContent(InputStream.class, body);
         } else {
-            // the answer body is null
+            LOG.warn("Can't get right InputStream object here, the message body is " + message.getBody());
         }
 
         answer.putAll(message.getHeaders());
@@ -100,11 +100,10 @@
         outMessage.put(Message.PROTOCOL_HEADERS, getProtocolHeader(headers));
         // send the body back
         Object body = message.getBody(Source.class);
-        if (body == null) {
-            body = message.getBody();
-        }
         if (body instanceof Source) {
             outMessage.setContent(Source.class, body);
+        } else {
+            LOG.warn("Can't get right Source object here, the message body is " + message.getBody());
         }
         outMessage.putAll(message.getHeaders());
         return outMessage;



Mime
View raw message