Я использую JAX-WS для доступа к списку sharepoint из клиента java.Я не могу взломать часть аутентификации ntlm.Это дает мне 403 запрещенную ошибку. Но я могу аутентифицироваться, когда включена базовая аутентификация.Мой код, как показано ниже.Кто-нибудь работал над этим?Заранее спасибо.
public static void main(String[] args) {
try {
String userName = "INDIA\\arindam";
String password = "September@123";
String end = "http://www.sharepoint.com/_vti_bin/lists.asmx";
com.microsoft.schemas.sharepoint.soap.ListsSoap port = null;
com.microsoft.schemas.sharepoint.soap.Lists service = new Lists();
port = service.getListsSoap();
NtlmAuthenticator authenticator = new NtlmAuthenticator(userName, password);
Authenticator.setDefault(authenticator);
String listName = "Shared Documents";
String rowLimit = "150";
String viewName = "";
com.microsoft.schemas.sharepoint.soap.GetListItems.ViewFields viewFields = null;
com.microsoft.schemas.sharepoint.soap.GetListItems.Query query = null;
com.microsoft.schemas.sharepoint.soap.GetListItems.QueryOptions queryOptions = null;
String webID = "";
com.microsoft.schemas.sharepoint.soap.GetListItemsResponse.GetListItemsResult result = port.getListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, webID);
System.out.println(result.toString());
} catch (Exception ex) {
System.err.println(ex);
}
}
*
public class NtlmAuthenticator extends Authenticator {
private final String username;
private final char[] password;
com.microsoft.schemas.sharepoint.soap.ListsSoap port = null;
com.microsoft.schemas.sharepoint.soap.Lists service = new Lists();
public NtlmAuthenticator(final String username, final String password) {
super();
this.username = new String(username);
this.password = password.toCharArray();
}
@Override
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(username, password));
}
}