Answered by:
Loading Large Lists using UpdateListItems in SharePoint 2007 Web Services Error, Best Practices

Question
-
I'm having some trouble finding the source of an error when using the UpdateListItems method for loading a large list, i.e. 2000 items. I get about half way through the list 1195 to be exact then I thow a cryptic ProtocolException. Of couse the exception i get back does not seem to indicate the source of the problem. (See below Error Message Dump). The batch appears to be constructed properly. I have increased both the buffer sizes and the timeout values in the app.config file. But I still get the error. Again half of the records load just fine, then I throw the error.
Can anyone give me a clue why I would be throwing a ProtocolException halfway through a batch? Thanks in Advance!
2011-08-01 16:14:28.2527|ERROR|SharePointConnector.Service|SharePointConnector.Service.LoadList|ERROR: Protocol Exception: LoadList|System.ServiceModel.ProtocolException: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<HTML dir="ltr">
<HEAD><meta name="GENERATOR" content="Microsoft SharePoint" /><meta name="progid" content="SharePoint.WebPartPage.Document" /><meta HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" /><meta HTTP-EQUIV="Expires" content="0" /><meta name="ROBOTS" content="NOHTMLINDEX" /><title>
Error</title><link rel="stylesheet" type="text/css" href="/_layouts/1033/styles/core.css?rev=5msmprmeONfN6lJ3wtbAlA%3D%3D"/>
<script type="text/javascript" language="javascript" src="/_layouts/1033/init.js?rev=yOq8IoAABYCtaZjMVrjxtg%3D%3D"></script>
<script type="text/javascript" language="javascript" src="/_layouts/1033/core.js?rev=9Q0o4HXY70XA8x98qPTZwg%3D%3D"></script><meta name="Robots" content="NOINDEX " />
<meta name="SharePointError" content=""/>
</HEAD>
<BODY scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();">
<form name="aspnetForm" method="post" action="error.aspx?ErrorText=Request+timed+out." id="aspnetForm" onsubmit="return'.Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at SharePointConnector.PIAssessmentService.Lists.ListsSoap.UpdateListItems(UpdateListItemsRequest request)
at SharePointConnector.PIAssessmentService.Lists.ListsSoapClient.SharePointConnector.PIAssessmentService.Lists.ListsSoap.UpdateListItems(UpdateListItemsRequest request) in C:\Documents and Settings\bdco1\My Documents\Visual Studio 2010\Projects\PIAssessmentTools\SharePointConnector\Service References\PIAssessmentService.Lists\Reference.cs:line 2446
at SharePointConnector.PIAssessmentService.Lists.ListsSoapClient.UpdateListItems(String listName, XmlElement updates) in C:\Documents and Settings\bdco1\My Documents\Visual Studio 2010\Projects\PIAssessmentTools\SharePointConnector\Service References\PIAssessmentService.Lists\Reference.cs:line 2454
at SharePointConnector.Service.LoadList(IList`1 surveys, String listName, String viewName, Boolean logResults) in C:\Documents and Settings\bdco1\My Documents\Visual Studio 2010\Projects\PIAssessmentTools\SharePointConnector\Service.cs:line 517
BCMonday, August 1, 2011 8:39 PM
Answers
-
Hi ,
Since I haven’t got the source code ,I just can get limited information from the error message. If I have any misunderstanding , please feel free to say:
1. The content type you are using in the updatelistitem method is binding to text/xml .
2. You defined this method UpdateListItems(String listName, XmlElement updates) in your References.cs file .
Does the two error throw when loading the same record ? If the content type of the specific record is to test/html so that the protocol exception is thrown .Try to delete or remove the record and have a test again .
Check the lines lists in the end of your post and give more detailed information about the lines .
Thanks,
Entan Ming- Marked as answer by Emir Liu Friday, August 12, 2011 10:17 AM
Wednesday, August 3, 2011 2:41 AMModerator