Web Service Mail Test - SSL Error

Asked

Viewed 608 times

1

Has anyone ever had this problem referencing web service for testing and implementations of the post office.

I need to perform some validations but I can’t execute any method without SSL errors.

inserir a descrição da imagem aqui

2 answers

1


The two methods below serve to accept any certificate that web services are using

    private static void SetCertificatePolicy()
    {
        // Código necessário para acessar serviços remotos
        // Evita o erro HTTP 417
        ServicePointManager.Expect100Continue = false;

        ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidate;
    }

    private static bool RemoteCertificateValidate(object sender, X509Certificate cert, X509Chain chain,
        SslPolicyErrors error)
    {
        return true;
    }
  • How could I apply this within my context ? Even with this error, I can import all the classes and methods from the web service. Only when I try to execute a specific method of a ssl error.

  • Try calling Setcertificatepolicy() before instantiating your webservice class and making the calls.. and let me know if it works out.!

  • It worked perfectly!!!!!! I am very happy. Thank you very much!!!!! Can you explain to me briefly (you don’t need to if you don’t want to) how it works ? Actual concepts.

  • Speak friend, I am very happy that it worked, I advise you to create a class of useful to guard this guy because in the course of your integration with the webservice may arise other methods. In the above code basically I Seto a callback in the certificate validation, and the same always returns True, always returning as if your certificate was valid :)

  • Thanks (-; ......

0

The problem is in the web service certificate. Probably the certificate is self-signed, which causes it to be marked as 'fake' by browsers/applications.

Not much to do. You can try to force your application/server to accept the fake certificate, but it is not guaranteed to work.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.