21 June 2018

Java HTTP Proxy

A pesar que es trivial muchas veves preguntan lo mismo:

http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html

//System.getProperties().put("proxySet", "false");
  System.getProperties().put("http.proxyHost", captchaProxy);  // con o sin http. funciona :P
  System.getProperties().put("http.proxyPort", captchaPort);

buscar los diferentes metodos...

mirar mi proyecto web-proxy

http://www.coderanch.com/t/384957/java/java/set-proxy-options-command-prompt

http://stackoverflow.com/questions/3957599/how-to-test-proxy-internet-connection-using-java

Proxy class ?

y otros...

con el FTP tb.

---

Sample code shipped:

public static void main(String[] args) throws ServiceException, RemoteException {
String proxyHost = "proxy.oracle.com";
String proxyPort = "8888";
String proxyUsername = "username";
String proxyPassword = "password";

Proxy p = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, Integer.parseInt(proxyPort)));
HttpTransportInfo info = new HttpTransportInfo();
info.setProxy(p);
info.setProxyUsername(proxyUsername.getBytes());
info.setProxyPassword(proxyPassword.getBytes());

GlobalWeather service = new GlobalWeather_Impl("http://www.webservicex.net/globalweather.asmx?wsdl", info);

GlobalWeatherSoap soap = service.getGlobalWeatherSoap();
System.out.println(soap.getCitiesByCountry("Singapore"));


y otros ???



No comments :

My Blog List

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.