Amazon MWS Crash Error

I am trying to upload / download a listing from Amazon to a site that I recently created. The problem is I am currently getting this Fatal error :

Fatal error: Class 'MarketplaceWebServiceProducts_Client' not found in /var/www/html/hello/src/MarketplaceWebServiceProducts/Samples/ListMatchingProductsSample.php on line 53

      

I am having a difficult time for this. Here is my code:

require_once('config.inc.php');

$serviceUrl = "https://mws.amazonservices.com/Products/2011-10-01";


 $config = array (
   'ServiceURL' => $serviceUrl,
   'ProxyHost' => null,
   'ProxyPort' => -1,
   'ProxyUsername' => null,
   'ProxyPassword' => null,
   'MaxErrorRetry' => 3,
 );

$service = new MarketplaceWebServiceProducts_Client(
    AWS_ACCESS_KEY_ID,
    AWS_SECRET_ACCESS_KEY,
    APPLICATION_NAME,
    APPLICATION_VERSION,
    MERCHANT_ID,
    MARKETPLACE_ID
);

 $request = new MarketplaceWebServiceProducts_Model_ListMatchingProductsRequest();
 $request->setSellerId(A3O22V420SDTFY);
 invokeListMatchingProducts($service, $request);

  function invokeListMatchingProducts(MarketplaceWebServiceProducts_Interface $service, $request)
  {
  try {
    $response = $service->ListMatchingProducts($request);

    echo ("Service Response\n");
    echo ("=============================================================================\n");

    $dom = new DOMDocument();
    $dom->loadXML($response->toXML());
    $dom->preserveWhiteSpace = false;
    $dom->formatOutput = true;
    echo $dom->saveXML();
    echo("ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");

 } catch (MarketplaceWebServiceProducts_Exception $ex) {
    echo("Caught Exception: " . $ex->getMessage() . "\n");
    echo("Response Status Code: " . $ex->getStatusCode() . "\n");
    echo("Error Code: " . $ex->getErrorCode() . "\n");
    echo("Error Type: " . $ex->getErrorType() . "\n");
    echo("Request ID: " . $ex->getRequestId() . "\n");
    echo("XML: " . $ex->getXML() . "\n");
    echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");
 }
 }

      

Here is my code in config.inc.php:

define('AWS_ACCESS_KEY_ID', 'TYPE_YOUR_CREDENTIALS_HERE');
define('AWS_SECRET_ACCESS_KEY', 'TYPE_YOUR_CREDENTIALS_HERE');
define('APPLICATION_NAME', 'TYPE_YOUR_CREDENTIALS_HERE');
define('APPLICATION_VERSION', 'TYPE_YOUR_CREDENTIALS_HERE');
define ('MERCHANT_ID', 'TYPE_YOUR_CREDENTIALS_HERE');
define ('MARKETPLACE_ID', 'TYPE_YOUR_CREDENTIALS_HERE');

set_include_path(get_include_path() . PATH_SEPARATOR . '../../.');

 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;
        }
    }
}

      

+3


source to share





All Articles