4

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

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.

The code is as follows:

$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?

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
jw01
  • 51
  • 1
  • 4

2 Answers2

1

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

Johan
  • 11
  • 1
  • Just a quick note, this was the cause of the error for me but its not HTTP Headers that is the problem. The problem is if there is a header in your SOAP request, for instance visual studio adds a header in debugmode like this: ... that made my request fail – jakobandersen Jan 22 '16 at 15:08
0

maybe you should try to truncate the api_session table in the mysql database

boti
  • 677
  • 5
  • 12