1

使用 Gsoap 访问 Web 服务时出现此错误。我们正在进行测试,因此不需要 SSL 证书检查。但是我的客户端,如何绕过 SSL 检查?我正在使用 C++。

我的错误是

SOAP 1.2 fault SOAP-ENV:Sender[no subcode]
"OpenSSL not installed: recompile with -DWITH_OPENSSL"
Detail: [no detail]
4

1 回答 1

0

这就是解决方案。

#include "calc.nsmap"
#include "soapcalcProxy.h" // generated with soapcpp2 -j calc.h

calcProxy calc("https-server-endpoint-URL");
double sum;
soap_ssl_init();       // init SSL (just need to do this once in an application)
// soap_ssl_no_init(); // or prevent init OpenSSL when already initialized elsewhere in an application
if (soap_ssl_client_context(calc.soap,
   SOAP_SSL_DEFAULT,
   NULL,          // no keyfile
   NULL,          // no keyfile password
   "cacerts.pem", // trusted certificates (or use self-signed cacert.pem)
   NULL,          // no capath to trusted certificates
   NULL           // no random data to seed randomness
))
{
   calc.soap_stream_fault(std::cerr);
   exit(EXIT_FAILURE);
}
if (calc.add(1.23, 4.56, sum) == SOAP_OK)
于 2020-08-24T04:15:30.760 回答