You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2018/03/07 05:08:28 UTC
[camel] branch master updated: [CAMEL-12326]Improve
CamelCxfClientImpl a bit ensure it can handle camel side usecase
This is an automated email from the ASF dual-hosted git repository.
ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 644a651 [CAMEL-12326]Improve CamelCxfClientImpl a bit ensure it can handle camel side usecase
644a651 is described below
commit 644a6515ad0f577ef14a68fb415454e2fabb976a
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Wed Mar 7 13:08:15 2018 +0800
[CAMEL-12326]Improve CamelCxfClientImpl a bit ensure it can handle camel side usecase
---
.../apache/camel/component/cxf/CxfEndpoint.java | 76 ++++++++++++++++++++++
.../component/cxf/CxfPayLoadBareSoapTest.java | 5 +-
2 files changed, 79 insertions(+), 2 deletions(-)
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
index be1f609..5a80cb1 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
@@ -1180,7 +1180,83 @@ public class CxfEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade
public Bus getBus() {
return bus;
}
+
+ @Override
+ protected Object[] processResult(Message message, org.apache.cxf.message.Exchange exchange,
+ BindingOperationInfo oi, Map<String, Object> resContext)
+ throws Exception {
+ Exception ex = null;
+ // Check to see if there is a Fault from the outgoing chain if it's an out Message
+ if (!message.get(Message.INBOUND_MESSAGE).equals(Boolean.TRUE)) {
+ ex = message.getContent(Exception.class);
+ }
+ boolean mepCompleteCalled = false;
+ if (ex != null) {
+ completeExchange(exchange);
+ mepCompleteCalled = true;
+ if (message.getContent(Exception.class) != null) {
+ throw ex;
+ }
+ }
+ ex = message.getExchange().get(Exception.class);
+ if (ex != null) {
+ if (!mepCompleteCalled) {
+ completeExchange(exchange);
+ }
+ throw ex;
+ }
+
+ Integer responseCode = (Integer)exchange.get(Message.RESPONSE_CODE);
+ if (null != responseCode && 202 == responseCode) {
+ Endpoint ep = exchange.getEndpoint();
+ if (null != ep && null != ep.getEndpointInfo() && null == ep.getEndpointInfo()
+ .getProperty("org.apache.cxf.ws.addressing.MAPAggregator.decoupledDestination")) {
+ return null;
+ }
+ }
+
+ // Wait for a response if we need to
+ if (oi != null && !oi.getOperationInfo().isOneWay()) {
+ waitResponse(exchange);
+ }
+
+ // leave the input stream open for the caller
+ Boolean keepConduitAlive = (Boolean)exchange.get(Client.KEEP_CONDUIT_ALIVE);
+ if (keepConduitAlive == null || !keepConduitAlive) {
+ completeExchange(exchange);
+ }
+
+ // Grab the response objects if there are any
+ List<Object> resList = null;
+ Message inMsg = exchange.getInMessage();
+ if (inMsg != null) {
+ if (null != resContext) {
+ resContext.putAll(inMsg);
+ // remove the recursive reference if present
+ resContext.remove(Message.INVOCATION_CONTEXT);
+ responseContext.put(Thread.currentThread(), resContext);
+ }
+ resList = CastUtils.cast(inMsg.getContent(List.class));
+ }
+
+ // check for an incoming fault
+ ex = getException(exchange);
+
+ if (ex != null) {
+ throw ex;
+ }
+ if (resList != null) {
+ return resList.toArray();
+ }
+
+ return null;
+ }
+
+ private void completeExchange(org.apache.cxf.message.Exchange exchange) {
+ getConduitSelector().complete(exchange);
+ }
+
@SuppressWarnings("unchecked")
@Override
protected void setParameters(Object[] params, Message message) {
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java
index 8d517dd..0da4d16 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java
@@ -26,7 +26,8 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.AvailablePortFinder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.cxf.BusFactory;
-import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+
import org.junit.BeforeClass;
import org.junit.Test;
@@ -64,7 +65,7 @@ public class CxfPayLoadBareSoapTest extends CamelTestSupport {
@Test
public void testInvokeProxyService() {
- ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
+ JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(BareSoapService.class);
factory.setAddress(PROXY_URL);
factory.setBus(BusFactory.newInstance().createBus());
--
To stop receiving notification emails like this one, please contact
ffang@apache.org.