NHK NHK - 1 year ago 211
PHP Question

Magento SOAP Access denied

When I tried to call my local Magento 1.9 using webservice using the following code, it seems that it is giving me access denied error.

I had no problem using SOAPUI (or other soap client) to call the same address.

PHP code

$client = new SoapClient('http://localhost/magento/index.php/api/soap/?wsdl', array('trace' => 1));

$session = $client->login('apiuser', 'apikey');

echo "REQUEST:\n" . $client->__getLastRequest() . "\n";
echo "Response:\n" . $client->__getLastResponse() . "\n";


$ php -f catalog_product_list.php
PHP Fatal error: Uncaught SoapFault exception: [2] Access denied. in /catalog_product_list.php:5
Stack trace:
#0 /catalog_product_list.php(5): SoapClient->__call('login', Array)
#1 /catalog_product_list.php(5): SoapClient->login('apiuser', 'apikey')
#2 {main}
thrown in /catalog_product_list.php on line 4

I had used the same code to call a remote copy and it is ok. What can be the problem?

Answer Source

previous i was using this address. either php or soapui works.


now i am using this address in both my soapui and php. both are working now. http://localhost/magento/index.php/api/soap/?wsdl

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download