PHP Soap 问题 : OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 或 SSL:对等方重置连接

标签 php ssl curl soap wsdl

我尝试执行 SOAP 请求,

  • 请求在 Soap UI 上运行良好,给出了正确的响应,-从下面的尝试中复制粘贴有效负载
  • 请求在 Postman 上不起作用给 Could not get any response错误
  • 请求无法使用 php SoapClient 库提供 SoapClient::__doRequest(): SSL: Connection reset by peer错误
  • 使用 php curl 请求不起作用给出 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54错误

  • 一切就绪,在无 wsdl 模式下尝试 SoapClient,并使用不同的 ssl 验证选项,并在远程服务器上尝试,因此不是互联网连接问题。

    这是第 3 点的代码:
    $this->client = new \SoapClient($this->wsdl, [
                'soap_version' => SOAP_1_1,
                'exceptions' => true,
                'trace' => true,
                'cache_wsdl' => WSDL_CACHE_NONE,
            ]);
    
    $response = $this->client->__doRequest(trim($xml), $url, 'getReport', SOAP_1_1);
    
    

    这是第 4 点的代码:
     $ch = curl_init();
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); // both 0 & 1 not works
            curl_setopt($ch, CURLOPT_URL, $location);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); // also tries different values
            curl_setopt($ch, CURLOPT_TIMEOUT, 15); // here too
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, trim($request));
    
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_VERBOSE, 1);
    
            curl_setopt($ch, CURLOPT_HEADER, 1); // also not works without this
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // and this
    
            $response = curl_exec($ch);
    

    我能做些什么来更深入地调试这个问题并解决它?

    最佳答案

    原来, header 值 SOAPAction需要像这样在额外的转义引用中:

    $headers = [
       "SOAPAction: \"http://example-url.com\"",
    ]
    

    关于PHP Soap 问题 : OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 或 SSL:对等方重置连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61253596/

    相关文章:

    java.security.cert.CertPathValidatorException : Trust anchor for certification path not found. Android 2.3

    ssl - 多域 SSL?

    PHP/cURL - 服务器没有收到 POST 数据

    php - 在远程服务器上调试PHP代码的解决方案,使用远程IDE

    php - 删除 MySQL 字段值中字符串值开头或结尾的空格

    php - 无法在 Excel 中手动发送 Lotus Notes 电子邮件

    php - 这是使用 Paypal IPN 的有效方法吗?

    ssl - 使用卸载到 ELB 的 SSL 解密在 AWS EC2 nginx 上的重定向中添加的无效端口

    android - Ionic 3 应用程序按预期从 FCM 网络界面接收后台通知,但没有使用 curl

    php - 如何使用 php 将用户的 facebook 个人资料图片保存到我的域/网站数据中