c++ - 无法使用 HTTPS 访问 gSOAP Web 服务
c++ - Can't access gSOAP web services with HTTPS
我正在尝试访问我在 gSOAP 2.8.4 上使用 SSL 构建的 Web 服务。但它不起作用。相关信息:
- 使用 HTTP 一切正常。只有当我使用 HTTPS 时才会出现此问题。
- 消息错误:
Error -1 fault: SOAP-ENV:Client [no subcode]
"End of file or no input: Operation interrupted or timed out (60 s receive delay) (60 s send delay)"
Detail: [no detail]
问题似乎不是低超时,因为错误是瞬时的。
服务器上下文:
if (soap_ssl_server_context(&soap,
SOAP_SSL_DEFAULT, /* use SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION to verify clients: client must provide a key file e.g. "client.pem" and "password" */
"server.pem", /* keyfile (cert+key): see SSL docs to create this file */
password, /* password to read the private key in the key file */
"cacert.pem", /* cacert file to store trusted certificates (to authenticate clients) */
"./", /* capath */
NULL, /* DH file name or DH param key len bits (e.g. "1024"), if NULL use RSA 2048 bits (SOAP_SSL_RSA_BITS) */
NULL, /* if randfile!=NULL: use a file with random data to seed randomness */
"server" /* server identification for SSL session cache (unique server name, e.g. use argv[0]) */
))
{
客户端上下文:
if (soap_ssl_client_context(&soap,
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 */
"./", /* optional capath to directory with trusted certificates */
NULL /* if randfile!=NULL: use a file with random data to seed randomness */
))
{
所有的证书和密码都是正确的。
可能是什么问题?
编辑:
我用-DDEBUG 编译了代码。这出现在 TEST.log
Free ID hashtable
Read 0 bytes from socket=4/fd=0
Sending back fault struct for error code -1
soap_instantiate_SOAP_ENV__Fault(-1, , )
我已经解决了这个问题。服务器证书错误。此应用程序中的 Common Name 应等于主机名。
我正在尝试访问我在 gSOAP 2.8.4 上使用 SSL 构建的 Web 服务。但它不起作用。相关信息:
- 使用 HTTP 一切正常。只有当我使用 HTTPS 时才会出现此问题。
- 消息错误:
Error -1 fault: SOAP-ENV:Client [no subcode] "End of file or no input: Operation interrupted or timed out (60 s receive delay) (60 s send delay)" Detail: [no detail]
问题似乎不是低超时,因为错误是瞬时的。
服务器上下文:
if (soap_ssl_server_context(&soap,
SOAP_SSL_DEFAULT, /* use SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION to verify clients: client must provide a key file e.g. "client.pem" and "password" */
"server.pem", /* keyfile (cert+key): see SSL docs to create this file */
password, /* password to read the private key in the key file */
"cacert.pem", /* cacert file to store trusted certificates (to authenticate clients) */
"./", /* capath */
NULL, /* DH file name or DH param key len bits (e.g. "1024"), if NULL use RSA 2048 bits (SOAP_SSL_RSA_BITS) */
NULL, /* if randfile!=NULL: use a file with random data to seed randomness */
"server" /* server identification for SSL session cache (unique server name, e.g. use argv[0]) */
))
{
客户端上下文:
if (soap_ssl_client_context(&soap,
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 */
"./", /* optional capath to directory with trusted certificates */
NULL /* if randfile!=NULL: use a file with random data to seed randomness */
))
{
所有的证书和密码都是正确的。 可能是什么问题?
编辑: 我用-DDEBUG 编译了代码。这出现在 TEST.log
Free ID hashtable Read 0 bytes from socket=4/fd=0 Sending back fault struct for error code -1 soap_instantiate_SOAP_ENV__Fault(-1, , )
我已经解决了这个问题。服务器证书错误。此应用程序中的 Common Name 应等于主机名。