HTTP.sendRequest() is not working with an SSL enabled service (HTTPS)

HTTP.sendRequest() is not working with an SSL enabled service (HTTPS)

book

Article ID: KB0086917

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Description:
When trying to invoke a Webservice which has SSL enabled with the HTTP.sendRequest() function, the following exception is reported.
>
>>>>>>>>>>>>>>>>>>>
2016 Mar 16 19:27:56:158 GMT -4 test Error [HttpRequest] - [root] org.apache.http.client.ClientProtocolException
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:867)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:21)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:160)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:136)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at com.tibco.cep.driver.http.client.impl.httpcomponents.HttpComponentsClient$3.call(SourceFile:288)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at com.tibco.cep.driver.http.client.impl.httpcomponents.HttpComponentsClient$3.call(SourceFile:260)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at java.util.concurrent.FutureTask.run(Unknown Source)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at java.lang.Thread.run(Unknown Source)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root] Caused by: org.apache.http.HttpException: Scheme 'https' not registered.
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.conn.DefaultHttpRoutePlanner.determineRoute(DefaultHttpRoutePlanner.java:109)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:762)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:381)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 ... 10 more
<<<<<<<<<<<<<<<<<<<<

Symptoms:
We are trying to invoke a Webservice which has SSL enabled with HTTP.sendRequest() function, but get the following exception:
>>>>>>>>>>>>>>>>>>>>
2016 Mar 16 19:27:56:158 GMT -4 test Error [HttpRequest] - [root] org.apache.http.client.ClientProtocolException
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:867)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:21)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:160)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:136)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at com.tibco.cep.driver.http.client.impl.httpcomponents.HttpComponentsClient$3.call(SourceFile:288)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at com.tibco.cep.driver.http.client.impl.httpcomponents.HttpComponentsClient$3.call(SourceFile:260)
2016 Mar 16 19:27:56:159 GMT -4 test Error [HttpRequest] - [root]                 at java.util.concurrent.FutureTask.run(Unknown Source)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at java.lang.Thread.run(Unknown Source)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root] Caused by: org.apache.http.HttpException: Scheme 'https' not registered.
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.conn.DefaultHttpRoutePlanner.determineRoute(DefaultHttpRoutePlanner.java:109)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:762)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:381)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
2016 Mar 16 19:27:56:160 GMT -4 test Error [HttpRequest] - [root]                 ... 10 more
<<<<<<<<<<<<<<<<<<<<
Cause:
When invoking a service with SSL enabled, use the connection which has secure enabled.

Issue/Introduction

HTTP.sendRequest() is not working with an SSL enabled service (HTTPS)

Resolution

Make sure the HTTP connection used to send the request has secure enabled. Sample code follows.


Object httpConnection= HTTP.ConnectionInfo.createHTTPConnectionInfo(false);

...

httpConnection= HTTP.ConnectionInfo.setSecureInfo(httpConnection, ...);   

...


httpResponse = HTTP.sendRequest(url,  usageRequest,   "/response/event/URI",  timeOutInMillis, httpConnection);