nareshishere

Connection timed out: connect; nested exception is java.net.ConnectException

0 votes
Getting connection exception when i try to retrieve documents using rest template https://sandbox.esignlive.com/api/packages/avN83DHFw-MIWHZJHk8D54pgzcs=/documents/15657c0c6edb22100d4a0c632c722a2d9b35ca89dae3aa60/pdf

Reply to: Connection timed out: connect; nested exception is java.net.ConnectException

0 votes
Hi nareshishere, Are other calls sent out from RestTemplate hit the same connection timed out exception? Does your environment required to connect through a proxy or firewall whose certificate required to be added to the JVM trust chain? As a quick test, below script works fine at my machine.
		String url = "https://sandbox.esignlive.com/api/packages/c1CbUaFc_oOX2PiMPZJvdkG84pg=/documents/a01a11c49abd6d8f3746166539297d4fe5dc4b9c8f1e7b47/pdf";

		RestTemplate restTemplate = new RestTemplate();
		HttpHeaders headers = new HttpHeaders();
		headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
		headers.add("Authorization", "Basic your_api_key");
		HttpEntity> request = new HttpEntity>(null,
				headers);
		ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, request, byte[].class);

		if (response.getStatusCode() == HttpStatus.OK) {
			Files.write(Paths.get("c1CbUaFc_oOX2PiMPZJvdkG84pg=_a01a11c49abd6d8f3746166539297d4fe5dc4b9c8f1e7b47.pdf"), response.getBody());
		}
Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Connection timed out: connect; nested exception is java.net.ConnectException

0 votes
yes my environment need proxy and certificate . Could you help with the certificates .

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off