![](/img/trans.png)
[英]Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers
[英]Fatal error: Uncaught SoapFault exception: [HTTP] Failed Sending HTTP SOAP
我編寫了一個PHP腳本,該腳本執行SOAP請求以發送一些數據,並使用PHP 7.2.14中的soap_client上傳base64binary
。
用少量數據(小於60 Kb的小文件)執行SOAP請求后,請求將通過。 如果我要上傳的文件更大(> 80 Kb),請求將失敗並顯示以下錯誤:
Fatal error: Uncaught SoapFault exception: [HTTP] Failed Sending HTTP SOAP
。
我在服務器上檢查了default_socket_timeout
並增加了它。我還嘗試了base64_econde
字符串,但是SOAP已經對其進行了編碼。
我的代碼:
//WS SETTINGS
$wsdl = "https://ws.eye-move.nl/WoningDocument.asmx?WSDL";
$ns = 'http://ws.eye-move.nl/WoningDocument';
// SOAP client
$params = array ('trace' => 1, 'exceptions' => 1, "connection_timeout" => 180);
$client = new SoapClient($wsdl, $params);
//COLLECT DATA FOR UPLOADING
$RecID = '34244701';
$filename = 'Testfile-'.date("Y-m-d H:i:s").'.pdf';
$filecontent = file_get_contents('temp/test.pdf');
//SET HEADERS
$headerBody = array(
'Username' => $login,
'Password' => $password,
'Customer' => $partnerID
);
$header = new SoapHeader($ns, 'AuthHeader', $headerBody);
$client->__setSoapHeaders($header);
$data = array(
'WoningID' => $RecID,
'WoningDocumentBestand' => array('Bestandsnaam'=>$filename,'Bestand'=>$filecontent),
'WoningDocumentType' => 'DocumentType',
'Omschrijving' => 'Description',
'Volgorde' => '1'
);
$result = $client->Add(array('Gegevens' => $data));
全功能:
Fatal error: Uncaught SoapFault exception: [HTTP] Failed Sending HTTP SOAP request in /var/www/vhosts/acceptatie.nl/httpdocs/sendrapport3.php:65 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'ws.eye-m...', 'ws.eye-m...', 1, 0) #1 /var/www/vhosts/acceptatie.nl/httpdocs/sendrapport3.php(65): SoapClient->__call('Add', Array) #2 {main} thrown in /var/www/vhosts/acceptatie.nl/httpdocs/sendrapport3.php on line 65
我在65行上寫的以下代碼是:
$result = $client->Add(array('Gegevens' => $data));
知道為什么小文件成功發送而大文件(> 80 Kb)將失敗嗎?
非常感謝!
我遇到了同樣的問題,並嘗試了以下解決方案,它為我工作。 但我不知道您在標頭中傳遞了哪些值。 請加
#) libxml_disable_entity_loader(false); // above the WS SETTINGS and try it.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.