我对SOAP和PHP相当新,我遇到了一些麻烦,我希望Stack Overflow上有人可以帮助我。
我尝试使用此代码发布xml文件(retursvar.xml)。
我使用此代码发布文件:
<?php
$url = "https://someserver/somefunction";
$options = array(
'login' => 'someusername',
'password' => 'somepassword',
'trace' => 1
);
$client = new SoapClient($url.'?wsdl', $options);
$document = file_get_contents('retursvar.xml');
$params = array('SubmitDocument' => $document);
$response = $client->__soapCall('submitDocument', $params);
但我在Apache错误日志中收到此错误:
PHP Fatal error: Uncaught SoapFault exception: [bpws:forcedTermination] business exception in /var/www/html/soaptest.php:15\nStack trace:\n#0 /var/www/html/soaptest.php(15): SoapClient->__soapCall('submitDocument', Array)\n#1 {main}\n thrown in /var/www/html/soaptest.php on line 15
如果我打电话:
var_dump($client->__getFunctions());
紧接着:
$client = new SoapClient($url.'?wsdl', $options);
我得到了这个输出:
array(1) { [0]=> string(62) "SubmitDocumentResponse submitDocument(SubmitDocument $payload)" }
我做错了什么?
答案 0 :(得分:0)
它说你没有发现异常。尝试将代码包装在try catch块中。