![](/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.