Hi,
I am trying to update the SharePoint list items via UpdateListItems web service. Initialy, I have tried to invoke the GetListCollection method via the following code:
servername.
Lists listservice = new servername.Lists();
listservice.Credentials = System.Net.
CredentialCache.DefaultNetworkCredentials;
System.Xml.
XmlNode node = listservice.GetListCollection();foreach (System.Xml.XmlNode xmlnode in node)
{
Response.Write(xmlnode.Attributes["Title"].Value + "\n");
}
FYI -
OS : Windows Server 2003, Enterprise Edition, SP2
I am getting the following error:
Server Error in '/ExploringSharePoint' Application.
The request failed with HTTP status 401: Unauthorized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
Source Error:
Line 456: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetListCollection", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 457: public System.Xml.XmlNode GetListCollection() {
Line 458: object[] results = this.Invoke("GetListCollection", new object[0]);
Line 459: return ((System.Xml.XmlNode)(results[0]));
Line 460: }
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\exploringsharepoint\03ff9d59\845f2ab2\App_WebReferences.gqzkarht.0.cs Line: 458
Stack Trace:
[WebException: The request failed with HTTP status 401: Unauthorized.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +260
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +292
chnmctlbiaps02.Lists.GetListCollection() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\exploringsharepoint\03ff9d59\845f2ab2\App_WebReferences.gqzkarht.0.cs:458
Default2.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\Madhu\My Documents\Visual Studio 2005\WebSites\ExploringSharePoint\Default2.aspx.cs:68
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3036
Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
* I got to know that its because of some OS shortcoming via the following article:
Knowledge Base
You may receive an "HTTP 401 Unauthorized" error message when you use SOAP over HTTP and Visual C# .NET XML Web services on a computer that is running Windows XP or Windows Server 2003Article ID: 885274
Article Last Modified on 10/7/2005
--------------------------------------------------------------------------------
APPLIES TO
Microsoft .NET Framework 1.1 Service Pack 1 (SP1)
--------------------------------------------------------------------------------
SYMPTOMS
When you use SOAP over HTTP and Visual C# .NET XML Web services on a computer that is running Microsoft Windows XP or Microsoft Windows Server 2003, you may intermittently receive an error message that is similar to the following:
System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
This problem occurs when a Web service uses Integrated Windows authentication, and the client passes the appropriate credentials correctly.
Additionally, this problem may occur more frequently when multiple threads on the client try to connect to the network at the same time.
CAUSE
This issue occurs if a request time-out or an abort is not correctly handled.
RESOLUTION
Software update information
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft .NET 1.1 Framework service pack that contains this hotfix.
Can anybody let me know what I need to do now to get the web service working?
Thanks and Regards
Madhu