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

svn commit: r636994 - /activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java

Author: ningjiang
Date: Thu Mar 13 22:05:07 2008
New Revision: 636994

URL: http://svn.apache.org/viewvc?rev=636994&view=rev
Log:
CAMEL-386 copy the response context back to out going message in camel-cxf

Modified:
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java

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=636994&r1=636993&r2=636994&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 Thu Mar 13 22:05:07 2008
@@ -17,7 +17,9 @@
 package org.apache.camel.component.cxf;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 
@@ -235,12 +237,19 @@
                     response = ep.getBinding().createMessage();
                 }
                 response.setExchange(ex);
-                // invoke the message
-                //TODO need setup the call context here
+                // invoke the message prepare the context
+                Map<String, Object> context = new HashMap<String, Object>();
+                Map<String, Object> requestContext = new HashMap<String, Object>();
+                Map<String, Object> responseContext = new HashMap<String, Object>();
+                // TODO Get the requestContext from the CamelExchange
+                context.put(CxfClient.REQUEST_CONTEXT, requestContext);
+                context.put(CxfClient.RESPONSE_CONTEXT, responseContext);
                 try {
-                    Object result = cxfClient.dispatch(params, null, ex);
+                    Object result = cxfClient.dispatch(params, context, ex);
                     ex.setOutMessage(response);
                     invokingContext.setResponseContent(response, result);
+                    // copy the response context to the response
+                    response.putAll(responseContext);
                     cxfBinding.storeCxfResponse(exchange, response);
                 } catch (Exception e) {
                     response.setContent(Exception.class, e);
@@ -248,7 +257,7 @@
                 }
             }
         } catch (Exception e) {
-            //TODO add the falut message handling work
+            //TODO add the fault message handling work
             throw new RuntimeCamelException(e);
         }