【问题标题】:Fatal error: Uncaught SoapFault exception: [soap:Server] Fault occurred while processing致命错误:未捕获的 SoapFault 异常:[soap:Server] 处理时发生故障
【发布时间】:2016-09-10 08:52:21
【问题描述】:

我用这个代码

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 

我的电话有什么问题?

【问题讨论】:

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


    【解决方案1】:

    根据$client->__getTypes(),您的数据结构中缺少“arg0”元素。将您的代码更改为:

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

    【讨论】:

      猜你喜欢
      • 2012-12-19
      • 1970-01-01
      • 2015-05-23
      • 1970-01-01
      • 1970-01-01
      • 2015-10-15
      • 2012-02-18
      • 1970-01-01
      • 2018-12-24
      相关资源
      最近更新 更多