Пример #1
0
        private void WaitRequestsDone(RequestsListInfo requestsListInfo)
        {
            var actionName       = requestsListInfo.ActionName;
            var timeOutInMinutes = requestsListInfo.TimeOutInMinutes;
            var access           = requestsListInfo.Access;

            var amazonIsdList = requestsListInfo.AmazonIds;

            var getReportRequestListRequest = new GetReportRequestListRequest {
                Merchant            = requestsListInfo.UserId,
                ReportRequestIdList = amazonIsdList
            };

            var endDate = DateTime.Now.AddMinutes(timeOutInMinutes);

            while (DateTime.Now <= endDate)
            {
                var reportRequestListResponse = AmazonWaitBeforeRetryHelper.DoServiceAction(
                    requestsListInfo.ErrorRetryingInfo,
                    ReportGetRequestListTrapForThrottling,
                    actionName,
                    access,
                    requestsListInfo.RequestsCounter,
                    () => _Service.GetReportRequestList(getReportRequestListRequest),
                    "GetReportRequestList");

                if (reportRequestListResponse != null && reportRequestListResponse.IsSetGetReportRequestListResult())
                {
                    var getReportRequestListResult = reportRequestListResponse.GetReportRequestListResult;

                    requestsListInfo.UpdateAmazonReportRequestInfo(getReportRequestListResult == null ? null : getReportRequestListResult.ReportRequestInfo);
                }

                if (!requestsListInfo.HasAmazonResult)
                {
                    continue;
                }

                if (requestsListInfo.IsDoneAll)
                {
                    break;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// returns the number of feeds matching all of the specified criteria.
        ///
        /// </summary>
        /// <param name="service">Instance of MarketplaceWebService service.</param>
        /// <param name="request">GetFeedSubmissionCountRequest request.</param>
        public static async Task InvokeGetReportRequestList(IMarketplaceWebService service, GetReportRequestListRequest request)
        {
            try
            {
                var response = await service.GetReportRequestList(request);

                Console.WriteLine("Service Response");
                Console.WriteLine("=============================================================================");
                Console.WriteLine();

                Console.WriteLine("        GetReportRequestListResponse");

                if (response.IsSetGetReportRequestListResult())
                {
                    Console.WriteLine("            GetReportRequestListResult");
                    var getReportRequestListResult = response.GetReportRequestListResult;
                    var reportRequestInfoList      = getReportRequestListResult.ReportRequestInfo;

                    foreach (var reportRequestInfo in reportRequestInfoList)
                    {
                        Console.WriteLine("                  ReportRequestInfo");

                        if (reportRequestInfo.IsSetReportProcessingStatus())
                        {
                            Console.WriteLine("               ReportProcessingStatus");
                            Console.WriteLine("                                  {0}", reportRequestInfo.ReportProcessingStatus);
                        }

                        if (reportRequestInfo.IsSetReportRequestId())
                        {
                            Console.WriteLine("                      ReportRequestId");
                            Console.WriteLine("                                  {0}", reportRequestInfo.ReportRequestId);
                        }

                        if (reportRequestInfo.IsSetGeneratedReportId())
                        {
                            Console.WriteLine("                      GeneratedReportId");
                            Console.WriteLine("                                  {0}", reportRequestInfo.GeneratedReportId);
                        }

                        if (reportRequestInfo.IsSetReportType())
                        {
                            Console.WriteLine("                           ReportType");
                            Console.WriteLine("                                  {0}", reportRequestInfo.ReportType);
                        }

                        if (reportRequestInfo.IsSetStartDate())
                        {
                            Console.WriteLine("                            StartDate");
                            Console.WriteLine("                                  {0}", reportRequestInfo.StartDate);
                        }

                        if (reportRequestInfo.IsSetEndDate())
                        {
                            Console.WriteLine("                              EndDate");
                            Console.WriteLine("                                  {0}", reportRequestInfo.EndDate);
                        }

                        if (reportRequestInfo.IsSetSubmittedDate())
                        {
                            Console.WriteLine("                        SubmittedDate");
                            Console.WriteLine("                                  {0}", reportRequestInfo.SubmittedDate);
                        }
                    }
                }

                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    var responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        Console.WriteLine("                RequestId");
                        Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }

                Console.WriteLine("            ResponseHeaderMetadata");
                Console.WriteLine("                RequestId");
                Console.WriteLine("                    " + response.ResponseHeaderMetadata.RequestId);
                Console.WriteLine("                ResponseContext");
                Console.WriteLine("                    " + response.ResponseHeaderMetadata.ResponseContext);
                Console.WriteLine("                Timestamp");
                Console.WriteLine("                    " + response.ResponseHeaderMetadata.Timestamp);
            }
            catch (MarketplaceWebServiceException ex)
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
                Console.WriteLine("ResponseHeaderMetadata: " + ex.ResponseHeaderMetadata);
            }
        }