title: Trying to call a Webservice secured with X.509 Certificate
body: <p>I'm trying to call a webservice that is secured using an X.509 Certificate.
  The provider of the webservice has supplied me with a username, and password.
  When I browse to the site using Firefox, the browser prompts me for a username, and password.
  When I enter the username/password, it brings me to an XMLdocument (not a WSDL).
  I can then click on the certificate (to the left of the address bar), and I see that the service provider has verified his own certificate</p>
  
  <p>I have been supplied with a WSDL (as an email attachment), 
  and have created the proxy classes using the standard right click add service reference.</p>
  
  <p>When I try to invoke the webservice, I get the following error:
  Could not establish trust relationship for the SSL/TLS secure channel with authority.</p>
  
  <p>I've tried saving the certificate from the website (clicking on Certname left of the address bar --> view cert --> export), and installing it on my machine using the mmc certificate snap-in (am I even going in the right direction here ?? )</p>
  
  <p>but this didn't work either</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var factory = new ChannelFactory&lt;ServicePort&gt;("ServiceSoapBinding");
  factory.Credentials.UserName.UserName = "myuser";
  factory.Credentials.UserName.Password = "mypass";
  var client = factory.CreateChannel();
  var request = GetRequest();
  var response = client.GetDetails(request);
  </code></pre>
  
  <p>I have a VERY basic understanding of certificates, so with this in mind:</p>
  
  <ol>
  <li>Do I have to install a client certificate on the client machine (My Dev PC for now).</li>
  <li>Should the service provider supply me with a specific certificate, and if so, can I get it from his website as detailed above, or does he need to send it to me separately.</li>
  </ol>
  
  <p>Any help with this would be much appreciated.</p>
  
  <p>Many thanks
  Kevin T</p>