php - fatal error : Uncaught SoapFault exception: [soap:Server] Fault occurred while processing

标签 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 

我的电话有什么问题吗?

最佳答案

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

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

关于php - fatal error : Uncaught SoapFault exception: [soap:Server] Fault occurred while processing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37222183/

相关文章:

php - php 包含和文件路径的问题

php - 获取 Mysql $Row 和查询

c# - 使用 IClientMessageInspector 从 WCF soap 请求中删除操作节点 mustUnderstand

c++ - 通过 Web 服务在 Magento 中填充客户购物车(使用 C++)

javascript - 使用 Jquery 和 Javascript 解析 xml

php - 流明 : How to display the image on a public folder?

php - 模拟 Controller 从 WebTestCase 调用的服务

java - 在一个数据包中发送多个 SOAP 请求

java - 使用 Java 的 getElementById 的 Xml id 属性?

perl - 将 html 嵌套列表解析为 perl 数组