Amazon mws api Class "MarketplaceWebService_Client" not found error

After downloading the unpacking Amazon MWS client library api, I tried to run one of the scripts to see if everything was working.

when I try to run the file GetReportCountSample.php I get an error

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

I looked at the configuration file and I have 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 the php file called MarketplaceWebService_Client , I need help, thanks.

+7
source share
3 answers

There is no php file called MarketplaceWebService_Client. Its Client.php in your loaded library. MarketplaceWebService_Client Class is only in the client.php file. I think that the path to Client.php is incorrectly specified in GetReportCountSample.php . Client.php can be located in the following path (Out of Samples folder): C: \ xampp \ htdocs \ sites \ amazon marketplace \ Client.php

+4
source

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 the include paths that are used in this program to load all sorted files for classes. Each of them is divided into PATH_SEPARATOR . This function adds another include path, which is 2 directories above the current working directory, and this is not a valid directory. You must specify the src directory.

To fix this, change '../../.' to point to the directory where the src folder is located. 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/'); 
+2
source

I understand that this is an old question, but I had a similar problem, and I decided to share my findings.

The problem here arose due to a change in the installation path of the library.

 ... not found in C:\xampp\htdocs\sites\amazon marketplace\Samples\GetReportCountSample.php 

Not including the Lib directory, it generated this error. If you read the .config.php file, you will see

 function __autoload($className){ $filePath = str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; $includePaths = explode(PATH_SEPARATOR, get_include_path()); foreach($includePaths as $includePath){ if(file_exists($includePath . DIRECTORY_SEPARATOR . $filePath)){ require_once $filePath; return; } } } 

This means that you need to have the correct path once the class has been split with underscores. In doing so, he searches for the path "MarketplaceWebService / client.php". Having deleted the "MarketplaceWebService" directory, he will not be able to find this file to determine the class.

To fix it, just set your library to "htdocs \ sites \ amazon marketplace \ MarketplaceWebService \" and everything should be fine.

Hope this helps someone.

+1
source

All Articles