I’ve consumed web services before (add reference > advanced > web reference). However, this one is proving difficult as I need to authenticate first.
I have the address to my wsdl file that someone in our IS department made available. I need to authenticate with my network username/pass to use it, according to his instructions.
So, using small words ;), can anyone help me understand how I might add this webservice to make calls?
I am using VS 10 MVC3 (razor). The wsdl is accessed over http – https is not available.
I appreciate all help!
Update
Based on @john-saunders post I took a local copy of the WSDL and referenced it (not as a web reference). I now see the added to my web.config and it would seem to take username/password… but again, I’m new here. I really appreciate any help in pushing me over this (I hope) final hump!
Update #2
I’ve put in the following code. But intellisense doesn’t show methods, I know there is search capability where I can pass one value (emplID) and get back other values (name, birth date). How do I call these/test my authentication?
using (var hrData = new CHMC_HRTECH_RES())
{
//CHMC_HRTECH_RES hrData = new CHMC_HRTECH_RES();
CredentialCache cache = new CredentialCache();
cache.Add(new Uri(hrData.Url),
"Negotiate",
new NetworkCredential("myuser", "mypass"));
hrData.Credentials = cache;
}
If you can’t access the WSDL by URL, then ask the owners of the service to email you the WSDL and any other files it includes. Save those to disk and pass the file path to “Add Service Reference”.