you need to add a webreference with the url + _vit_bin/Lists.asmx
so as an example:
I have a website with a webapplication called:
to call its webservice I would go into the webapplication project (.net project), add a web reference with the url:
(tip: goto the website in a browser, and put in the url with the extention of /_vit_bin/Lists.asmx , it should redirect you to the webservice with a list of methods to use ;) , once your happy that it works...copy the url and use that!)
now it should resolve and you should have access to the lists.asmx webservice method! change lists.asmx to your custome one! You should be able to name it as you please to access the webservice, if you left it to the default name dont worry, just look in solution explorer and under webreference look at the name and use that! For simplicity i left it to the default name of webservice.
within the .net project you cant just directly call the webservice, you need some handshaking and by that i mean supply some credetials to access that webservice like so:
webservice.Lists listService = new webservice.Lists();
webservice.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
webservice.Url = "http://hello.mysite.com/_vit_bin/Lists.asmx";
var listNodes = webservice.GetList("Home");
_isUserAuthenticated = true;
catch (Exception ex)
//User does not seem to have access to the list.
_isUserAuthenticated = false;
if your confused about the above, its simply getting the webservice object putting a . you then have access to the methods within. so I am using the list.asmx so i used webservice.list object to create a new instance to query against.
I then supply the credentials, you can explicitly put in the credentials or use as im using above! above is using the logged in user of the client pc! If the logged in user doesnt have access then an access denied exception will be thrown!
The last part is just getting the list on the sharepoint site called home ;)
its simple, here are some resources if you get stuck!
The DefaultCredentials property applies only to NTLM, negotiate, and
DefaultCredentials represents the system credentials for the current
security context in which the application is running. For a
client-side application, these are usually the Windows credentials
(user name, password, and domain) of the user running the application.
For ASP.NET applications, the default credentials are the user
credentials of the logged-in user, or the user being impersonated.
To get the credentials as a NetworkCredential instance, use the
The supported values for authType are "NTLM", "Digest", "Kerberos",
and "Negotiate". This method does not work for HTTP or FTP protocols.
The credentials returned by the DefaultNetworkCredentials property is
applicable only for NTLM, negotiate, and Kerberos-based
The credentials returned by DefaultNetworkCredentials represents the
authentication credentials for the current security context in which
the application is running. For a client-side application, these are
usually the Windows credentials (user name, password, and domain) of
the user running the application. For ASP.NET applications, the
default network credentials are the user credentials of the logged-in
user, or the user being impersonated.
HOW TO: Pass Current Credentials to an ASP.NET Web Service
as noted by microsoft in the links that if its elevated than it will pass those credentials ;) thats if you dont want to use the client credentials ;) rather an elevated account that has access! If anyone has access and you dont want them to have access than i wouldnt elevate the privlages!
more examples on credentials: