简体   繁体   中英

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.

After execute the SOAP request with a small amount of data (small file < 60 Kb) the request will pass. If I add a bigger file to upload (>80 Kb) the request will fail and gives this error:

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.

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:

$result = $client->Add(array('Gegevens' => $data));

Any idea why small files will be send successful and bigger files (>80 Kb) will fail?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM