This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Services and the fly likes javax.xml.ws.WebServiceException: Failed to access the WSDL file and Server redirected too many time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "javax.xml.ws.WebServiceException: Failed to access the WSDL file and Server redirected too many time" Watch "javax.xml.ws.WebServiceException: Failed to access the WSDL file and Server redirected too many time" New topic
Author

javax.xml.ws.WebServiceException: Failed to access the WSDL file and Server redirected too many time

Chintan B Shah
Ranch Hand

Joined: Sep 23, 2008
Posts: 83
Hi all,

I am trying to access Sharepoint web-service and I am also specifying HTTP Authentication using below code



Above code is called right before


I get the below error message when I deploy it on one our servers.

java.lang.Exception: Error: javax.xml.ws.WebServiceException:
Failed to access the WSDL at: http://sharepoint.<companyname>.com/na/network/_vti_bin/lists.asmx?WSDL. It failed with:
Server redirected too many times (20).


Any help is appreciated.

Regards,
Chintan.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
Since that is a server side problem you should be talking to the owner of the web service.

Perhaps the service has been moved and you need a better address.

Bill
Chintan B Shah
Ranch Hand

Joined: Sep 23, 2008
Posts: 83
Hi Bill,

Perhaps I should have been more clear.

The service exists and the web-service client works fine from my local machine(uses my local credentials for NTLM authentication), however when I run it from Linux box it fails which tells me that there is something wrong that I might need to fix in my authentication code.

If I remove the authentication code completely, then I get the old-school 401 unauthorized error, however when I uncomment that code, 401 ERROR goes away and I get "Server redirected too many times" error. I am having hard-time figuring out this error.

My sharepoint web-service owner says it has certainly to do with authorization...but I am not quite sure about it.

Thanks
Chintan.
Chintan B Shah
Ranch Hand

Joined: Sep 23, 2008
Posts: 83
All,

It seemed to be NTLM authentication issue rather than web-service one.

So, all is good now.

Just to share it with everyone for NTLM authentication, you can use Authenticator.setDefault method and user name needs to be passed in following format:

"domainName\\userName" - where DomainName stands for the name where you want the user authentication to happen(I confused this with domain name of resource URL which I was trying to access).

e.g. If I am a user on "aaa.corp.aa.com" and needs to access intranet URL "http://yyy.com", then domainName to be used in code should be "aaa.corp.aa.com\\userName" and not "yyy.com\\userName".

This link provides more info
http://download.oracle.com/javase/6/docs/technotes/guides/net/http-auth.html.

In my case I did not have to do " -Dhttp.auth.preference="scheme" ", since there were 3 authentication schemes setup on Sharepoint Server...and if 1 failed it checked with second one and so on..

HTH.

Thanks
Chintan.
Chintan B Shah
Ranch Hand

Joined: Sep 23, 2008
Posts: 83
Here's a good example.

http://www.muneebahmad.com/index.php/archives/127

Thanks
Chintan.
 
GeeCON Prague 2014
 
subject: javax.xml.ws.WebServiceException: Failed to access the WSDL file and Server redirected too many time