Hi guys,
I have an application which connects to web service. Here is part of working code:
String surl = "https://ws1.czebox.cz:443/DS/dx";
try {
URL url = new URL(surl);
System.getProperties().put("https.proxySet", "true");
System.getProperties().put("https.proxyPort", "80");
System.getProperties().put("https.proxyHost", "proxy.<our_company>.com");
javax.net.ssl.HttpsURLConnection connection = (javax.net.ssl.HttpsURLConnection) url.openConnection();
connection.setDoOutput(true);
sun.misc.BASE64Encoder base64enc = new sun.misc.BASE64Encoder();
String auth = base64enc.encodeBuffer(("<user>:<passwd>").getBytes("UTF-8")).trim();
connection.setRequestProperty("Authorization","Basic "+auth);
OutputStream out = connection.getOutputStream();
Writer wout = new OutputStreamWriter(out);
....
When I used the code in portal application javax.net.ssl.HttpsURLConnection connection = (javax.net.ssl.HttpsURLConnection) url.openConnection(); command returns following exeption.
"Type iaik.protocol.https.HttpsURLConnection is not compatible with javax.net.ssl.HttpsURLConnection"
Why url.openConnection() returns object of type iaik.protocol.https.HttpsURLConnection instead of type javax.net.ssl.HttpsURLConnection?
Is there any possibility to ensure that the method will return javax.net.ssl.HttpsURLConnection object?
Thanks in advance for reply!