2016-06-01 10 views
0

私がGetReportを呼び出すと、私はタブで区切られたレスポンスのヘッダーしか取得できません。しかし、スクラッチパッドをRequestReport、RequestReportListに使用すると、RequestIdを使用してGeneratedReportIdを取得し、そのIDでGetReportを取得します。私は期待される結果を得る。Amazon MWS _GET_MERCHANT_LISTINGS_DATA_ empty

私のコードがscrathpadのようにレポートをプルしない理由を知っている人はいますか?

  RequestReportRequest request = new RequestReportRequest(); 
      request.Merchant = settings.SellerId; 
      request.MarketplaceIdList = new IdList(); 
      request.MarketplaceIdList.Id = new List<string>(new string[] { settings.MarketplaceId }); 
      request.ReportType = "_GET_MERCHANT_LISTINGS_DATA_"; 

      RequestReportResponse requestResponse = _mws.RequestReport(request); 
      Thread.Sleep(15000); 
      Console.WriteLine(requestResponse.RequestReportResult.ReportRequestInfo.ReportProcessingStatus); 
      GetReportRequestListRequest reportRequestListRequest = new GetReportRequestListRequest(); 

      reportRequestListRequest.Merchant = settings.SellerId; 
      List<ReportRequestInfo> requestInfos = new List<ReportRequestInfo>(); 

      GetReportRequestListResponse reportRequestListResponse = new GetReportRequestListResponse(); 
      reportRequestListResponse = _mws.GetReportRequestList(reportRequestListRequest); 
      GetReportRequestListResult reportRequestListResult = new GetReportRequestListResult(); 
      reportRequestListResult = reportRequestListResponse.GetReportRequestListResult; 
      requestInfos = reportRequestListResult.ReportRequestInfo; 

      while (requestInfos[0].ReportProcessingStatus.ToString() != "_DONE_") 
      { 
       Thread.Sleep(20000); 
       reportRequestListResponse = _mws.GetReportRequestList(reportRequestListRequest); 
       reportRequestListResult = reportRequestListResponse.GetReportRequestListResult; 
       requestInfos = reportRequestListResult.ReportRequestInfo; 

      } 

      GetReportListRequest listRequest = new GetReportListRequest(); 
      listRequest.Merchant = settings.SellerId; 
      listRequest.ReportRequestIdList = new IdList(); 
      listRequest.ReportRequestIdList.Id.Add(requestResponse.RequestReportResult.ReportRequestInfo.ReportRequestId); 

      GetReportListResponse listResponse = _mws.GetReportList(listRequest); 

      GetReportListResult getReportListResult = listResponse.GetReportListResult; 

      GetReportRequest reportRequest = new GetReportRequest(); 
      reportRequest.Merchant = settings.SellerId; 
      reportRequest.WithReportId(getReportListResult.ReportInfo[0].ReportId); 

      GetReportResponse reportResponse = new GetReportResponse(); 
      string fileName = dataPath + "\\report-" + getReportListResult.ReportInfo[0].ReportId + ".txt"; 
      reportRequest.Report = File.Open(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite); 
      reportResponse = _mws.GetReport(reportRequest); 

答えて

1

ReportRequestからMarketplaceIdを削除しても問題ありません。私はなぜそれが指定されたレポートをプルしなかったのか分からないが、情報なしで働いている。

上記2行を削除しました。

 request.MarketplaceIdList = new IdList(); 
     request.MarketplaceIdList.Id = new List<string>(new string[] { settings.MarketplaceId }); 
関連する問題