Guest User

Untitled

a guest
Oct 17th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. Fatal error: Uncaught SoapFault exception: [2] Access denied in /Applications/MAMP/htdocs/my_project/scripts/test_actions_api_soap.php:9
  2.  
  3. <?xml version="1.0"?>
  4. <config>
  5. <api>
  6. <resources>
  7. <apiactions_api translate="title" module="apiactions">
  8. <title>Myapi</title>
  9. <acl>apiactions/api</acl>
  10. <model>apiactions/api</model>
  11. <methods>
  12. <cleancache translate="title" module="apiactions">
  13. <title>actions</title>
  14. <acl>apiactions/cleancache</acl>
  15. </cleancache>
  16. <reindexall translate="title" module="apiactions">
  17. <title>actions</title>
  18. <acl>apiactions/reindexall</acl>
  19. </reindexall>
  20. </methods>
  21. </apiactions_api>
  22. </resources>
  23. <acl>
  24. <resources>
  25. <apiactions translate="title" module="apiactions">
  26. <title>Apiactions</title>
  27. <sort_order>2000</sort_order>
  28. <cleancache translate="title" module="apiactions">
  29. <title>actions</title>
  30. </cleancache>
  31. <reindexall translate="title" module="apiactions">
  32. <title>actions</title>
  33. </reindexall>
  34. </apiactions>
  35. </resources>
  36. </acl>
  37. </api>
  38. </config>
  39.  
  40. <?php
  41. class Myproject_Apiactions_Model_Api extends Mage_Api_Model_Resource_Abstract
  42. {
  43.  
  44. public function cleancache()
  45. {
  46. try {
  47. $allTypes = Mage::app()->useCache();
  48. foreach($allTypes as $type => $value)
  49. {
  50. Mage::app()->getCacheInstance()->cleanType($type);
  51. }
  52. Mage::app()->getCacheInstance()->flush();
  53. } catch (Exception $e) {
  54. error_log($e->getMessage());
  55. }
  56.  
  57. return "SUCESS: Cache cleaned succesfully";
  58. }
  59.  
  60.  
  61. public function reindexall()
  62. {
  63. $indexingProcesses = Mage::getSingleton('index/indexer')->getProcessesCollection();
  64. foreach ($indexingProcesses as $process)
  65. {
  66. $process->reindexEverything();
  67. }
  68.  
  69. return "SUCESS: Everything reindexed succesfully";
  70. }
  71.  
  72. }
  73.  
  74. <?php
  75.  
  76. $re = set_time_limit (86400);
  77.  
  78. $client = new SoapClient('http://example.com/api/soap/?wsdl');
  79. $session = $client->login('my_user', 'my_password');
  80.  
  81. $result = $client->call($session, 'apiactions_api.cleancache'); // <- this is the line:9 that's returning the denied error
  82. print_r( $result );
  83. $result = $client->call($session, 'apiactions_api.reindexall')
  84. print_r( $result );
  85.  
  86. die();
Add Comment
Please, Sign In to add comment