簡體   English   中英

PHP Soap issue: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 or SSL: Connection reset by peer

[英]PHP Soap issue: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 or SSL: Connection reset by peer

我嘗試執行 SOAP 請求,

  1. 請求在 Soap UI 上運行良好,用戶界面給出了正確的響應,-從下面的嘗試中復制粘貼有效負載
  2. 請求在 Postman 上不起作用給出Could not get any response錯誤
  3. 請求無法使用 php SoapClient 庫給出SoapClient::__doRequest(): SSL: Connection reset by peer error
  4. 使用 php curl 請求不起作用,給出OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54錯誤

一切就緒,在沒有 wsdl 模式和不同的 ssl 驗證選項下嘗試 SoapClient,並在遠程服務器上嘗試,所以不是互聯網連接問題。

這是第 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\"",
]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM