I get an error while consuming the lists.asmx webservice.
The methods GetListCollection and GetList("ListName") are returning results without any problem. When i call client.GetListItems(documentLibraryName, "All Items", null, null, null, null, null); it gives the following error:
Server was unable to process request. ---> The type initializer for 'Microsoft.SharePoint.SoapServer.SoapServerException' threw an exception. ---> Could not load file or assembly 'System.Web.Services, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)
I also tried to use clientCredentialType="Windows" but then i got an "Unauthorized" error.
What can be the problem here?
Thanx in advance!
I've also been trying to get this working for a couple of hours. I finally cracked it.You need to allow your client endpoint to impersonate.Try adding the following to your <system.servicemodel>
<behaviors> <endpointBehaviors> <behavior name="ImpersonationBehavior"> <clientCredentials> <windows allowedImpersonationLevel="Impersonation"/> </clientCredentials> </behavior> </endpointBehaviors> </behaviors>
Now within the endpoint tag, set the following property: bindingConfiguration="ImpersonationBehavior"