Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fatal error: Uncaught SoapFault exception: [2] Access denied in /Applications/MAMP/htdocs/my_project/scripts/test_actions_api_soap.php:9
- <?xml version="1.0"?>
- <config>
- <api>
- <resources>
- <apiactions_api translate="title" module="apiactions">
- <title>Myapi</title>
- <acl>apiactions/api</acl>
- <model>apiactions/api</model>
- <methods>
- <cleancache translate="title" module="apiactions">
- <title>actions</title>
- <acl>apiactions/cleancache</acl>
- </cleancache>
- <reindexall translate="title" module="apiactions">
- <title>actions</title>
- <acl>apiactions/reindexall</acl>
- </reindexall>
- </methods>
- </apiactions_api>
- </resources>
- <acl>
- <resources>
- <apiactions translate="title" module="apiactions">
- <title>Apiactions</title>
- <sort_order>2000</sort_order>
- <cleancache translate="title" module="apiactions">
- <title>actions</title>
- </cleancache>
- <reindexall translate="title" module="apiactions">
- <title>actions</title>
- </reindexall>
- </apiactions>
- </resources>
- </acl>
- </api>
- </config>
- <?php
- class Myproject_Apiactions_Model_Api extends Mage_Api_Model_Resource_Abstract
- {
- public function cleancache()
- {
- try {
- $allTypes = Mage::app()->useCache();
- foreach($allTypes as $type => $value)
- {
- Mage::app()->getCacheInstance()->cleanType($type);
- }
- Mage::app()->getCacheInstance()->flush();
- } catch (Exception $e) {
- error_log($e->getMessage());
- }
- return "SUCESS: Cache cleaned succesfully";
- }
- public function reindexall()
- {
- $indexingProcesses = Mage::getSingleton('index/indexer')->getProcessesCollection();
- foreach ($indexingProcesses as $process)
- {
- $process->reindexEverything();
- }
- return "SUCESS: Everything reindexed succesfully";
- }
- }
- <?php
- $re = set_time_limit (86400);
- $client = new SoapClient('http://example.com/api/soap/?wsdl');
- $session = $client->login('my_user', 'my_password');
- $result = $client->call($session, 'apiactions_api.cleancache'); // <- this is the line:9 that's returning the denied error
- print_r( $result );
- $result = $client->call($session, 'apiactions_api.reindexall')
- print_r( $result );
- die();
Add Comment
Please, Sign In to add comment