views:

20

answers:

1

Hi All,

I am trying to access the SharePoint List with web service and I need to update the same via web service accordingly. Following is the sample code that I am using

        Lists Testlist = new Lists();

        Testlist.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; 

        Testlist.PreAuthenticate = true;

        XmlNode myNode = Testlist.GetList("sample list");  
        .
        .
        .  

However I am getting Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' when I try to use Testlist.getList() Method of web service.

I have goggled for it a lot but still not getting proper solution for the same.

Can any one help me out to solve this issue... :(

+2  A: 

It looks like you've set up your web service proxy by adding a WCF service reference; I have tried this route before and have not had success. In fact, I bet we even get the same error; mine was a problem authenticating to the service.

Once I regenerated my proxy using the non-WCF method (adding a Web Reference), I was able to get everything working with no problems.

You do this by adding a Service Reference to your project the same way you did before, except on the "Add Service Reference" dialog, click the "Advanced..." button. This opens the "Service Reference Settings" dialog.

Here, click the "Add Web Reference..." button at the bottom, then point to your Lists service and generate your proxy classes.

In code, after you instantiate your Lists service object, use the following for authentication:

TestList.UseDefaultCredentials = true;

Now you should be able to call your methods without exceptions. If you ever stumble across a proper way to authenticate to SharePoint web services using a Visual Studio Service Reference, I'd love to hear about it.

CBono