Over a million developers have joined DZone.

Doing HTTPS Communication with http:outbound-gateway

· Integration Zone

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

In Spring Integration if you have to do https communication when using http:outbound-gateway, you need to use 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.



Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

Topics:

Published at DZone with permission of Krishna Prasad, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}