Our application needs to use a proxy server to do an HTTPS post to a third-party data vendor. The application is nearing launch date, and all the Googling in the world hasn't helped us yet... I was wondering if anyone here might be able to send me in the right direction. Here's what we're CURRENTLY doing:
Document myXML = null;
HttpURLConnection connection = null;
Properties property = System.getProperties();
final String USERNAME = "user";
final String USERPASSWORD = "pass";
String serverName = URL url = new URL(serverName);
connection = (HttpURLConnection) url.openConnection();
property.put("http.proxyHost", "my_proxy_host"
property.put("http.proxyPort", "666"
java.net.Authenticator.setDefault(new java.net.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new java.net.PasswordAuthentication(USERNAME,
USERPASSWORD.toCharArray());
}
});
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setUseCaches(false);
connection.setRequestProperty(
"Content-Type",
"text/xml; charset=utf-8"
connection.setRequestMethod("POST"
connection.connect();
myXML = (Document) connection.getOutputStream();
It's not even getting past the seventh line URL = new URL(String). It throws an "invalid protocol: HTTPS" error when I do an e.getMessage(). Any help? TIA,
RJ
************
RudeJohn
************
Document myXML = null;
HttpURLConnection connection = null;
Properties property = System.getProperties();
final String USERNAME = "user";
final String USERPASSWORD = "pass";
String serverName = URL url = new URL(serverName);
connection = (HttpURLConnection) url.openConnection();
property.put("http.proxyHost", "my_proxy_host"
property.put("http.proxyPort", "666"
java.net.Authenticator.setDefault(new java.net.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new java.net.PasswordAuthentication(USERNAME,
USERPASSWORD.toCharArray());
}
});
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setUseCaches(false);
connection.setRequestProperty(
"Content-Type",
"text/xml; charset=utf-8"
connection.setRequestMethod("POST"
connection.connect();
myXML = (Document) connection.getOutputStream();
It's not even getting past the seventh line URL = new URL(String). It throws an "invalid protocol: HTTPS" error when I do an e.getMessage(). Any help? TIA,
RJ
************
RudeJohn
************