alfdev / linkedin-j

Automatically exported from code.google.com/p/linkedin-j
0 stars 0 forks source link

Proxy setting #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Nabeel,

Your application works well with the network without proxy. But when I
tried to use it in the network with proxy, it doesn't work. The following
exception is throwed:

************************************************************************
com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceException:
oauth.signpost.exception.OAuthCommunicationException: Communication with
the service provider failed: api.linkedin.com
    at
com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthReques
tToken(LinkedInOAuthServiceImpl.java:72)
    at
com.google.code.linkedinapi.client.examples.OAuthAuthenticationExample.processCo
mmandLine(OAuthAuthenticationExample.java:84)
    at
com.google.code.linkedinapi.client.examples.OAuthAuthenticationExample.main(OAut
hAuthenticationExample.java:62)
Caused by: oauth.signpost.exception.OAuthCommunicationException:
Communication with the service provider failed: api.linkedin.com
    at
oauth.signpost.basic.DefaultOAuthProvider.retrieveToken(DefaultOAuthProvider.jav
a:150)
    at
oauth.signpost.basic.DefaultOAuthProvider.retrieveRequestToken(DefaultOAuthProvi
der.java:66)
    at
com.google.code.linkedinapi.client.oauth.LinkedInOAuthServiceImpl.getOAuthReques
tToken(LinkedInOAuthServiceImpl.java:64)
    ... 2 more
Caused by: java.net.UnknownHostException: api.linkedin.com
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:519)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:550)
    at
com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:14
1)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
    at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:272)
    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
    at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(A
bstractDelegateHttpsURLConnection.java:172)
    at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:
793)
    at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDe
legateHttpsURLConnection.java:158)
    at
sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl
.java:133)
    at oauth.signpost.basic.DefaultOAuthProvider.retrieveToken(DefaultOAuthProvide
r.java:121)
... 4 more
***************************************************************************

I tried to set up the proxy, but it still doesnt work, something like this:
        Properties systemSettings = System.getProperties();
        systemSettings.put("http.proxyHost", "proxy");
        systemSettings.put("http.proxyPort", "8080");
        System.setProperties(systemSettings);

Do you have any hint???

Thanks in advance,
Quyen

Original issue reported on code.google.com by thucquye...@gmail.com on 4 Jan 2010 at 8:35

GoogleCodeExporter commented 9 years ago
Hi Quyen
Can you add this code and let me know if it works? (Note https instead of http)
systemSettings.put("https.proxyHost", "proxy");
systemSettings.put("https.proxyPort", "8080");

If this doesn't work I will try to setup a proxy at my end and debug it.

Regards
Nabeel Mukhtar

Original comment by nabeelmukhtar on 5 Jan 2010 at 5:07

GoogleCodeExporter commented 9 years ago
Hi Nabeel,

Great, it works with your setting.

Thank you very much,
Quyen

Original comment by thucquye...@gmail.com on 5 Jan 2010 at 12:16

GoogleCodeExporter commented 9 years ago

Original comment by nabeelmukhtar on 5 Jan 2010 at 1:01

GoogleCodeExporter commented 9 years ago
Hi Nabeel,

Just for your information:
-authentication process uses https protocol
-retrieving data uses http protocol

Cheers,
Quyen

Original comment by thucquye...@gmail.com on 5 Jan 2010 at 9:26

GoogleCodeExporter commented 9 years ago
Hi again,
Now i can connect to the proxy with HTTPS but i have a new error :-)

Caused by: java.io.IOException: Unable to tunnel through proxy. Proxy returns 
"HTTP/1.0 407 Proxy Authentication Required"

I must use my user name and password but i don't really know how to set these. 
I 
tried:
systemSettings.put("https.proxyUserName", "xxx");
systemSettings.put("https.proxyPassword", "yyy");
But it doesn't work even with http.proxyUser...

Ty.

Original comment by thomasme...@gmail.com on 28 Jan 2010 at 12:22

GoogleCodeExporter commented 9 years ago
Has to be reopened for the proxy authentication issue.

Original comment by nabeelmukhtar on 29 Jan 2010 at 5:41