javalearner
javalearner

Reputation: 367

how to add jks file while invoking Restful serice through camel

I was getting

unable to find valid certification path to requested target

while invoking a Restful service through camel integration so I have created a jks file by importing the signed certificate the service .

How can I use that jks file in restful call using camel?

Upvotes: 0

Views: 587

Answers (1)

Lucifer
Lucifer

Reputation: 842

If you are using spring DSL you can configure like this

<sslContextParameters id="sslInvoke" xmlns="http://camel.apache.org/schema/spring">
    <secureSocketProtocols>
        <secureSocketProtocol>TLSv1</secureSocketProtocol>
        <secureSocketProtocol>TLSv1.1</secureSocketProtocol>
        <secureSocketProtocol>TLSv1.2</secureSocketProtocol>
    </secureSocketProtocols>
    <keyManagers keyPassword="give your password">
        <keyStore resource="path to jks" password="password" />
    </keyManagers>
    <trustManagers>
        <keyStore resource="path to jks" password="password" />
    </trustManagers>
</sslContextParameters>

<spring:bean id="jetty" class="org.apache.camel.component.jetty9.JettyHttpComponent9">
    <spring:property name="ssl" ref="sslInvoke" />
</spring:bean>

For more info related to HTTP ssl configuration [refer this]http://camel.apache.org/http.html

Upvotes: 1

Related Questions