C# 报告API的MWS GetReport函数是否返回空值?

C# 报告API的MWS GetReport函数是否返回空值?,c#,amazon-mws,C#,Amazon Mws,我正在尝试提取FBA装运数据报告。我有一个正在运行的应用程序,它成功地从Amazon提取未发货的订单。所以基本上我把代码改成FBA发货单需要的代码。我几乎没有修改工作代码来获取报告,现在GetReport函数返回null,我不知道为什么。我正在传递一个来自Amazon系统的ReportId 如果有人能仔细阅读代码,看看我是否传入了空对象或其他东西 RequestReportRequest reportRequestRequest = new RequestReportRequest(); rep

我正在尝试提取FBA装运数据报告。我有一个正在运行的应用程序,它成功地从Amazon提取未发货的订单。所以基本上我把代码改成FBA发货单需要的代码。我几乎没有修改工作代码来获取报告,现在GetReport函数返回null,我不知道为什么。我正在传递一个来自Amazon系统的ReportId

如果有人能仔细阅读代码,看看我是否传入了空对象或其他东西

RequestReportRequest reportRequestRequest = new RequestReportRequest();
reportRequestRequest.Merchant = merchantId;
reportRequestRequest.Marketplace = marketplaceId;
reportRequestRequest.ReportType = "_GET_AMAZON_FULFILLED_SHIPMENTS_DATA_";
reportRequestRequest.StartDate = DateTime.Now.AddDays(-2);
reportRequestRequest.EndDate = DateTime.Now;

RequestReportResponse requestResponse = service.RequestReport(reportRequestRequest);
Thread.Sleep(15000);
Console.WriteLine(requestResponse.RequestReportResult.ReportRequestInfo.ReportProcessingStatus);
GetReportRequestListRequest reportRequestListRequest = new GetReportRequestListRequest();
reportRequestListRequest.Marketplace = marketplaceId;
reportRequestListRequest.Merchant = merchantId;
List<ReportRequestInfo> myListzz = new List<ReportRequestInfo>();

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

}
GetReportListRequest listRequest = new GetReportListRequest();
listRequest.Merchant = merchantId;
listRequest.Marketplace = marketplaceId;
listRequest.ReportRequestIdList = new IdList();
listRequest.ReportRequestIdList.Id.Add(requestResponse.RequestReportResult.ReportRequestInfo.ReportRequestId);

GetReportListResponse listResponse = service.GetReportList(listRequest);


//MessageBox.Show(listResponse.GetReportListResult.ReportInfo.ToString());
GetReportListResult getReportListResult = listResponse.GetReportListResult;

GetReportRequest reportRequest = new GetReportRequest();
reportRequest.Merchant = merchantId;
reportRequest.Marketplace = marketplaceId;
reportRequest.WithReportId(getReportListResult.ReportInfo[0].ReportId);


GetReportResponse reportResponse = new GetReportResponse();

{
    reportResponse = service.GetReport(reportRequest); // <=== ERROR!!!!
}
catch (MarketplaceWebServiceException e)
{
    Console.WriteLine(e);
}
StreamReader sr = new StreamReader(reportRequest.Report);
Console.WriteLine(sr.ReadToEnd());
sr.Close();
RequestReportRequest=newrequestreportrequest();
reportRequestRequest.Merchant=merchantId;
reportRequestRequest.Marketplace=marketplaceId;
reportRequestRequest.ReportType=“\u获取\u亚马逊\u完成的货物\u数据”;
reportRequestRequest.StartDate=DateTime.Now.AddDays(-2);
reportRequestRequest.EndDate=DateTime.Now;
RequestReportResponse=service.RequestReport(reportRequestRequest);
睡眠(15000);
WriteLine(requestResponse.RequestReportResult.ReportRequestInfo.ReportProcessingStatus);
GetReportRequestListRequest reportRequestListRequest=新建GetReportRequestListRequest();
reportRequestListRequest.Marketplace=marketplaceId;
reportRequestListRequest.Merchant=merchantId;
List myListzz=新列表();
GetReportRequestListResponse reportRequestListResponse=新建GetReportRequestListResponse();
reportRequestListResponse=service.GetReportRequestList(reportRequestListRequest);
GetReportRequestListResult reportRequestListResult=新建GetReportRequestListResult();
reportRequestListResult=reportRequestListResponse.GetReportRequestListResult;
myListzz=reportRequestListResult.ReportRequestInfo;
while(myListzz[0].ReportProcessingStatus.ToString()!=“\u完成”)
{
睡眠(20000);
reportRequestListResponse=service.GetReportRequestList(reportRequestListRequest);
reportRequestListResult=reportRequestListResponse.GetReportRequestListResult;
myListzz=reportRequestListResult.ReportRequestInfo;
}
GetReportListRequest listRequest=新建GetReportListRequest();
listRequest.Merchant=merchantId;
listRequest.Marketplace=marketplaceId;
listRequest.ReportRequestIdList=新IdList();
listRequest.ReportRequestIdList.Id.Add(requestResponse.RequestReportResult.ReportRequestInfo.ReportRequestId);
GetReportListResponse listResponse=service.GetReportList(listRequest);
//Show(listResponse.GetReportListResult.ReportInfo.ToString());
GetReportListResult GetReportListResult=listResponse.GetReportListResult;
GetReportRequest reportRequest=新建GetReportRequest();
reportRequest.Merchant=merchantId;
reportRequest.Marketplace=marketplaceId;
reportRequest.WithReportId(getReportListResult.ReportInfo[0].ReportId);
GetReportResponse reportResponse=新建GetReportResponse();
{
reportResponse=service.GetReport(reportRequest);//在此行之后:

GetReportResponse reportResponse = new GetReportResponse(); 
您必须指定一个报告文件,如下所示:

reportRequest.Report = File.Open("C:\\AmazonReport.csv", FileMode.OpenOrCreate, FileAccess.ReadWrite);
然后,它会将报告写入该文件。
因此,您可以在那里看到您的报告。

谢谢,在java中遇到同样的问题后,这对我很有效