Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

Testing Webservice with Custom SOAP Header in Postman Client

$
0
0

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!


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>