当我调用GetReport时,我只得到制表符分隔的响应的头。但是,当我使用便签簿进行RequestReport、RequestReportList操作时,使用RequestId获取GeneratedReportId,然后使用该Id获取GetReport。我得到了预期的结果。
有人知道为什么我的代码不能像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); 发布于 2016-06-02 01:26:51
我从ReportRequest中删除了MarketplaceId,它工作正常。我不知道为什么它没有拉出指定的报告,但它在没有信息的情况下工作。
从上面的代码中删除了这两行。
request.MarketplaceIdList = new IdList();
request.MarketplaceIdList.Id = new List<string>(new string[] { settings.MarketplaceId });https://stackoverflow.com/questions/37574694
复制相似问题