Calling web service via SSL (https)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Calling web service via SSL (https)

Hybrid View

  1. #1
    Taiwo Ayedun Guest

    Calling web service via SSL (https)


    What is the trick to calling a web service accessed via https?

    I can navigate OK to the web service ASMX file from IE. From time to time
    when I access the web service via IE, I am asked to accept or reject the
    certificate. I always accept the certificate and I have on several occasions
    actually installed the certificate in the certificate store on the machine.

    First, why am I being repeatedly asked to accept the certificate even after
    I have installed it in the certificate store? Is it because I am not using
    a
    certificate issued by the recognized Certification Authorities such as
    Verisign and Thawte (I am using Microsoft Certificate Server to issue the
    server certificate for the web service site).

    Secondly, when I programmatically access the web service via the web service
    proxy, I get the error "The underlying connection was closed: Could not
    establish trust relationship with remote server."

    Now, I have exported the certificate installed in the certificate store to
    X509 format. I even went so far as to export the certificate on the web site
    for use on the web service client, after which I used the following piece
    of
    code:

    Dim ws As New TestWS.MyWebservice.Hello() '-- instantiate the web service

    ws.Credentials = CredentialCache.DefaultCredentials '-- Pass in
    credentials

    Dim x509 As X509Certificate =
    X509Certificate.CreateFromCertFile("c:\HelloWs.cer") '-- Load the
    certificate from a file

    ws.ClientCertificates.Add(x509) '-- add the certificate

    ws.HelloWorld '-- call the web method

    Whether I use the code above or not prior to calling the webmethod of a
    webservice accessed via https, I always get the error "The underlying
    connection was closed: Could not establish trust relationship with remote
    server."

    Please I need some insights on how to resolve this problem.

    Thanks,

    Taiwo

  2. #2
    Phil Weber Guest

    Re: Calling web service via SSL (https)

    > What is the trick to calling a web service accessed via https?

    Taiwo: You may find the following helpful:

    HOW TO: Secure XML Web Services with Secure Socket Layer
    in Windows 2000
    http://support.microsoft.com/default...;EN-US;q307267

    --
    Phil Weber



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center