致命错误:未捕获的SoapFault异常:[soap:Server]处理时发生故障

时间:2016-05-14 03:27:52

标签: php soap xml-parsing wsdl soap-client

我使用此代码

error_reporting(E_ALL);
ini_set('display_errors', 1);

$params = array(
    'username' => 'username',
    'password' => 'password',
    'cocNo' => '1060907A'
);

$client = new SoapClient('URL/?wsdl',array('trace'=>1));
//$response = $client->__getTypes();
$response = $client->__getFunctions();
pint_r($response);

得到这个成功的回复:

Array ( [0] => verifyResponse verify(verify $parameters) ) 

但是当我使用这段代码时

$response = $client->__soapcall('verify',array($params));

我收到了此回复错误

Fatal error: Uncaught SoapFault exception: [soap:Server] Fault occurred while processing. in /PATH/index.php:22 
Stack trace: #0 /PATH/index.php(22): SoapClient->__soapCall('verify', Array) #1 {main} thrown in /PATH/index.php on line 22 

我的电话有什么问题?

1 个答案:

答案 0 :(得分:1)

根据$client->__getTypes(),你错过了一个' arg0'数据结构中的元素。将您的代码更改为:

try 
{
  $response = $client->verify(array('arg0' => $params));
} 
catch(Exception $e)
{
  var_dump($e->getMessage());
}