title: Getting Error Access denied while consuming WSDL endpoint
body: <p>I need to access <strong>web service which required HTTP basic authentication</strong> and I consumed successfully using SoapUI.
  <a href="https://i.stack.imgur.com/VHxyj.png" rel="nofollow noreferrer">SoapUI</a></p>
  
  <p>Now I need to implement in .net.</p>
  
  <p>I created a new C# Console project in Visual Studio and added a web reference for <a href="https://itestapi.tracelink.com/soap/snx/snrequest?wsdl" rel="nofollow noreferrer">https://itestapi.tracelink.com/soap/snx/snrequest?wsdl</a></p>
  
  <p>Below is my code and I am getting <strong>Access Denied</strong> </p>
  
  <p>C# code</p>
  
  <pre><code> ServiceReference1.snrequestClient snx = new ServiceReference1.snrequestClient();
              snx.ClientCredentials.UserName.UserName = "abc@gmail.com";
              snx.ClientCredentials.UserName.Password = "xyz@2018";
  
              ServiceReference1.objectKey objectKey = new ServiceReference1.objectKey
              {
                  Name = ServiceReference1.objectIdentifierType.GTIN,
                  Value = "1111111"
              };
              ServiceReference1.ReferenceDocuments ReferenceDocuments = new ServiceReference1.ReferenceDocuments();
              snx.serialNumbersRequest("11111", "11111", ServiceReference1.idType.GS1_SER, ServiceReference1.encodingType.SGTIN, 2, objectKey, "", ReferenceDocuments);
  </code></pre>
  
  <p>App.config</p>
  
  <pre><code>&lt;bindings&gt;
          &lt;basicHttpBinding&gt;
              &lt;binding name="snrequestPortBinding"&gt;
                &lt;security mode="Transport"&gt;
                  &lt;transport clientCredentialType="Basic" /&gt;
                &lt;/security&gt;
              &lt;/binding&gt;
              &lt;binding name="snrequestPortBinding1" /&gt;
          &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
          &lt;endpoint address="https://itestapi.tracelink.com:443/soap/snx/snrequest"
              binding="basicHttpBinding" bindingConfiguration="snrequestPortBinding"
              contract="ServiceReference1.snrequest" name="snrequestPort" /&gt;
      &lt;/client&gt;
  </code></pre>