Magento SOAP API Error – Access Denied Solution

apifatal errorsoap

I'm trying the following code to access product list

$client = new SoapClient('http://magentohost/api/soap/?wsdl');
$session = $client->login('apiUser', 'apiKey');
$result = $client->call($session, 'product.list');
$client->endSession($session);

But this is throwing the following error –

Fatal error: Uncaught SoapFault exception: [2] Access denied.

Can anyone help me to resolve this error ?.

Best Answer

  • Check if the apiUser and apiKey are correct or maybe try to set a new key/password via System > Web-Services > SOAP/XML-RPC - Users.

  • Disable WSDL Cache: Under System > Configuration > Magento Core API set Enable WSDL Cache to "No".

  • Updated/debug your script:

Try to run your script with the WSDL cache disabled settings:

ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient('http://magentohost/api/soap/?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE));
$session = $client->login('apiUser', 'apiKey');
$result = $client->call($session, 'product.list');
$client->endSession($session);
Related Topic