on 09-06-2010 12:38 PM
Hi Guys,
I am currently creating a Java mapping program that reads a URL file (i.e. https://pvsp65farp.skillport.com/pvsp65faRS_reports/ODTEX0MjhJgxU/u1/u1_128288917271279425.xml)_from the payload.
The PI server is using a proxy server to connect to the internet. I set the System properties to use the proxy address and port, but I'm getting an error when I tried to connect. The URL is in HTTPS. However, I could not make a successful connection. It seems that the proxy is not being called when I test the program in IR.
Here is the snippets of my code that use proxy and connects on the URL:
System.setProperty("https.proxyHost","XXX.XX.XX.XX");
System.setProperty("https.proxyPort","8081");
InetAddress proxyAddress= InetAddress.getByName","XXX.XX.XX.XX") ;
InetSocketAddress addr = new InetSocketAddress(proxyAddress, 8081);
URL URLfile = new URL(filename );
getTrace().addInfo(URLfile.openConnection().getClass().toString());
HttpsURLConnection connection = (HttpsURLConnection)URLfile.openConnection();
connection.connect();
Here is the error I am receiving:
Root Cause: org.w3c.www.protocol.http.HttpException: The host name [pvsp65farp.skillport.com] couldn't be resolved. Details: "pvsp65farp.skillport.com: pvsp65farp.skillport.com" java.net.UnknownHostException: pvsp65farp.skillport.com: pvsp65farp.skillport.com at java.net.InetAddress.getAllByName0(InetAddress.java:1188) at java.net.InetAddress.getAllByName(InetAddress.java:1115) at java.net.InetAddress.getAllByName(InetAddress.java:1051) at org.w3c.www.protocol.http.HttpBasicServer.updateHostAddr(Unknown Source) at org.w3c.www.protocol.http.HttpBasicServer.initialize(Unknown Source)
Can you please help me what is wrong or what is lacking in my code? I also tried to use the URLfile.openConnection(proxy), but I am only getting UnSupportedOperation exception. Please advice.
Thanks,
Jenny
I added a system properties to use the proxy settings.
Here is the code snippets:
System.getProperties().put("https.proxyHost","XX.XX.XX.XX");
System.getProperties().put("https.proxyPort","8081");
System.getProperties().put("java.net.useSystemProxies", true);
URL URLfile = new URL(filename);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess there are some firewalls.
The hostname/IPAddress (pvsp65farp.skillport.com) should be added in firewalls in bidirectional mode.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi VJ,
I also tried the IP address but its still not working. I changed my code as below but now I am getting an SSL error ( iaik.security.ssl.SSLException: Invalid SSL message, peer seems to be talking plain!)
System.getProperties().put("https.proxyHost","XX.XX.XX.XX");
System.getProperties().put("https.proxyPort","8081");
System.getProperties().put("java.protocol.handler.pkgs", "iaik.protocol");
InetAddress proxyAddress= InetAddress.getByName("XXX.XX.XX.XX") ;
InetSocketAddress addr = new InetSocketAddress(proxyAddress, 8081);
URL URLfile = new URL("https", addr.getHostName(), addr.getPort(), filename);
HttpsURLConnection connection = (HttpsURLConnection)URLfile.openConnection();
InputStream inputStream = connection.getInputStream();
I encountered the error on the last line. HttpsURLConnection in this code is from iSaSilk (iaik.protocol.https.HttpsURLConnection).
Can you help me how to implement SSL connection under proxy using the iSaSilk?
Thanks,
Jenny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try giving the IP address instead of the server host name? Looks like the DNS look up is not able to find the server by name.
VJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.