[英]Fatal error: Uncaught SoapFault exception: [HTTP] Failed Sending HTTP SOAP
I written an PHP script that execute an SOAP request to send some data and upload an base64binary
using soap_client in PHP 7.2.14. 我编写了一个PHP脚本,该脚本执行SOAP请求以发送一些数据,并使用PHP 7.2.14中的soap_client上传
base64binary
。
After execute the SOAP request with a small amount of data (small file < 60 Kb) the request will pass. 用少量数据(小于60 Kb的小文件)执行SOAP请求后,请求将通过。 If I add a bigger file to upload (>80 Kb) the request will fail and gives this error:
如果我要上传的文件更大(> 80 Kb),请求将失败并显示以下错误:
Fatal error: Uncaught SoapFault exception: [HTTP] Failed Sending HTTP SOAP
. Fatal error: Uncaught SoapFault exception: [HTTP] Failed Sending HTTP SOAP
。
I checked default_socket_timeout
on the server and increased it.I also tried base64_econde
the string, but SOAP is already encoding it by itself. 我在服务器上检查了
default_socket_timeout
并增加了它。我还尝试了base64_econde
字符串,但是SOAP已经对其进行了编码。
My code: 我的代码:
//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));
Full exeption: 全功能:
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
That below code I have wrote on Line 65 is: 我在65行上写的以下代码是:
$result = $client->Add(array('Gegevens' => $data));
Any idea why small files will be send successful and bigger files (>80 Kb) will fail? 知道为什么小文件成功发送而大文件(> 80 Kb)将失败吗?
Many thanks! 非常感谢!
I faced same problem and tried below solution and it was worked for me. 我遇到了同样的问题,并尝试了以下解决方案,它为我工作。 But i don't know which values you passed in header.
但我不知道您在标头中传递了哪些值。 Please add
请加
#) libxml_disable_entity_loader(false); // above the WS SETTINGS and try it.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.