SharePoint custom web service consumption problems - HTTP 401: Unauthorized
- by alekz
I have a custom web service deployed into WSS 3. It has two web methods.
The first one returns the version of the loaded assembly without any invocation of the SharePoint objects.
The second returns some basic info about the library, something like:
var spLibrary = [find library logic];
return spLibrary.Name+"@"+spLibrary.Url;
In the client app I have something like the following:
var service = new WebService1();
service.Url = [url];
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Method1();
service.Method2();
When the client app runs on the machine where SharePoint is deployed, everything works just fine.
When the client app runs on the remote machine (but under the same user) the first method still works, but the second one throws System.Net.WebException: HTTP 401: Unauthorized.
I have tried to set credentials manualy (service.Credentials = new System.Net.NetworkCredential(login, password, domain);) but this doesnt help.
I've tried to invoke the built in SharePoint web services using a similar scenario, and they work just fine:
Sorry for the mistake... Some methods were not working fine without the appropriate privileges.
var service = new GroupsService();
service.Url = [url];
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.SomeMethod();