title: How to add custom security binding credentials to a web service reference?
body: <p>I'm new to Service Reference stuff so I might need simple explanation.</p>
  
  <p>I got a WSDL:</p>
  
  <p><a href="https://test.servicebench.com/servicebenchv5/services/CRMServiceOrderService?wsdl" rel="nofollow">https://test.servicebench.com/servicebenchv5/services/CRMServiceOrderService?wsdl</a></p>
  
  <p>I added the Service Reference in my project via MVS2013 without any problem.</p>
  
  <p>Here's the autogenerated app.config file : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
  &lt;system.serviceModel&gt;
      &lt;bindings&gt;
          &lt;customBinding&gt;
              &lt;binding name="CRMServiceOrderBinding"&gt;
                  &lt;textMessageEncoding messageVersion="Soap11" /&gt;
                  &lt;httpsTransport /&gt;
              &lt;/binding&gt;
          &lt;/customBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
          &lt;endpoint 
              address="https://test.servicebench.com/servicebenchv5/services/CRMServiceOrderService"
              binding="customBinding"
              bindingConfiguration="CRMServiceOrderBinding"
              contract="ServiceBenchReference.CRMServiceOrderPortType" 
              name="CRMServiceOrderPort" /&gt;
      &lt;/client&gt;
  &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Now, every requests I try to make to the server replies me : "Unauthorized".</p>
  
  <p>I pretty sure it's because I didn't passed the required credentials in the SOAP request header.</p>
  
  <p>I need to pass it 3 credentials (or info?) : ServiceBenchID, UserID and password.</p>
  
  <p>I've tried using :</p>
  
  <pre><code>CRMServiceOrderPortTypeClient ServiceOrder = new CRMServiceOrderPortTypeClient();
  ServiceOrder.ClientCredentials.UserName.UserName = myUserID;
  ServiceOrder.ClientCredentials.UserName.password = myPassword;
  </code></pre>
  
  <p>but it didn't work. I checked the request via Fiddler and I didn't saw the credentials passed in the header.</p>
  
  <p>So here's my question : How can I get these 3 custom credentials information to be passed in the header correctly ? (So I get a response from the server)</p>