Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am executing WSDL with body content only but I need to add the header
during execution for authentication and other added elements. Below is the header. for your guidance

For some reason I cannot define my XML code, the page doesn't accept.


What I have tried:

I add a service reference using the WSDL path.
set the parameters.
the only missing is the header part in order to authenticate and recognize the WSDL using the Update Request action
Posted
Updated 3-Oct-16 4:07am
v2

1 solution

Since you didn't post anything about how you are calling this web service or your code. Here is one way you can add headers to a request.

C#
System.Net.WebRequest request = base.GetWebRequest(uri);
 request.Headers.Add("myheader", "myheader_value");


For authentication, say basic auth. It looks something like this:

C#
string username = "Your username";
string password = "Your password";

string base64UserPass = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(username + ":" + password));

request.Headers.Add("Authorization", "Basic " + base64UserPass);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900