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 2010/11/01 06:56:07 UTC
svn commit: r1029558 - in /camel/trunk/components/camel-cxf/src:
main/java/org/apache/camel/component/cxf/util/CxfMessageHelper.java
test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java
Author: ningjiang
Date: Mon Nov 1 05:56:06 2010
New Revision: 1029558
URL: http://svn.apache.org/viewvc?rev=1029558&view=rev
Log:
CAMEL-3269 Fixed the Can't find inputstream from in message by applying the patch of Jeremie
Added:
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java (with props)
Modified:
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfMessageHelper.java
Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfMessageHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfMessageHelper.java?rev=1029558&r1=1029557&r2=1029558&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfMessageHelper.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfMessageHelper.java Mon Nov 1 05:56:06 2010
@@ -39,7 +39,7 @@ public final class CxfMessageHelper {
org.apache.cxf.message.Exchange cxfExchange = exchange
.getProperty(CxfConstants.CXF_EXCHANGE, org.apache.cxf.message.Exchange.class);
org.apache.camel.Message message;
- if (isClient) {
+ if (isClient && exchange.hasOut()) {
message = exchange.getOut();
} else {
message = exchange.getIn();
Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java?rev=1029558&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java (added)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java Mon Nov 1 05:56:06 2010
@@ -0,0 +1,108 @@
+/**
+ * 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.transport;
+
+import javax.jws.WebMethod;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.cxf.BusFactory;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+
+/**
+ * Test CXF-CamelConduit when the destination is not a pipeline
+ */
+public class JaxWSCamelConduitTest extends CamelTestSupport {
+
+ /**
+ * Expected SOAP answer for the 'SampleWS.getSomething' method
+ */
+ public static final String ANSWER = "<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'>"
+ + "<Body>" + "<getSomethingResponse xmlns='urn:test'>"
+ + "<result>Something</result>" + "</getSomethingResponse>"
+ + "</Body>" + "</Envelope>";
+
+ /**
+ * Sample WebService
+ */
+ @WebService(targetNamespace = "urn:test", serviceName = "testService", portName = "testPort")
+ public interface SampleWS {
+
+ @WebMethod
+ @WebResult(name = "result", targetNamespace = "urn:test")
+ String getSomething();
+ }
+
+ /**
+ * Initialize CamelTransportFactory without Spring
+ */
+ @Before
+ public void setUpCXFCamelContext() {
+ BusFactory.getThreadDefaultBus().getExtension(CamelTransportFactory.class).setCamelContext(context);
+ }
+
+ /**
+ * Create a SampleWS JAXWS-Proxy to a specified route
+ *
+ * @param camelRoute
+ * @return
+ */
+ public SampleWS getSampleWS(String camelRoute) {
+ QName serviceName = new QName("urn:test", "testService");
+ Service s = Service.create(serviceName);
+
+ QName portName = new QName("urn:test", "testPort");
+ s.addPort(portName, "http://schemas.xmlsoap.org/soap/", "camel://" + camelRoute);
+
+ return s.getPort(SampleWS.class);
+ }
+
+
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+
+ public void configure() throws Exception {
+
+ from("direct:start1").setBody(constant(ANSWER));
+
+ from("direct:start2").setBody(constant(ANSWER)).log("Force pipeline creation");
+ }
+ };
+ }
+
+
+ @Test
+ public void testStart1() {
+ assertThat(getSampleWS("direct:start1").getSomething(), is("Something"));
+ }
+
+ /**
+ * Success
+ */
+ @Test
+ public void testStart2() {
+ assertThat(getSampleWS("direct:start2").getSomething(), is("Something"));
+ }
+}
Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/transport/JaxWSCamelConduitTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date