1

Spring-Integration 4:

I'd like to make communication with http outbound-gateway for HTTPS. i.e. with secure protocol. Requirement is I'd like to use URL "https://" but we don't have certificate & need to bypass this.

Kay Pan
  • 11
  • 2

1 Answers1

1

I found in some my old project this config:

<bean id="clientHttpRequestFactory" class="org.springframework.http.client.CommonsClientHttpRequestFactory"/>
<!--TODO waiting HttpClient SSL impl <bean id="clientHttpRequestFactory" class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory"/>-->

And I remember that such kind of CommonsClientHttpRequestFactory for commons-http-client-3.0 allows to accept all server certificates. Otherwise you should customize HttpComponentsClientHttpRequestFactory for commons-http-client-4.x, like this:

CloseableHttpClient httpClient = HttpClients.custom().setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE).build()

See more info in this answer: How to ignore SSL certificate errors in Apache HttpClient 4.0.

After that customization you just should inject that clientHttpRequestFactory to the <int-http:outbound-gateway>.

Community
  • 1
  • 1
Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • My sample looks like this: – Kay Pan May 07 '15 at 10:40
  • @Artem How do I wire CloseableHttpClient in my SpringXML and set SSLContext, please see my question here.. http://stackoverflow.com/questions/34242723/allowallhostnameverifier-in-spring-integration-xml – Himalay Majumdar Dec 12 '15 at 17:23