Hello, sorry for my translation, I hope you understand, at the moment I am making the consumption of a webservice from an application developed in c #. The consumption from the SoapUI program is achieved successfully, activating a preference that is called, preventive authentication, its user and password are configured in the tab called "Auth".
However, when I try to send a header with the user and the password returns the error "(500) Internal error of the server", the webservice associates it with the project as a web reference, as recommended by one of the pages in which I found a solution .
What I have tried:
*So far, I associated the WS to the project as a service reference and as a web reference.
*I added the following lines of code to send in the header the credentials and thus recreate the preventive authentication.
string auth = "Basic " + Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(wsParams[0] + ":" + wsParams[1]));
req.PreAuthenticate = true;
req.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequested;
req.Headers.Add("Authorization", auth);
WebResponse resp = req.GetResponse();
*After obtaining the answer (500), I tried to recreate by SoapUI the user and password in the header, without success. Which brings me to the second code test.
*Try to send the authentication using the credentials property from the previous code, but in the same way I get the answer (500)
NetworkCredential networkCredential = new NetworkCredential(wsParams[0], wsParams[1]);
req.Credentials = networkCredential;
req.PreAuthenticate = true;
WebResponse myWebResponse = req.GetResponse();
From here on I have tried almost everything but still can not get the consumption of the ws by code, I would greatly appreciate an idea of how I can make the consumption.
Be attentive