Good, I have made a class that makes a http connection to a url to download an excell file to a local directory. This class in a main method works fine but at the moment I transfer that class to a method in SAP Netweaver Developer Studio it is giving me the following error. This is my code of the method that downloads the Excell file:
File dir = new File(folderName);
if (!dir.exists()) {
if (!dir.mkdir()) {
return salida;
}
}
File f = new File (folderName + "/" + fileName);
//Creamos el proxy para poder conectarnos a la URL
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.65.4.1", 8080));
String ruta = rutaFocus + fileName + descarga;
URL url = new URL(ruta);
HttpURLConnection uc = (HttpURLConnection) url.openConnection(proxy);
uc.connect();
int b = 0;
while (b != -1) {
b = in.read();
if (b != -1) {
out.write(b);
}
}
out.close();
in.close();
But it returns the error in the line
HttpURLConnection uc = (HttpURLConnection) url.openConnection(proxy)
giving as error:
org.w3c.www.protocol.http.HttpException: Connect timed out.
Someone could give me some explanation or why he returns the error. Thanks