Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon mws api Class 'MarketplaceWebService_Client' not found error

After downloading an unzipping Amazon's MWS client library api I have tried to run one of the scripts to see if everything is working.

when trying to run the file GetReportCountSample.php I get the error

Fatal error: Class 'MarketplaceWebService_Client' not found in C:\xampp\htdocs\sites\amazon marketplace\Samples\GetReportCountSample.php on line 68

I've looked through the config file and I have input my credentials such as:

define('AWS_ACCESS_KEY_ID', '<key id>');                 //has been input
define('AWS_SECRET_ACCESS_KEY', '<secret key id>');       //has been input

define('APPLICATION_NAME', '<Your Application Name>');   //no idea what this is
define('APPLICATION_VERSION', '<Your Application Version or Build Number>'); //no idea

define ('MERCHANT_ID', '<merch id>');                    //has been input

I can not find a php file called MarketplaceWebService_Client, I need help, thanks.

like image 728
mk_89 Avatar asked Jul 22 '12 12:07

mk_89


2 Answers

There is no php file called MarketplaceWebService_Client. Its Client.php in your downloaded library. MarketplaceWebService_Client Class is in client.php file only. I think include path of Client.php is not correctly specified in GetReportCountSample.php. Client.php may be in the following path(Outside of Samples folder): C:\xampp\htdocs\sites\amazon marketplace\Client.php

like image 154
Balaji Kandasamy Avatar answered Nov 24 '22 07:11

Balaji Kandasamy


Inside .config.inc.php you will have the following:

   /************************************************************************
    * OPTIONAL ON SOME INSTALLATIONS
    *
    * Set include path to root of library, relative to Samples directory.
    * Only needed when running library from local directory.
    * If library is installed in PHP include path, this is not needed
    ***********************************************************************/
    set_include_path(get_include_path() . PATH_SEPARATOR . '../../.');

This defines include paths, which are used in this program to load all the assorted files for the classes. Each one is seperated by PATH_SEPARATOR. This function adds another include path, which is 2 directories above the current working directory, and that is not the right directory. You have to point to the src directory.

To fix this, change '../../.' to point to the directory where the src folder is. My scripts and the src directory are in the same parent directory, so my code looks like this:

set_include_path(get_include_path() . PATH_SEPARATOR . getcwd().'/src/');
like image 35
Jack Cole Avatar answered Nov 24 '22 08:11

Jack Cole