【发布时间】:2019-03-06 13:25:56
【问题描述】:
我的应用程序 Laravel 出现问题,当我使用 SoapClient 时,例如 my_object_soap->login(); 返回此错误:
致命错误:未捕获的 SoapFault 异常:[客户端] 看起来我们没有 XML
我已经尝试了几种我在谷歌和这里研究过的解决方案,但我没有解决我的问题。
我的代码如下:
ini_set("soap.wsdl_cache_enabled",0);
ini_set("soap.wsdl_cache",0);
ini_set("error_reporting",-1);
ini_set("display_errors","On");
$wsdl_url = "https://example.com/index.php/api/v2_soap/index/?wsdl";
$apiAuth = new \stdClass();
$apiAuth->username = trim("myusermagento");
$apiAuth->apiKey = trim("mykeymagento");
try{
$proxy = new SoapClient($wsdl_url,array('cache_wsdl' => WSDL_CACHE_NONE, 'trace' => true));
$session = $proxy->login($apiAuth);
$data = $session;
$status = true;
$responseStatus = 200;
} catch(SoapFault $e) {
$error = $e->getMessage();
$data = $proxy->__getLastResponse();
$status = false;
$responseStatus = 500;
}
return Response::json([
'success' => $status,
'data' => $data,
'erros'=> $error,
],$responseStatus);
我不知道是哪个问题,当我在 SoapUI 中使用这个用户和密钥进行测试时,没问题,但在我的应用程序中却没有。
我的magento版本应用是1.6.2,我的php是7.2,我已经尝试降级到php 5.6,因为它可能与magento版本和我的php不兼容,但还是不行。
有人可以帮我吗?
【问题讨论】:
标签: php laravel apache ubuntu magento