Domanda

Devo chiamare SharePoint 2010 elenca il servizio da un cliente Java.

Ho usato NetBeans per generare le classi Jax-WS dal WSDL.

E esteso Java.net.Authenticator per gestire l'autenticazione su 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()));
        }
    }

Chiamare il servizio Web con 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);

Sto ancora ricevendo l'errore:

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)

Perché non funziona ho provato:

  • Per impostare l'utente senza il dominio

  • Per impostare il dominio come proprietà del sistema: System.setProperty("http.auth.ntlm.domain", "XXXXXXXX");

  • Per autenticare "Way vecchio stile":

      
    ((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, user);
    ((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, pass);

Qualche idea Qual è il problema con l'autenticazione?

Grazie

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top