Here I am trying to read a sharepoint list. To do this, I did the following: I downloaded the WSDL file that I received from the URL, for example: sharepointsite.com/_vti_bin/Lists.asmx?WSDL. and I ran the following command to create the classes in the directory "C: \ Program Files \ Java \ jdk1.6.0_12 \ bin \ wsimport.exe" -p com.microsoft.schemas.sharepoint.soap -keep -extension Lists.wsdl. Imported these classes into my eclipse IDE Java application.
and I wrote the following code
/ * Creates a port connected to the SharePoint web service.
* Authentication is done here. It also prints the authentication details * in the console. * @param userName SharePoint username * @param password SharePoint password * @return port ListsSoap port, connected with SharePoint * @throws Exception in case of invalid parameters or connection error. */ public static ListsSoap sharePointListsAuth(String userName, String password) throws Exception { ListsSoap port = null; if (userName != null && password != null) { try { Lists service = new Lists(); port = service.getListsSoap(); System.out.println("Web Service Auth Username: " + 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; } public static String xmlToString(Document docToString) { String returnString = "\n-------------- XML START --------------\n"; try {
I get the following exception:
Web Service Username: "domain \ username" java.lang.Exception: Exception. See Stacktrace.javax.xml.ws.soap.SOAPFaultException: An exception of type "Microsoft.SharePoint.SoapServer.SoapServerException" was thrown.
It would be helpfull if i get the specific exception from the server.With this expection i am unable to track my pgm. I dont know where did i go wrong? am i missing anything ? any configuration is required ? Thanks in advance for your help
source share