I have to consume a web service in a secure server, in https, with certificate and login.
So i make a Service reference in VS2008.
static void Main(string[] args)
{
Console.WriteLine("Value of code TR3A ?\n");
String codeTR = Console.ReadLine();
string responseFromServer ="";
System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
serviceTrains.TrainServiceClient myTrainService = new serviceTrains.TrainServiceClient();
responseFromServer = myTrainService.GetListTrainsAtGare(codeTR).ToString();
console.WriteLine(responseFromServer);
}
In my console app, I want to write the json wich I retrieve, but i have an error :
InvalidOperationException : The Address property on ChannelFactory.Endpoint was null. The ChannelFactory's Endpoint must have a valid Address specified.
but if i go to https://blabla.com/TrainService.svc/GetListTrainsAtGare/COE it works ...
another problem : i can't make myTrainService.Credentials
, why ??