douya2982 2015-10-18 04:05
浏览 118
已采纳

亚马逊MWS GetReport错误

I was trying to get the information regarding the Product catalog via _GET_WEBSTORE_PRODUCT_CATALOG_ ReportType. I was succesfull in submitting the report request and even it was processed and even the processing status was DONE and generated id was also collected. But when I try to get the report via the Action: GetReport it gives an Market place is not sent, even though the market place was mentioned. Below is the sample of codes and I m not using any of the PHP client library....

Code Sample

<?php

require 'config.php';    
$param = array(
    'AWSAccessKeyId'=> AWS_KEY,
    'Action'=>'GetReport',

    'ReportId'=>'513798174016724',
    'Merchant'=> MERCHANT_ID,
    'SignatureMethod' => "HmacSHA256",
    'SignatureVersion'=> "2",
    'Timestamp'=> gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()),
    'Version' => "2009-01-01",
    'Marketplace'=>MARKETPLACE
);
$secret = AWS_SECRET_ACCESS_KEY;
$url = array();
foreach ($param as $key => $val) {
    $key = str_replace("%7E", "~", rawurlencode($key));
    $val = str_replace("%7E", "~", rawurlencode($val));
    $url[] = "{$key}={$val}";
}    
sort($url);
$arr   = implode('&', $url);
$sign  = 'POST' . "
";
$sign .= 'mws.amazonservices.com' . "
";
$sign .= '/' . "
";
$sign .= $arr;    
$signature = hash_hmac("sha256", $sign, $secret, true);
$signature = urlencode(base64_encode($signature));    
$link  = "https://mws.amazonservices.com/?";
$link .= $arr . "&Signature=" . $signature;
$curl = curl_init();
curl_setopt_array($curl, array(

    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => $link,
    CURLOPT_POST => 1,

    )
);  

$resp1 = curl_exec($curl);    
curl_close($curl);    
print_r($resp1);

And error Sample Please indicate a marketplace for which the report is required. Is there anything I am missing... or where I have mistyped something ... Thanks for the solution in advance..

  • 写回答

1条回答 默认 最新

  • dongya1875 2015-10-19 13:30
    关注

    Try changing to these

    $request = new MarketplaceWebService_Model_RequestReportRequest();
    
    $marketplaceIdArray = array("Id" => array($marketplace_id));
    $request->setMarketplaceIdList($marketplaceIdArray);
    $request->setMerchant($merchant_id);
    $request->setReportType($this->report_type);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况