调用 magento soap api 立即过期 [英] call to magento soap api expires immediately

查看:26
本文介绍了调用 magento soap api 立即过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调用 magento api 以获取特定客户的详细信息.当我执行此调用时,我总是收到以下错误:

I'm trying to do a call to the magento api to get the details of a specific customer. When I do this call I always get the following error:

PHP Fatal error:  Uncaught SoapFault exception: [5] Session expired. Try to relogin. in     /var/www/magento-client/magento-customer.php:12
Stack trace:
/var/www/magento-client/magento-customer.php(12): SoapClient->__call('call', Array)
/var/www/magento-client/magento-customer.php(12): SoapClient->call('a1a6863c7dadd95...', 'customer.info', 3)
{main}
  thrown in /var/www/magento-client/magento-customer.php on line 12

我在后端有一个有效的 api 用户,后端的 api 会话超时设置为 9999999999999,我什至尝试覆盖 magento 核心代码中的 isSessionExpired 函数,但没有任何效果.

I have a valid api user in the backend, the api session timeout in the backend is set to 9999999999999, and I've even tried to override the isSessionExpired function in the magento core code, but nothing works.

代码如下:

$url = 'http://magentourl/api/soap/?wsdl';
$apiUser = "user";
$apiPass = "password";

$proxy = new SoapClient($url);

$sessionId = $proxy->login($apiUser, $apiPass);

// Get new customer info
var_dump($sessionId);
var_dump($proxy->call($sessionId, 'customer.info', 3));
die();

有人知道可能是什么问题吗?

Does anyone have any ideas what the problem could be?

推荐答案

如果您随请求一起发送标头,则会发生这种情况,请检查标头是否已发送.

This occurs if you send headers with the request, check if headers are sent.

这篇关于调用 magento soap api 立即过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆