Got an error while trying to invoke the webservice
"System.NullReferenceException: Object reference not set to an instance of an object." Error on this line
if (Authentication.Username == "x" &&
Authentication.Password == "y")
what does this mean?
[WebService(Namespace = "https://domain.com")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class Testing : System.Web.Services.WebService
{
public TestAuthHeader Authentication;
public class TestAuthHeader : SoapHeader
{
public string Username;
public string Password;
}
[WebMethod]
[SoapHeader("Authentication")]
public string TestService()
{
if (Authentication.Username == "x" &&
Authentication.Password == "y")
{
return "OK";
}
else
{
return "Access Denided";
}
}
}