Hello there,
I have the below code
public static ListsSoap sharePointListsAuth(String userName, String password) throws Exception {
ListsSoap port = null;
if (userName != null && password != null) {
try {
Lists service = new ListsLocator();
port = service.getListsSoap();
BindingProvider bp = (BindingProvider) port;
Map<String, Object> rc = bp.getRequestContext();
System.out.println("Web Service Auth Username: " + userName);
rc.put(BindingProvider.USERNAME_PROPERTY, userName);
// ((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, userName);
// ((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
} catch (Exception e) {
throw new Exception("Error: " + e.toString());
}
} else {
throw new Exception("Couldn't authenticate: Invalid connection details given.");
}
return port;
}
I get an error saying "java.lang.ClassCastException: com.microsoft.schemas.sharepoint.soap.ListsSoapStub cannot be cast to javax.xml.ws.BindingProvider"
I have been following the "reading-a-sharepoint-list-with-java-tutorial" (which can be found via google"
Can anyone please help in this issue, its been driving me crazy as to why I cannot do this!