1
即使在添加CA证书后,使用gSOAP调用Web服务时,我也获得了HTTP_SSL_ERROR代码值30。这是产生示例https客户端请求使用gsoap调用的C++程序
即使在添加CA证书后,使用gSOAP调用Web服务时,我也获得了HTTP_SSL_ERROR代码值30。这是产生示例https客户端请求使用gsoap调用的C++程序
代理类提供凭证档案错误和ssl_flag,所以我们可以把一个验证这样的HTTPS证书的证书:
BindingProxy *Service = new BindingPRoxy();
Service->cafile = "C:\\Users\\Machinename\\Desktop\\ca.cer";
Service->ssl_flags = SOAP_SSL_DEFAULT;
这将验证SSL证书。
请参考安装目录中的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);
}