This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Ok. I have no idea how to fix this. I've tried a million things. I want to just do the most BASIC of web services. I've compiled my wsdl using;
wsimport -p com.microsoft.schemas.sharepoint.soap -keep -extension lists.asmx.xml.wsdl
We had AD authentication but I've asked the Sharepoint guy to turn on basic auth instead and still nothing is working.
I have, what I think, is very simple code;
Lists service = new Lists();
listsSoap = service.getListsSoap();
((BindingProvider) listsSoap).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, userName);
((BindingProvider) listsSoap).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
((BindingProvider) listsSoap).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://hostname/_vti_bin/lists.asmx?WSDL");
GetListCollectionResult result = listsSoap.getListCollection();
I have to have the ability to change WHERE (endpoint) the sharepoint server is because it will change in production. That is the hostname address above. I have it as a parameter.
I've tried all kinds of variations. I've created an NTLMAuthenticator class when it was AD but that created a fatal java core dump! (I'm using jdk 1.7 5b3)
Is it because the WSDL itself is not authenticated? No idea. I've seen people say make it anonymous but I don't control what is on the production server.
Well, at the beginning I think I see you sending something to do with HTTP basic authentication. And then I think I see the server sending you a 401, saying that didn't authenticate. And then I think I see the server sending back a request to do NTLM authentication. And then I think I see you trying to do that but failing.
Does that match what you think you're seeing?
If so then it looks like you have two possibilities: (1) fix the basic authentication so it works (2) fix the NTLM authentication so it works. Sorry if that sounds facile or if it duplicates one of the millions of things you already tried, but perhaps it helps you to focus a bit.
Joined: Dec 01, 2011
Thanks for the reply Paul. I have a questions. The server should be set to Basic auth. So why is it doing NTLM? Is that the problem?
Joined: Dec 01, 2011
I think I may have found the problem. Our IIS was mis-configured. There are about 10 security settings that can each be set in about 10,000 different places in IIS. It looks like what was happening was Basic auth AND NTLM were BOTH turned on. What happens is, if you send credentials to NTLM, it says you DON'T need credentials. The NTLM mechanism is different than my method above. I think it is ticket based so it expects that in the header. Anyway, I turned off NTLM and just used basic auth. That 'appears' to be working. It looks like it's just retrieving the WSDL.
Now I'm getting this though;
This is what we have to deal with. Literally we can set this up on a multitude of Sharepoint servers. Our app is configurable so we can set whatever we want easily but it has to handle sharepoint 2007 or 2010, any auth it supports, and the credentials of the user come through our Tomcat server somehow from the user. This is either username/password or, maybe, automagically through the header?! I have no idea. Nothing is working and I don't see any real world examples that address what seems to be the main real world scenario.
I compile the WSDL on the file system, not the server. It is part of an eclipse project and I use a wsimport script to generate the code. The Sharepoint server can exist 'wherever' so the host, port, etc are variables. If I pass the URL in for the WSDL (endpoint?) then I get the 401 above BEFORE I can even send credentials for basic auth! Keep in mind I may need other auth methods. If JDK 1.6 is needed for NTLM2 support then we can dump Tomcat 5.5 as one of the requirements if need be.