I'm trying to use Camel's HTTP component to send a POST request to a
web service using HTTPS. When I attempt to connect, I get the
following exception:

org.apache.camel.RuntimeCamelException:
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
        at 
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:850)
        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:138)
        at 
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:101)
        at 
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:105)
        at 
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:121)
        at 
org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:201)
[etc.]

I'm pretty sure that this is because the remote side is using a
self-signed certificate.

The question is: is there a good way to replace the behavior SSL
factory used by the Commons HTTPClient inside of the camel-http
component to make it accept self-signed certificates? I see that the
docs mention that you can provide a class that extends
CamelHttpClientConfigurer and configure the endpoint to use a
reference to that bean.

Ideas?

--sgp
cf. http://www.smerpology.org/

Reply via email to