Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I use java and gdata API to manage my Calendar's data. But it works only if I have direct access to the Internet. In my case I have to use proxy. Is there any way to manage my Google calendar's data through the proxy?

I'v tried this way:

System.setProperty("http.proxyHost", "myproxy.mydomain.com");
System.setProperty("http.proxyPort", "3128");
URL feedUrl = new URL("http://www.google.com/calendar/feeds/....");
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");      

String encoded = new String(Base64.encodeBase64(new String("proxy_user:proxy_password").getBytes()));
String base64encodedCredentials = "Basic " + encoded;
myService.getRequestFactory().setPrivateHeader("Proxy-Authorization", base64encodedCredentials);

//!!! Exception in this line
myService.setUserCredentials("my_google_accaunt@gmail.com", "my_google_password");

Exception:

Exception in thread "main" com.google.gdata.util.AuthenticationException: Error connecting with login URI
    at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:549)
    at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:397)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:364)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:319)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:303)
    at calendartest.CalendarTest.getCalendarEventsWithProxy(CalendarTest.java:145)
    at calendartest.CalendarTest.main(CalendarTest.java:195)
Caused by: java.net.ConnectException: Connection timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    at java.net.Socket.connect(Socket.java:579)

Without proxy everything works.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
162 views
Welcome To Ask or Share your Answers For Others

1 Answer

You didn't say what language you're using but instructions for Java and .Net# are at:

https://developers.google.com/gdata/articles/proxy_setup

instructions for Python can be found at:

http://code.google.com/p/gdatacopier/wiki/ProxySupport (these should work for any app using the gdata-python-client)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...