Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.net.MalformedURLException: unknown protocol: https

843811Mar 20 2002 — edited Sep 4 2002
Hi,
I am getting the following error when I am trying to connect to the remote server
java.net.MalformedURLException: unknown protocol: https

The code works on my local m/c but its not working on server. On server we are using JRun. I have put all the 3 jar files in classpath. Please help me.

The code is as below
public static String sendXml(String theXMLMessage) {
StringBuffer response = new StringBuffer();
try{

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
System.getProperties().put( "https.proxyHost", BO_Configuration.PROXY_SERVER_NAME );
System.getProperties().put( "https.proxyPort", BO_Configuration.PROXY_SERVER_PORT );
URL url = new URL(BO_Configuration.URL_EUROPE);
huc = (com.sun.net.ssl.HttpsURLConnection)url.openConnection();
String password = "userId:passwd";
String encodedPassword = encodeBase64( password.getBytes() );
huc.setRequestProperty( "Https-Proxy-Authorization", encodedPassword );
huc.setRequestMethod("POST");
huc.setRequestProperty("Authorization", "Basic "+encodeBase64((BO_Configuration.MERCHANT_CODE+":"+BO_Configuration.PASSWORD).getBytes()));
huc.setRequestProperty("Host", url.getHost());
huc.setDoOutput(true);
PrintWriter writer = new PrintWriter(huc.getOutputStream());
writer.println(theXMLMessage);
writer.flush();
writer.close();
BufferedReader br = new BufferedReader(new InputStreamReader(huc.getInputStream()));
String line;
while((line = br.readLine()) != null){
response.append(line);
response.append("\n");
}
}catch(MalformedURLException mfue){
mfue.printStackTrace();
}catch(IOException ioe){
ioe.printStackTrace();
}
return response.toString();
}

Thanks,
Nikhil
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 2 2002
Added on Mar 20 2002
3 comments
286 views