How to use SOAP service over HTTPS in C #?

The Webservice administrator gave me the WSDL, two certificates and a private key:

service.wsdl
ssl.cer
auth_cert.pem
auth_private_key.pem

In Visual Studio 2010, I added a web link (the service link does not work) from WSDL. Then I tried to use it, as it was an http client-minder:

MySoapClient client = new MySoapClient();
client.Operation();

and I get this stack trace:

Unhandled Exception: System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
   at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

What should I do with certificates and private key?
I cannot find an online tutorial or books that cover this subject. Any hint?

Update

Endpoint Access Using Firefox:

SSL partner cannot confirm your certificate. (Error code: ssl_error_bad_cert_alert)

+5
source share
2 answers

Webservice WSDL,

, . , https. , :

, SSL ( SSL). , - . Windows, ( ). , , , ( Trusted Root CA).

- . ( ) - WCF :

<behaviors>
    <endpointBehaviors>
        <behavior name="certSecureBehavior">
            <clientCredentials>
                <clientCertificate findValue="client-CN" storeLocation="LocalMachine" x509FindType="FindBySubjectName" storeName="My"/>
                <serviceCertificate>
                    <defaultCertificate findValue="server-CN" storeLocation="LocalMachine" x509FindType="FindBySubjectName" storeName="TrustedPeople"/>
                </serviceCertificate>
            </clientCredentials>
        </behavior>
    </endpointBehaviors>
</behaviors>

. :

  • client-CN - , ( )
  • server-CN - , ( DNS- )

. http://blogs.msdn.com/b/imayak/archive/2008/09/12/wcf-2-way-ssl-security-using-certificates.aspx .

+6

, , , SSL . service.wsdl WSDL.exe - #, VS -. , . , System.Net.WebException.

, SSL . , , , , - SSL . WSDL , SSL (https://). , . SSL , WSDL , , , .

0

All Articles