Zum Inhalt wechseln

Welcome! You're currently a Guest.

If you'd like to join in the Discussion, or access additional features in our forums, please sign in with your Evernote Account here. Have an Evernote Account but forgot your password? Reset it! Don't have an account yet? Create One! You'll need to set your Display Name before your first post.

Foto

Evernote Java API and VPN - what am I missing?

java api vpn

  • Please log in to reply
9 Antworten in diesem Thema

#1 Marco A

Marco A

  • PIP
  • Title: Member
  • Group: Members
  • 6 Beiträge

Geschrieben 25 April 2012 - 05:35

Hi all,

I've been successfully using the Evernote Cloud API (client primarily, but also a bit of oauth) but have now hit a snag. While connected to my company's network/internet via Cisco VPN, my application times out when making the userStore.checkVersion() call. No problems running the app with VPN off, but connect it and everything goes dead.

The Evernote Windows app has no problems at all syncing while connected via VPN, so I'm certain it's a setting/call/something I'm just not making. My code is based on the sample code provided with the API download, though, and after combing through the API docs and searching the forums, I'm not sure where else to look for what I may be missing.

Any help, guidance, or consolation you can share would be greatly appreciated...but especially help or guidance. :)

Thanks so much,
Marco

#2 Marco A

Marco A

  • PIP
  • Title: Member
  • Group: Members
  • 6 Beiträge

Geschrieben 25 April 2012 - 05:40

Just wanted to add that in running the sample web app (EDAMWebTest) after updating the index.jsp as required, it also times out. So this isn't limited to just the client connection approach.

Thanks,
Marco

#3 SethH

SethH

  • Title: Evernote Employee
  • Group: Evernote Employee
  • 683 Beiträge

Geschrieben 25 April 2012 - 05:51

Is the VPN setting itself up as a proxy? Java doesn't automatically pick up proxy settings...that could be it.

http://docs.oracle.c...et/proxies.html

#4 Marco A

Marco A

  • PIP
  • Title: Member
  • Group: Members
  • 6 Beiträge

Geschrieben 25 April 2012 - 06:01

I suspect that is the case. Running ipconfig /all, I get one set of IPs for the NIC, one for the "VPN Client Connection". What's confusing me is why the Evernote app picks it up. Is there a call I need to add (or parameters) to accommodate when the VPN goes live? The key lines in my code are:


THttpClient userStoreTrans = new THttpClient(userStoreUrl);
userStoreTrans.setCustomHeader("User-Agent", userAgent);
TBinaryProtocol userStoreProt = new TBinaryProtocol(userStoreTrans);
userStore = new UserStore.Client(userStoreProt, userStoreProt);

boolean versionOk =
userStore.checkVersion(myAppName,
com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR,
com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR);

Nothing fancy. Variables are defined and populated above. And it works fine when VPN isn't in the picture.

Thank you for your help, Seth. I feel like I just need a little more information to make this work 100% of the time!

Marco

#5 SethH

SethH

  • Title: Evernote Employee
  • Group: Evernote Employee
  • 683 Beiträge

Geschrieben 26 April 2012 - 01:08

There's nothing specific to the Evernote SDK that you need to use - it's something in Java-land that we need to figure out.

#6 Marco A

Marco A

  • PIP
  • Title: Member
  • Group: Members
  • 6 Beiträge

Geschrieben 26 April 2012 - 01:24

Hi Seth,

Thanks again for replying. I did some digging and have uncovered the rather-well-hidden proxy server information for my company connection. I did some testing with the sample client app (already had it compiled & ready to go), passing parameters -Dhttp.proxyHost and -Dhttp.proxyPort. I also tried SOCKS proxy parameters because while I think it's just an http proxy, I'm not 100% sure. No luck.

I hope to put something together and run it under the debugger tomorrow using the info you sent about setting the proxy via class. I'm not sure what will come of it, if anything...but I can't imagine Java's networking just can't/won't work with a VPN. I hope that isn't the case!

Thank you again, and please let me know if you (or anyone else) thinks of something that may be helpful. I'll let you know what I learn as well!

Marco

#7 SethH

SethH

  • Title: Evernote Employee
  • Group: Evernote Employee
  • 683 Beiträge

Geschrieben 26 April 2012 - 04:31

Try setting -Dhttps.proxyHost and -Dhttps.proxyPort (note the "s"). Oracle (Sun?) has rather cleverly hidden the https settings in the giant page of documentation.

#8 Marco A

Marco A

  • PIP
  • Title: Member
  • Group: Members
  • 6 Beiträge

Geschrieben 26 April 2012 - 07:12

Hi Seth,

I tried it, but no luck. I've tried with the proxyPort parameter listed and without (80 for http, 443 for https), for both http. and https. Still looking for (and open to) any other options. Thank you again for your help!

Marco

#9 Nodrog

Nodrog

  • PIP
  • Title: Member
  • Group: Members
  • 21 Beiträge

Geschrieben 01 Mai 2012 - 08:41

Hi Marco,

Some things to try:

Is your app returning an error? Are you getting a connection time-out, anything? You might put the connection attempt in a try/catch block and spit out an error message that might be helpful.

Are the security policies on your VPN client and concentrator dropping your traffic (check logs) ?

Have you tried restarting the application once the VPN client is active so that it might refresh it's default route ARP entry, DNS, or other needed info that might change?

Does the VPN client provide a different DNS than what is used when the client is not active, if so is it resolving sandbox.evernote.com?

HTH,

Perryn

#10 Marco A

Marco A

  • PIP
  • Title: Member
  • Group: Members
  • 6 Beiträge

Geschrieben 02 Mai 2012 - 06:28

Hi Perryn,

I have the connection attempt in try/catch, but the error only returns "connection timeout". It isn't helping us much!

I have tried to enable VPN logging, but it appears our version of the VPN client doesn't include that capability - or at least I can't get to it. I have tried restarting the Java app (actually, I've tried running with and without debugger in NetBeans) and it doesn't seem to change anything. It just waits a bit when calling userStore.checkVersion(), then returns a connection timeout error.

I did try to run a tracert (Cygwin under Windows) and it doesn't show any hops after the initial VPN server - for any address I try (including www.google.com). It just shows "Request timed out." I can browse to anything in a web browser, though, and the Evernote Windows app works fine...as does the connection via browser to sandbox.evernote.com. Just trying to explore every angle. :)

I hope to experiment a little later today/night. If I see anything that might be helpful, I'll post it here. Thank you very much for your help!

Marco





Besucher die dieses Thema lesen: 1

Mitglieder: 0, Gäste: 1, unsichtbare Mitglieder: 0

Clip to Evernote