Échec de l'authentification appelant SharePoint Web Service (Client JAX-WS)
-
30-10-2019 - |
Question
Je dois appeler le service SharePoint 2010 à partir d'un client Java.
J'ai utilisé NetBeans pour générer les classes JAX-WS à partir du WSDL.
Et étendu java.net.authenticator pour gérer l'authentification à SharePoint:
static final String user = "XXXXXXXX\\Administrateur"; // your account name
static final String pass = "mypassw"; // your password for the account
static class MyAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
System.out.println("Feeding username and password for " + getRequestingScheme());
return (new PasswordAuthentication(user, pass.toCharArray()));
}
}
Appeler le service Web avec JAX-WS:
Authenticator.setDefault(new MyAuthenticator());
com.nm.Lists service = new com.nm.Lists();
com.nm.ListsSoap port = service.getListsSoap12();
String pageUrl = "http://xxxxxxx/testPushFile.txt";
String comment = "no comment";
String checkinType = "1";
boolean result = port.checkInFile(pageUrl, comment, checkinType);
J'obtiens toujours l'erreur:
Exception in thread "main" javax.xml.ws.WebServiceException: java.io.IOException: Authentication failure
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.readResponseCodeAndMessage(HttpClientTransport.java:201)
Parce que ça ne marche pas, j'ai essayé:
Pour définir l'utilisateur sans le domaine
Pour définir le domaine en tant que propriété système:
System.setProperty("http.auth.ntlm.domain", "XXXXXXXX");
Pour authentifier la "voie à l'ancienne":
((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, user);
((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, pass);
Des idées quel est le problème de l'authentification?
Merci
Pas de solution correcte
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow