Last post Jul 11, 2018 05:15 AM by Yohann Lu
Jul 10, 2018 04:47 AM|shashikant2011|LINK
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
[SoapDocumentMethod(Binding = "TestService")]
public string GetBalance()
return consumer.userName + " had 10000000 credit";
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")
Please help ASAP!
Jul 10, 2018 05:04 AM|vahid bakkhi|LINK
Clicking on the Headers tab shows the headers key-value editor. You can set any string as the header name. The autocomplete dropdown provides suggestions of common HTTP headers, as you type in the fields. Values for the “Content-Type” header
are also available in an auto-complete drop down.
Note on restricted headers: If you’re using the Postman Chrome app, some headers are restricted by Chrome and the XMLHttpRequest specification. However, sending restricted headers is simple using the
please refer to below link
Jul 10, 2018 05:16 AM|shashikant2011|LINK
Thanks for your quick response.
I am still bit confused as while consuming in application I write following code , but how to pass user.userName = "Ahmed"; user.password = "1234"; in header tab. my webservice is decorated with [SoapHeader("consumer", Required = true)].
SOAPHeaderService.SOAPHeaderService service = new SOAPHeaderService.SOAPHeaderService();
SOAPHeaderService.UserCredentials user = new SOAPHeaderService.UserCredentials();
user.userName = "Ahmed";
user.password = "1234";
service.UserCredentialsValue = user;
Jul 10, 2018 05:35 AM|vahid bakkhi|LINK
go to header tab and under key column write your header name like :
and under value column write your value like :
also, you continue to add your header and after the finish, it sends your request
Jul 10, 2018 05:56 AM|shashikant2011|LINK
Not working, I am getting following response:
I have passed values in header as:
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">Error in authentication</string>
Jul 10, 2018 08:35 AM|vahid bakkhi|LINK
it seem the postman can't do it
Jul 11, 2018 05:15 AM|Yohann Lu|LINK
You can refer the following points to make SOAP requests using Postman.
1: Give the SOAP endpoint as the URL. If you are using a WSDL, then give the path to the WSDL as the URL.
2: Set the request method to POST.
3: Open the raw editor, and set the body type as “text/xml”.
4: In the request body, define the SOAP Envelope, Header and Body tags as required. Start by giving the SOAP Envelope tag, which is necessary, and define all the namespaces. Give the SOAP header and the body. The name of the SOAP method (operation) should
be specified in the SOAP body
You can refer the following example of making SOAP requests using Postman.
Making SOAP requests using Postman
Besides, If you have any question about postman, you can go to the postman forum
for getting suitable help.