Exactly now, I got my webservice authentication, but i've done this calling a method inside WebMethod, like this:
[WebMethod]
[SoapHeader("LoginSoapHeader")]
public int findNumberByCPF(string cpf)
{
try
{
LoginAuthentication();
var retRamal = DadosSmp_Manager.RetornaRamalPorCPF(cpf);
var searchContent= String.Format("CPF[{0}]", cpf);
DadosSmp_Manager.insertCallHistory(retRamal, searchContent);
return retRamal.Ramal;
}
catch (Exception ex)
{
Log.InsertQueueLog(Log.LogType.Error, ex);
throw getException(ex.TargetSite.Name, cpf);
}
}
I want now to authenticate this WebMethod without call the "LoginAuthentication()" method, only using the SOAP Header - SoapHeader("LoginSoapHeader") - that is above inside the code.
Then, my question is how can I authenticate my WebMethod only using headers?
Thanks in advance.