Doing HTTPS communication with http:outbound-gateway

In Spring Integration when using http:outbound-gateway if you have to do https communication, you need to do the following trick,

<int-http:outbound-gateway id="my.outbound.gateway"
request-channel="request-channel" reply-channel="reply-channel"
url="https://localhost:8443/myservice/myService"
http-method="POST"
expected-response-type="java.lang.String">
</int-http:outbound-gateway>

Now you need to pass the keystore and trust store of the client and server as follows,

<bean id="trustStore">
<property name="targetObject" value="#{@systemProperties}" />
<property name="targetMethod" value="putAll" />
<property name="arguments">
<props>
<prop key="javax.net.ssl.trustStore"><jks key location></prop>
<prop key="javax.net.ssl.keyStorePassword">password</prop>
</props>
</property>
</bean>

<bean id="keystore">
<property name="targetObject" value="#{@systemProperties}" />
<property name="targetMethod" value="putAll" />
<property name="arguments">
<props>
<prop key="javax.net.ssl.keyStore"><jks key location></prop>
<prop key="javax.net.ssl.keyStorePassword">password</prop>
</props>
</property>
</bean>

There is also another way as mentioned in this article @ http://forum.springsource.org/showthread.php?115198-HTTPS-in-http-outbound-gateway

I hope this blog helped you.

About these ads

5 thoughts on “Doing HTTPS communication with http:outbound-gateway

  1. ajmal

    Hi, Could you please let me know the configuration on client side which http outbound adapter as beans keystore and truststore are missing the classes. If you have complete example. Could you upload the code. Thanks

    Reply
  2. ajmal

    Thanks, I’m able to configure and it is working fine. Using truststore is enough for communicating with outbound adapter.

    Reply
  3. Sarath

    Hi, Kindly let me know on how can we configure the trustStore and keyStore ? Should it be used in outbound-gateway call ?

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s