GetLowestPricedOffersForSKU处理参数失败

Pot*_*100 6 amazon-mws

我在尝试调用GetLowestPricedOffersForSKU时遇到了一个小问题,我收到了响应:

处理org.jboss.resteasy.spi.metadata的参数失败

我可以调用Product Api中的其他函数,它们工作正常,只是在这个函数上得到上述错误.

我已经在网上寻找答案,但找不到任何与此相关的内容,是否有人知道我为什么会这样做?

顺便说一句,它在MWS Scratchpad中运行良好!

小智 5

发帖以防其他人遇到这个问题并且像我一样困惑。除了这一特定请求之外,几乎所有 Amazon MWS 请求的工作方式都存在根本性差异。从技术上讲,所有其他请求都接受参数作为查询参数而不是 POST 数据。暂存器甚至表明这就是它实际工作的方式(尽管 MWS 暂存器实际上也将数据作为发布数据字段发送)。

  • 这个人的行为如何? (3认同)

Soo*_*K G 0

这段代码对我有用。希望它能帮助某人。

<?php

    require_once('.config.inc.php');

    // More endpoints are listed in the MWS Developer Guide
    // North America:
    $serviceUrl = "https://mws.amazonservices.com/Products/2011-10-01";
    // Europe
    //$serviceUrl = "https://mws-eu.amazonservices.com/Products/2011-10-01";
    // Japan
    //$serviceUrl = "https://mws.amazonservices.jp/Products/2011-10-01";
    // China
    //$serviceUrl = "https://mws.amazonservices.com.cn/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,
            $config);


     // @TODO: set request. Action can be passed as MarketplaceWebServiceProducts_Model_GetLowestPricedOffersForSKU
     $request = new MarketplaceWebServiceProducts_Model_GetLowestPricedOffersForSKURequest();
     $request->setSellerId(MERCHANT_ID);
     $request->setMWSAuthToken(MWSAUTH_TOKEN);
     $request->setMarketplaceId(MARKETPLACE_ID);
     $request->setSellerSKU($sellerSKU);
     $request->setItemCondition($ItemCondition);
     // object or array of parameters
     invokeGetLowestPricedOffersForSKU($service, $request);


      function invokeGetLowestPricedOffersForSKU(MarketplaceWebServiceProducts_Interface $service, $request)
      {
          try {
            $response = $service->GetLowestPricedOffersForSKU($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");
         }
     }
    ?>
Run Code Online (Sandbox Code Playgroud)