kikovalle / PLGSharepointRestAPI-java

Easy to use wrapper for the Sharepoint Rest API v1. Even if this is not a full implementation it covers most common use cases and provides examples to extending this API.
MIT License
39 stars 31 forks source link

Connection timeout #33

Closed bradcheon closed 2 years ago

bradcheon commented 2 years ago

Hi Kikovalle,

First of all, thanks heap for sharing your API. It's a big help for us.

I created a Java executable with your API, which basically copies binary files from a Linux server and uploads to the designated SharePoint directory. A shell batch script calls the Java executable a daily base.

It worked as expected when I ran the shell script from my work laptop (windows 10) for testing. It uploaded the files in my laptop to the SharePoint directory.

However, I got the connection timeout error as below when I ran the shell script from a linux server. I used the same files in the directory in the Linux server.

[main] ERROR xxx.xxx.xx.ict.sharepointupload.UploadFile - I/O error on POST request for https://login.microsoftonline.com/extSTS.srf: Connect to login.microsoftonline.com:443 [login.microsoftonline.com/xx.xxx.14.163, login.microsoftonline.com/xx.xxx.142.166, login.microsoftonline.com/xx.xxx.142.165, login.microsoftonline.com/xx.xxx.142.164, login.microsoftonline.com/xx.xxx.14.162, login.microsoftonline.com/xx.xxx.142.167, login.microsoftonline.com/xx.xxx.14.160, login.microsoftonline.com/xx.xxx.14.164] failed: Connection timed out (Connection timed out); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to login.microsoftonline.com:443 [login.microsoftonline.com/xx.xxx.14.163, login.microsoftonline.com/xx.xxx.142.166, login.microsoftonline.com/xx.xxx.142.165, login.microsoftonline.com/xx.xxx.142.164, login.microsoftonline.com/xx.xxx.14.162, login.microsoftonline.com/xx.xxx.142.167, login.microsoftonline.com/xx.xxx.14.160, login.microsoftonline.com/xx.xxx.14.164] failed: Connection timed out (Connection timed out)

can you please shed some light on this error?

kikovalle commented 2 years ago

Hello The connect timeout exception doesn't seem to be related to the API itself. Looks like the linux machine where you are having the issue doesn't have access to internet to do the login process against login.microsoftonline.com SSO. The code works fine in linux as i use linux as my base operating system. Have you tested that you have access to the domain from the linux machine? It can be a firewall policy that is not allowing the server to open external URLs for security, try making a ping to the domain and if not you may have to speak with the systems department of your company to review the firewall rules and allow connectios to login.microsoftonline.com from the linux server

bradcheon commented 2 years ago

Hi Kilovalle, Thanks for your quick response. As you mentioned, the issue was related to our proxy setup that wasn't ready for the testing. All looks good now. Many thanks again.