Error When Updating Item Using Web Service MoveNext

Using the SharePoint REST service to update items, ran into this error:

Unable to update the sharepoint document – An error occurred while processing this request.System.Data.Services.Client.DataServiceClientException: <?

xml version=”1.0″ …

…..

at System.Data.Services.Client.DataServiceContext.SaveResult.<HandleBatchResponse>d_1e.MoveNext()

The target list was set to require checkout before items could be updated.  Once I set require checkout to No, the REST service was able to update items.

 

Accessing search.asmx from a site collection

My goal was to setup a desktop app to query the SharePoint Search Web Service located at: http://webApp/managedPath/siteCollection/_vti_bin/search.asmx

Guide for creating the app:
http://msdn.microsoft.com/en-us/library/ff394650.ASPX

In my app, I needed to query a site collection, not the root site. Also needed to pass in my test-account username, password, and domain.

Error 1:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Attempted to perform an unauthorized operation.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
.....

Error 2:

System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

Error1 was the primary issue.
Error2 was related to an incorrect login.

When creating my app, I used a web reference pointing to http://webApp/managedPath/siteCollection/_vti_bin/search.asmx . After receiving Error1 countless times, I opened the App.config file. In there I found the answer…

For some great reason, Visual Studio updated the reference to point to the root web app, not the site collection.

http://webApp/_vti_bin/search.asmx

Updated the App.config file to point to the site collection, no more Error1.

http://webApp/managedPath/siteCollection/_vti_bin/search.asmx

Connection I used:

//queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
queryService.Credentials = new NetworkCredential("testAccountName", "thePassword", "domain");