Hi,
I am learning authentication in web service so following an article in code project, but stuck at testing in Postman. I don't know how to pass custom SOAP header (username and password) in postman client.
Here is the link of article I am reading:
https: //ww w.codeproject.com/Articles/27365/Authenticate-NET-Web-Service-with-Custom-SOAP-Head
[WebMethod]
[SoapDocumentMethod(Binding = "TestService")]
[SoapHeader("consumer",Required=true)]
public string GetBalance()
{
if (checkConsumer())
return consumer.userName + " had 10000000 credit";
else
return "Error in authentication";
}
private bool checkConsumer()
{
// In this method you can check the username and password
// with your database or something
// You could also encrypt the password for more security
if (consumer != null)
{
if (consumer.userName == "Ahmed" && consumer.password == "1234")
return true;
else
return false;
}
else
return false;
}Please help ASAP!