douchun1900 2019-02-14 11:43
浏览 938

致命错误:未捕获的SoapFault异常:[HTTP]发送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!

  • 写回答

1条回答 默认 最新

  • dourunlao1642 2019-02-14 12:47
    关注

    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.
    
    评论

报告相同问题?

悬赏问题

  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥200 关于#c++#的问题,请各位专家解答!网站的邀请码
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号