posted 16 years ago
Hi,
I am trying to make a connection using HttpURLConnection to make connection to a URL and read the resulting XML output. Am getting a connection timed out error or connection refused error if the URL is given as http and not https. The following is the code -
URL url = new URL( urlString );
URLConnection URLconnection =
url.openConnection ( ) ;
HttpURLConnection httpConnection =
(HttpURLConnection)
URLconnection;
int responseCode =
httpConnection.getResponseCode ( ) ;
if ( responseCode ==
HttpURLConnection.HTTP_OK) {
InputStream in =
httpConnection.getInputStream ( ) ;
}
Can someone please help me in reading an XML response obtained from a secure URL.