Use Camel SSLContext in CXF-endpoint
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/30a4e16d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/30a4e16d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/30a4e16d Branch: refs/heads/master Commit: 30a4e16dc9e0d01bb44a7a89b1ba03d0ecf5304b Parents: 8a7e8fc Author: Arno Noordover <a...@noordover.net> Authored: Thu May 26 21:34:32 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat May 28 15:55:54 2016 +0200 ---------------------------------------------------------------------- .../cxf/ChainedCxfEndpointConfigurer.java | 76 ++++++++++++++++++ .../camel/component/cxf/CxfComponent.java | 7 +- .../apache/camel/component/cxf/CxfEndpoint.java | 43 ++++++++++ .../apache/camel/component/cxf/CxfProducer.java | 8 +- .../HostnameVerifierCxfEndpointConfigurer.java | 64 +++++++++++++++ .../component/cxf/SslCxfEndpointConfigurer.java | 80 +++++++++++++++++++ .../camel/component/cxf/CxfEndpointTest.java | 5 +- .../camel-cxf/src/test/resources/localhost.ks | Bin 0 -> 2414 bytes .../src/test/resources/log4j.properties | 2 +- .../component/cxf/cxfConduitTimeOutContext.xml | 79 ++++++++++-------- 10 files changed, 321 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ChainedCxfEndpointConfigurer.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ChainedCxfEndpointConfigurer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ChainedCxfEndpointConfigurer.java new file mode 100644 index 0000000..bc69741 --- /dev/null +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ChainedCxfEndpointConfigurer.java @@ -0,0 +1,76 @@ +/** + * 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; + +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.endpoint.Server; +import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory; + +public final class ChainedCxfEndpointConfigurer implements CxfEndpointConfigurer { + private CxfEndpointConfigurer parent; + private CxfEndpointConfigurer child; + + private ChainedCxfEndpointConfigurer() { + } + + public static ChainedCxfEndpointConfigurer create(CxfEndpointConfigurer parent, CxfEndpointConfigurer child) { + ChainedCxfEndpointConfigurer result = new ChainedCxfEndpointConfigurer(); + result.parent = parent; + result.child = child; + return result; + } + + public ChainedCxfEndpointConfigurer addChild(CxfEndpointConfigurer cxfEndpointConfigurer) { + ChainedCxfEndpointConfigurer result = new ChainedCxfEndpointConfigurer(); + result.parent = this; + result.child = cxfEndpointConfigurer; + return result; + } + + @Override + public void configure(AbstractWSDLBasedEndpointFactory factoryBean) { + parent.configure(factoryBean); + child.configure(factoryBean); + } + + @Override + public void configureClient(Client client) { + parent.configureClient(client); + child.configureClient(client); + } + + @Override + public void configureServer(Server server) { + parent.configureServer(server); + child.configureServer(server); + } + + public static class NullCxfEndpointConfigurer implements CxfEndpointConfigurer { + + @Override + public void configure(AbstractWSDLBasedEndpointFactory factoryBean) { + } + + @Override + public void configureClient(Client client) { + } + + @Override + public void configureServer(Server server) { + } + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java index 85776b6..da7158a 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java @@ -24,6 +24,7 @@ import org.apache.camel.component.cxf.common.message.CxfConstants; import org.apache.camel.impl.HeaderFilterStrategyComponent; import org.apache.camel.util.CamelContextHelper; import org.apache.camel.util.IntrospectionSupport; +import org.apache.camel.util.jsse.SSLContextParameters; import org.apache.cxf.message.Message; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,7 +37,7 @@ public class CxfComponent extends HeaderFilterStrategyComponent { private static final Logger LOG = LoggerFactory.getLogger(CxfComponent.class); private Boolean allowStreaming; - + public CxfComponent() { super(CxfEndpoint.class); } @@ -74,7 +75,7 @@ public class CxfComponent extends HeaderFilterStrategyComponent { parameters.put("defaultBus", value); } } - + if (allowStreaming != null && !parameters.containsKey("allowStreaming")) { parameters.put("allowStreaming", Boolean.toString(allowStreaming)); } @@ -97,6 +98,7 @@ public class CxfComponent extends HeaderFilterStrategyComponent { // endpoint URI does not specify a bean result = createCxfEndpoint(remaining); } + if (result.getCamelContext() == null) { result.setCamelContext(getCamelContext()); } @@ -129,4 +131,5 @@ public class CxfComponent extends HeaderFilterStrategyComponent { CxfEndpoint cxfEndpoint = (CxfEndpoint) endpoint; cxfEndpoint.updateEndpointUri(uri); } + } http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java ---------------------------------------------------------------------- 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 9fb77e7..88f32ae 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 @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; +import javax.net.ssl.HostnameVerifier; import javax.wsdl.Definition; import javax.wsdl.WSDLException; import javax.xml.namespace.QName; @@ -69,6 +70,7 @@ import org.apache.camel.util.CastUtils; import org.apache.camel.util.EndpointHelper; import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.UnsafeUriCharactersEncoder; +import org.apache.camel.util.jsse.SSLContextParameters; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.binding.BindingConfiguration; @@ -163,6 +165,10 @@ public class CxfEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade private String defaultOperationNamespace; @UriParam(label = "producer") private boolean wrapped; + @UriParam(label = "producer") + private SSLContextParameters sslContextParameters; + @UriParam(label = "producer") + private HostnameVerifier hostnameVerifier; @UriParam private Boolean wrappedStyle; @UriParam(label = "advanced") @@ -1132,6 +1138,21 @@ public class CxfEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade this.username = username; } + public CxfEndpointConfigurer getChainedCxfEndpointConfigurer() { + return ChainedCxfEndpointConfigurer + .create(getNullSafeCxfEndpointConfigurer(), + SslCxfEndpointConfigurer.create(sslContextParameters, getCamelContext())) + .addChild(HostnameVerifierCxfEndpointConfigurer.create(hostnameVerifier)); + } + + private CxfEndpointConfigurer getNullSafeCxfEndpointConfigurer() { + if (cxfEndpointConfigurer == null) { + return new ChainedCxfEndpointConfigurer.NullCxfEndpointConfigurer(); + } else { + return cxfEndpointConfigurer; + } + } + /** * We need to override the {@link ClientImpl#setParameters} method * to insert parameters into CXF Message for {@link DataFormat#PAYLOAD} mode. @@ -1397,4 +1418,26 @@ public class CxfEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade this.continuationTimeout = continuationTimeout; } + public SSLContextParameters getSslContextParameters() { + return sslContextParameters; + } + + /** + * The Camel SSL setting reference. Use the # notation to reference the SSL Context. + */ + public void setSslContextParameters(SSLContextParameters sslContextParameters) { + this.sslContextParameters = sslContextParameters; + } + + public HostnameVerifier getHostnameVerifier() { + return hostnameVerifier; + } + + /** + * The hostname verifier to be used. Use the # notation to reference a HostnameVerifier + * from the registry. + */ + public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { + this.hostnameVerifier = hostnameVerifier; + } } http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java index f778e5f..2d105f2 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java @@ -79,12 +79,10 @@ public class CxfProducer extends DefaultProducer implements AsyncProcessor { if (client == null) { client = endpoint.createClient(); } - // Apply the server configurer if it is possible - if (endpoint.getCxfEndpointConfigurer() != null) { - endpoint.getCxfEndpointConfigurer().configureClient(client); - } + + endpoint.getChainedCxfEndpointConfigurer().configureClient(client); } - + @Override protected void doStop() throws Exception { super.doStop(); http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HostnameVerifierCxfEndpointConfigurer.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HostnameVerifierCxfEndpointConfigurer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HostnameVerifierCxfEndpointConfigurer.java new file mode 100644 index 0000000..913ce59 --- /dev/null +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/HostnameVerifierCxfEndpointConfigurer.java @@ -0,0 +1,64 @@ +/** + * 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; + +import javax.net.ssl.HostnameVerifier; + +import org.apache.cxf.configuration.jsse.TLSClientParameters; +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.endpoint.Server; +import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory; +import org.apache.cxf.transport.http.HTTPConduit; + +public final class HostnameVerifierCxfEndpointConfigurer implements CxfEndpointConfigurer { + + private final HostnameVerifier hostnameVerifier; + + private HostnameVerifierCxfEndpointConfigurer(HostnameVerifier hostnameVerifier) { + this.hostnameVerifier = hostnameVerifier; + } + + public static CxfEndpointConfigurer create(HostnameVerifier hostnameVerifier) { + if (hostnameVerifier == null) { + return new ChainedCxfEndpointConfigurer.NullCxfEndpointConfigurer(); + } else { + return new HostnameVerifierCxfEndpointConfigurer(hostnameVerifier); + } + } + @Override + public void configure(AbstractWSDLBasedEndpointFactory factoryBean) { + } + + @Override + public void configureClient(Client client) { + HTTPConduit httpConduit = (HTTPConduit) client.getConduit(); + TLSClientParameters tlsClientParameters = tryToGetTLSClientParametersFromConduit(httpConduit); + tlsClientParameters.setHostnameVerifier(hostnameVerifier); + httpConduit.setTlsClientParameters(tlsClientParameters); + } + + private TLSClientParameters tryToGetTLSClientParametersFromConduit(HTTPConduit httpConduit) { + if (httpConduit.getTlsClientParameters() != null) { + return httpConduit.getTlsClientParameters(); + } + return new TLSClientParameters(); + } + + @Override + public void configureServer(Server server) { + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/SslCxfEndpointConfigurer.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/SslCxfEndpointConfigurer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/SslCxfEndpointConfigurer.java new file mode 100644 index 0000000..2c19dcf --- /dev/null +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/SslCxfEndpointConfigurer.java @@ -0,0 +1,80 @@ +/** + * 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; + +import java.io.IOException; +import java.security.GeneralSecurityException; +import javax.net.ssl.SSLSocketFactory; + +import org.apache.camel.CamelContext; +import org.apache.camel.util.jsse.SSLContextParameters; +import org.apache.cxf.configuration.jsse.TLSClientParameters; +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.endpoint.Server; +import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory; +import org.apache.cxf.transport.http.HTTPConduit; + +public final class SslCxfEndpointConfigurer implements CxfEndpointConfigurer { + private final SSLContextParameters sslContextParameters; + private final CamelContext camelContext; + + private SslCxfEndpointConfigurer(SSLContextParameters sslContextParameters, + CamelContext camelContext) { + this.camelContext = camelContext; + this.sslContextParameters = sslContextParameters; + } + + public static CxfEndpointConfigurer create(SSLContextParameters sslContextParameters, CamelContext camelContext) { + if (sslContextParameters == null) { + return new ChainedCxfEndpointConfigurer.NullCxfEndpointConfigurer(); + } else { + return new SslCxfEndpointConfigurer(sslContextParameters, camelContext); + } + } + + @Override + public void configure(AbstractWSDLBasedEndpointFactory factoryBean) { + } + + @Override + public void configureClient(Client client) { + HTTPConduit httpConduit = (HTTPConduit) client.getConduit(); + TLSClientParameters tlsClientParameters = tryToGetTLSClientParametersFromConduit(httpConduit); + tlsClientParameters.setSSLSocketFactory(tryToGetSSLSocketFactory()); + httpConduit.setTlsClientParameters(tlsClientParameters); + } + + private TLSClientParameters tryToGetTLSClientParametersFromConduit(HTTPConduit httpConduit) { + if (httpConduit.getTlsClientParameters() != null) { + return httpConduit.getTlsClientParameters(); + } + return new TLSClientParameters(); + } + + private SSLSocketFactory tryToGetSSLSocketFactory() { + try { + return sslContextParameters.createSSLContext(camelContext) + .getSocketFactory(); + } catch (GeneralSecurityException | IOException e) { + throw new RuntimeException("Setting SSL failed", e); + } + } + + @Override + public void configureServer(Server server) { + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java index cc28af0..485ba3a 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java @@ -24,6 +24,7 @@ import org.apache.camel.component.cxf.CxfEndpoint.CamelCxfClientImpl; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.SimpleRegistry; import org.apache.camel.spring.SpringCamelContext; +import org.apache.camel.util.jsse.SSLContextParameters; import org.apache.cxf.BusFactory; import org.apache.cxf.bus.extension.ExtensionManagerBus; import org.apache.cxf.endpoint.Client; @@ -99,11 +100,13 @@ public class CxfEndpointTest extends Assert { public void testCxfEndpointConfigurer() throws Exception { SimpleRegistry registry = new SimpleRegistry(); CxfEndpointConfigurer configurer = EasyMock.createMock(CxfEndpointConfigurer.class); + SSLContextParameters sslContextParameters = EasyMock.createMock(SSLContextParameters.class); Processor processor = EasyMock.createMock(Processor.class); registry.put("myConfigurer", configurer); + registry.put("sslContextParameters", sslContextParameters); CamelContext camelContext = new DefaultCamelContext(registry); CxfComponent cxfComponent = new CxfComponent(camelContext); - CxfEndpoint endpoint = (CxfEndpoint)cxfComponent.createEndpoint(routerEndpointURI + "&cxfEndpointConfigurer=#myConfigurer"); + CxfEndpoint endpoint = (CxfEndpoint)cxfComponent.createEndpoint(routerEndpointURI + "&cxfEndpointConfigurer=#myConfigurer&sslContextParameters=sslContextParameters"); configurer.configure(EasyMock.isA(AbstractWSDLBasedEndpointFactory.class)); EasyMock.expectLastCall(); http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/test/resources/localhost.ks ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/resources/localhost.ks b/components/camel-cxf/src/test/resources/localhost.ks new file mode 100644 index 0000000..83999cf Binary files /dev/null and b/components/camel-cxf/src/test/resources/localhost.ks differ http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/resources/log4j.properties b/components/camel-cxf/src/test/resources/log4j.properties index aa9e83b..3d39228 100644 --- a/components/camel-cxf/src/test/resources/log4j.properties +++ b/components/camel-cxf/src/test/resources/log4j.properties @@ -18,7 +18,7 @@ # # The logging properties used during tests.. # -log4j.rootLogger=INFO, file +log4j.rootLogger=DEBUG, file log4j.logger.org.apache.activemq.spring=WARN #log4j.logger.org.apache.camel.component=TRACE http://git-wip-us.apache.org/repos/asf/camel/blob/30a4e16d/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfConduitTimeOutContext.xml ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfConduitTimeOutContext.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfConduitTimeOutContext.xml index 3f34b54..e5d4073 100644 --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfConduitTimeOutContext.xml +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfConduitTimeOutContext.xml @@ -28,43 +28,54 @@ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> - <import resource="classpath:META-INF/cxf/cxf.xml"/> - - <!-- You can set the timeout and other client http transport configuration here --> - - <http-conf:conduit name="*.http-conduit"> - <http-conf:client ReceiveTimeout="100" /> - </http-conf:conduit> - - <!-- setup the CxfEndpointConfigurer bean here --> - <bean id="myConfigurer" class="org.apache.camel.component.cxf.CxfTimeoutTest$MyCxfEndpointConfigurer" /> + <import resource="classpath:META-INF/cxf/cxf.xml"/> - <cxf:cxfEndpoint id="springEndpoint" address="http://localhost:${CXFTestSupport.port1}/CxfTimeoutTest/SoapContext/SoapPort" - serviceClass="org.apache.hello_world_soap_http.Greeter"/> + <sslContextParameters xmlns="http://camel.apache.org/schema/spring" + id="mySslContext"> + <keyManagers + keyPassword="changeit"> + <keyStore + resource="/localhost.ks" + password="changeit"/> + </keyManagers> + </sslContextParameters> - <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="noErrorHandler"> - <route errorHandlerRef="noErrorHandler"> - <from uri="direct:start"/> - <to uri="cxf:bean:springEndpoint"/> - </route> + <http-conf:conduit name="*.http-conduit"> + <http-conf:client ReceiveTimeout="100"/> + </http-conf:conduit> - <route> - <from uri="direct:doCatch" /> - <doTry> - <to uri="cxf:bean:springEndpoint" /> - <doCatch> - <!-- and catch all other exceptions they are handled by default (ie handled - = true) --> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <to uri="mock:error" /> - </doCatch> - </doTry> - </route> - </camelContext> + <!-- setup the CxfEndpointConfigurer bean here --> + <bean id="myConfigurer" class="org.apache.camel.component.cxf.CxfTimeoutTest$MyCxfEndpointConfigurer"/> - <bean id="noErrorHandler" class="org.apache.camel.builder.NoErrorHandlerBuilder"/> + <bean id="defaultHostnameVerifier" class="org.apache.cxf.transport.https.httpclient.DefaultHostnameVerifier"/> + + <cxf:cxfEndpoint id="springEndpoint" + address="http://localhost:${CXFTestSupport.port1}/CxfTimeoutTest/SoapContext/SoapPort" + serviceClass="org.apache.hello_world_soap_http.Greeter"/> + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="noErrorHandler"> + <route errorHandlerRef="noErrorHandler"> + <from uri="direct:start"/> + <to uri="cxf:bean:springEndpoint?sslContextParameters=#mySslContext&hostnameVerifier=#defaultHostnameVerifier"/> + </route> + + <route> + <from uri="direct:doCatch"/> + <doTry> + <to uri="cxf:bean:springEndpoint"/> + <doCatch> + <!-- and catch all other exceptions they are handled by default (ie handled + = true) --> + <exception>java.lang.Exception</exception> + <handled> + <constant>false</constant> + </handled> + <to uri="mock:error"/> + </doCatch> + </doTry> + </route> + </camelContext> + + <bean id="noErrorHandler" class="org.apache.camel.builder.NoErrorHandlerBuilder"/> </beans> \ No newline at end of file