aspose file tools
The moose likes Java in General and the fly likes Connecting to https urls from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Connecting to https urls from Java" Watch "Connecting to https urls from Java" New topic
Author

Connecting to https urls from Java

Reddy Prashanth
Ranch Hand

Joined: Aug 09, 2005
Posts: 61
Hi,

I could access the https urls using HttpClient API but the code is failing when the url prompts for certificate pop-up .

I am using the below code to get the content of the https url page.



This is working for some urls , but for some urls , it is not. Could someone please guide how to handle ssl certificates while accessing https urls.

Example url that is failing : https://passport.gov.in/



Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

I think you are using Apache HTTP Client API. I've never used that library myself, but I found a few pages that might help

Authentication Guide
SSL Guide

Aren't you supposed to authenticate your request...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6588
    
    1

The connection fails because the certificate is not trusted. You can get around that by importing the certificate to the keystore that the client uses. You can follow a discussion on that topic here -> http://www.coderanch.com/t/463562/BEA-Weblogic/Weblogic-SSL-certificate


SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

I was once connecting to a HTTPS web service and the certificate was a test certificate. So I used this utility to solve my problem...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Connecting to https urls from Java
 
Similar Threads
javax.net.ssl.SSLException: untrusted server cert chain
OOM
HTTP/1.1 401 Authorization Required with HttpClient 4.1.1
Servlet redirect to another server
http client + thread save conn manager + execute get request time problems