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);
}