即使在添加CA证书之后,我也获得了HTTP_SSL_ERROR代码值30,同时使用gSOAP调用Web服务。
答案 0 :(得分:0)
生成的代理类提供了cafile和ssl_flag,因此我们可以通过https传递验证证书的证书,如下所示:
BindingProxy *Service = new BindingPRoxy();
Service->cafile = "C:\\Users\\Machinename\\Desktop\\ca.cer";
Service->ssl_flags = SOAP_SSL_DEFAULT;
这将验证SSL证书。
答案 1 :(得分:0)
请参阅安装目录中的gsoap示例程序。您可以在此问题上找到更多详细信息。
if (soap_ssl_client_context(&soap,
/* SOAP_SSL_NO_AUTHENTICATION, */ /* for encryption w/o authentication */
/* SOAP_SSL_DEFAULT | SOAP_SSL_SKIP_HOST_CHECK, */ /* if we don't want the host name checks since these will change from machine to machine */
SOAP_SSL_DEFAULT, /* use SOAP_SSL_DEFAULT in production code */
NULL, /* keyfile (cert+key): required only when client must authenticate to server (see SSL docs to create this file) */
NULL, /* password to read the keyfile */
"cacert.pem", /* optional cacert file to store trusted certificates, use cacerts.pem for all public certificates issued by common CAs */
NULL, /* optional capath to directory with trusted certificates */
NULL /* if randfile!=NULL: use a file with random data to seed randomness */
))
{ soap_print_fault(&soap, stderr);
exit(1);
}