Connection Reset in info log and didn’t get any response. What may be the cause?

This is the sample code in API that we use: (*The method is using for retrieve all world check iso country list.)
static String gatewayurl = "/v1/";
static String gatewayhost = "api-worldcheck.refinitiv.com";
public static void processingGetIsoCountryList() throws IOException {
_log.info("Entering the processingGetIsoCountryList method");
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
Date now = new Date();
// format for date string Mon, 27 Mar 2017 15:19:36 GMT
DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
df.setTimeZone(TimeZone.getTimeZone("GMT"));
String date = df.format(now);
String dataToSign = "(request-target): get " + gatewayurl
+ "reference/countries\n" + "host: " + gatewayhost + "\n"
+ "date: " + date;
String hmac = generateAuthHeader(dataToSign, apisecret);
String authorisation = "Signature keyId=\""
+ apikey
+ "\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date\",signature=\""
+ hmac + "\"";
_log.info("dataToSign is......" + dataToSign);
_log.info("hmac is......" + hmac);
_log.info("authorisation is......" + authorisation);
HttpGet httpGet = new HttpGet(httpsUrl + "reference/countries");
httpGet.addHeader("Authorization", authorisation);
httpGet.addHeader("Cache-Control", "no-cache");
httpGet.addHeader("date", date);
CloseableHttpResponse response = httpclient.execute(httpGet);
try {
HttpEntity entity = response.getEntity();
_log.info("response.getStatusLine is.........."+ response.getStatusLine());
String json = EntityUtils.toString(response.getEntity());
_log.info("entity is......." + entity);
_log.info("json is......." + json);
ObjectMapper mapper = new ObjectMapper();
Object jsonObj = mapper.readValue(json, Object.class);
String indented = mapper.writerWithDefaultPrettyPrinter()
.writeValueAsString(jsonObj);
_log.info("indented is..........." + indented);
EntityUtils.consume(entity);
}
catch (Exception e) {
_log.info(e.getMessage());
} finally {
response.close();
}
} catch (Exception e) {
_log.info(e.getMessage());
} finally {
httpclient.close();
}
_log.info("Exiting the processingGetIsoCountryList method");
}
In the API.log, you will notice that after executing the code CloseableHttpResponse response = httpclient.execute(httpGet);
The connection was reset. It didn’t get any response.
This line of code was not called: _log.info("response.getStatusLine is.........."+ response.getStatusLine());
Here's the result in API.log
14:41:37.435 [http-thread-pool-8083(2)] INFO com.tr.worldCheckApi.GetRequest - Entering the processingGetIsoCountryList method
14:41:38.224 [http-thread-pool-8083(2)] INFO com.tr.worldCheckApi.GetRequest - dataToSign is......(request-target): get /v1/reference/countries
host: api-worldcheck.refinitiv.com
date: Mon, 10 May 2021 06:41:38 GMT
14:41:38.224 [http-thread-pool-8083(2)] INFO com.tr.worldCheckApi.GetRequest - hmac is......sCGRBNlS5we5RKGJEr7TARZ60Smy4zXzOujNgeMSEEo=
14:41:38.225 [http-thread-pool-8083(2)] INFO com.tr.worldCheckApi.GetRequest - authorisation is......Signature keyId="1ad3ff6b-2870-4478-bc23-cae4cc4f2422",algorithm="hmac-sha256",headers="(request-target) host date",signature="sCGRBNlS5we5RKGJEr7TARZ60Smy4zXzOujNgeMSEEo="
14:41:42.069 [http-thread-pool-8083(2)] INFO com.tr.worldCheckApi.GetRequest - Connection reset
14:41:42.071 [http-thread-pool-8083(2)] INFO com.tr.worldCheckApi.GetRequest - Exiting the processingGetIsoCountryList method
Best Answer
-
Can you please share the request and the response headers of the failed request? We would need both in order to investigate further on the cause of the error.
0
Answers
-
I didn't use request and response headers. I download the World-Check One API Java Request Code and World-Check One API Java v1.2 Collection Tool and incorporate it in our system. I use this to test the connectivity and authorization to the World-Check One API webserver as well as to retrieve information.
I want to check if my Java Code need some update to connect in the World-Check One API webserver.
0 -
Thanks for your response.
The code which you have downloaded is sample code, and may not work if you are using different development component. So I would advise you to please share the request and the response header, as Error 401, could be due to the different in the timestamps between request and response.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 249 ETA
- 554 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 643 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 192 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛