Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>(This suggestion might be way off, since I'm not sure if you mean some special WS.* headers, or just any custom header... and I've never heard of WSE)</p> <p>I call a webservice with user/pass in a header as follows. It's not production code, but the snippets should illustrate it.</p> <p><strong>On the client:</strong></p> <pre><code>string userName = "someusername"; string password = "somepass"; //create the custom header object MyService.AuthHeader authHeader = new MyService.AuthHeader(); authHeader.UserName = userName; authHeader.Password = password; //create the WS-proxy MyService.SomeWebservice someWS = new MyService.SomeWebservice(); //set headers someWS.AuthHeaderValue = authHeader; someWS.SomeMethod(); </code></pre> <p><strong>The webservice:</strong></p> <pre><code>public class SomeWebservice : System.Web.Services.WebService { public AuthHeader Authentication = null; //For receiving the authentication header from the SOAP client (you will never assign this property in user code, .NET handles the plumbing based on the [SoapHeader("Authentication")] attribute [WebMethod(Description = "Some webservice method")] [SoapHeader("Authentication")] public void SomeMethod() { string suppliedUserName = Authentication.UserName; string suppliedPassword = Authentication.Password; } } </code></pre> <p><strong>The AuthHeader class:</strong> (defined at the "WS end")</p> <pre><code>public class AuthHeader : SoapHeader { public string UserName = null; public string Password = null; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload