Access Sharepoint Webservices From Java Behind Proxy
by Ashwani Kumar
-
-
posted in
Technical
|
Tagged as
java,sharepoint
| Comments
In my previous post I told you how to access sharepoint webservices from java
But what if you would like to access the sharepoint from behind a proxy, let's say from your place of work.
The approach for Authenticator mentioned here
works if you only need to provide username/password for your sharepoint site and not for the proxy.
Or the other way around, when you need to provide username/password for proxy but your sharepoint site does not require any authentication, which is hardly true I guess.
You can achieve this by setting up a default Authenticator as mentioned here
But What should you do when you require the the authentication for both proxy and the sharepoint site.
You cannot setup a single default Authenticator.
You would get "ERROR 407 proxy authentication required", or your sharepoinnt site will deny access, based on what you setup in default autneticator.
So what must you do? Well you can use the following code, it works in my case, hope it will work for you also.
The following approach works:
1. If you are accessing webservices from behind the proxy. Hence you need to specify proxyhost, proxyport, proxyuser, proxypass.
2. If you need a username/password for sharepoint site as well. Hence you need to specify sharepointusername, sharepointpassword for authentication.