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=2.0.0.0, 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)
My app.config:
| <bindings> |
| <basicHttpBinding> |
| <binding name="ListsSoap" closeTimeout="00:01:00" openTimeout="00:01:00" |
| receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" |
| bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" |
| maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" |
| messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" |
| useDefaultWebProxy="true"> |
| <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" |
| maxBytesPerRead="4096" maxNameTableCharCount="16384" /> |
| <security mode="Transport"> |
| <transport clientCredentialType="Ntlm" proxyCredentialType="None" |
| realm="" /> |
| <message clientCredentialType="UserName" algorithmSuite="Default" /> |
| </security> |
| </binding> |
| </basicHttpBinding> |
| </bindings> |
| <client> |
| <endpoint address="https://server/RD/_vti_bin/Lists.asmx" behaviorConfiguration="EndpointBehavior" |
| binding="basicHttpBinding" bindingConfiguration="ListsSoap" |
| contract="ListsService.ListsSoap" name="ListsSoap" /> |
| </client> |
My Code:
| sharepointgetlistproject.ListsService.ListsSoapClient client = new sharepointgetlistproject.ListsService.ListsSoapClient("ListsSoap"); |
| client.ClientCredentials.UserName.UserName = "DOMAIN\username"; |
| client.ClientCredentials.UserName.Password = password; |
I also tried to use
clientCredentialType="Windows" but then i got an "Unauthorized" error.
What can be the problem here?
Thanx in advance!