Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to consume soap header on C#
    text
    copied!<p>I'm transferring soap message to my web service using C# .Net2</p> <p>the soap message is:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Header&gt; &lt;AUTHHEADER xmlns="http://mysite.com/WebServices/Agent"&gt; &lt;AgentGUID&gt;24563532-c973-fbf3-d072-d9cf671d5905&lt;/AgentGUID&gt; &lt;/AUTHHEADER&gt; &lt;/soap:Header&gt; &lt;soap:Body&gt; &lt;LoginRSA xmlns="http://mysite.com/WebServices/Agent"&gt; &lt;loginId&gt;admin@dt.com&lt;/loginId&gt; &lt;password&gt;password&lt;/password&gt; &lt;tenant&gt;&lt;/tenant&gt; &lt;/LoginRSA&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>in my C# section I defined the following:</p> <pre><code>public class AuthHeader : SoapHeader { public string AgentGUID; } [WebService(Namespace = "http://mysite.com/WebServices/Agent", Description = "Some description")] public class AgentService : WebService { public AuthHeader Authentication; [SoapHeader("Authentication")] [WebMethod(Description = "SomeDesc.", MessageName = "LoginRSA")] public LoginResult LoginRSA(string loginId, string password, string tenant) { if (Authentication != null) { string guid = Authentication.AgentGUID; } } } </code></pre> <p>but my Authentication always null, I can't read the header but I getting all variables that are inside the soap:body.</p> <p>Can you see my mistake? thanks.</p>
 

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