For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
5 2 9 12

Exception:org.apache.http.conn.HttpHostConnectException: Connection to https://hosted.datascopeapi.reuters.com refused

client has generated Token using SOAP API, but not able to connect to Java, he is getting error message

Connection to https://hosted.datascopeapi.reuters.com refused



public void getSessionToken(String username, String password) {

try {
HttpPost httppost = new HttpPost("https://hosted.datascopeapi.reuters.com/RestApi/v1/Authentication/RequestToken");

httppost.addHeader("content-type", "application/json; charset=UTF-8");

/*JSONObject TokenRequest = new JSONObject()
.put("Credentials", new JSONObject()
.put("Username", username)
.put("Password", password));*/

StringEntity requestBody = new StringEntity("{\"Credentials\": {\"Username\":\"XXXXXXXXX\",\"Password\":\"XXXXXXX\"}}");

httppost.setEntity(requestBody);

ResponseHandler<String> responseHandler = new BasicResponseHandler();

String response = httpclient.execute(httppost, responseHandler);
//JSONObject jsonResponse = new JSONObject(response);

//sessionToken = jsonResponse.get("value").toString();
System.out.println("Session Token (expires in 24 hours):\n" + response);

} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}sss



… Exception:
org.apache.http.conn.HttpHostConnectException: Connection to https://hosted.datascopeapi.reuters.com refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:645)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)




dss-rest-apidatascope-selectdssconnection-error
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @Prathibha.Mariyappa,

Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

-AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.
Thanks,

AHS


1 Answer

· Write an Answer
Upvotes
Accepted
32.2k 40 11 20

Hello @Prathibha.Mariyappa,

Is the client per chance behind a firewall?

That would be the most common reason, why the connection is refused.

If that is the case, try our Java example that includes proxy handling (DSS2TokenProxy, DSS2TokenPorxyAuth, depending if the proxy requires a proxy username and password spec) , it shows how to specify the proxy to interact with DSS from behind the firewall.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @Prathibha.Mariyappa,

Any update on this?

Were you able to proceed?

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.