Ejemplo n.º 1
0
        /// <summary>
        /// returns a list of feed submission identifiers and their associated metadata
        /// 
        /// </summary>
        /// <param name="service">Instance of MarketplaceWebService service</param>
        /// <param name="request">GetFeedSubmissionListRequest request</param>
        public static void InvokeGetFeedSubmissionList(MarketplaceWebService service, GetFeedSubmissionListRequest request)
        {
            try
            {
                GetFeedSubmissionListResponse response = service.GetFeedSubmissionList(request);

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

                Console.WriteLine("        GetFeedSubmissionListResponse");
                if (response.IsSetGetFeedSubmissionListResult())
                {
                    Console.WriteLine("            GetFeedSubmissionListResult");
                    GetFeedSubmissionListResult  getFeedSubmissionListResult = response.GetFeedSubmissionListResult;
                    if (getFeedSubmissionListResult.IsSetNextToken())
                    {
                        Console.WriteLine("                NextToken");
                        Console.WriteLine("                    {0}", getFeedSubmissionListResult.NextToken);
                    }
                    if (getFeedSubmissionListResult.IsSetHasNext())
                    {
                        Console.WriteLine("                HasNext");
                        Console.WriteLine("                    {0}", getFeedSubmissionListResult.HasNext);
                    }
                    List<FeedSubmissionInfo> feedSubmissionInfoList = getFeedSubmissionListResult.FeedSubmissionInfo;
                    foreach (FeedSubmissionInfo feedSubmissionInfo in feedSubmissionInfoList)
                    {
                        Console.WriteLine("                FeedSubmissionInfo");
                        if (feedSubmissionInfo.IsSetFeedSubmissionId())
                        {
                            Console.WriteLine("                    FeedSubmissionId");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.FeedSubmissionId);
                        }
                        if (feedSubmissionInfo.IsSetFeedType())
                        {
                            Console.WriteLine("                    FeedType");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.FeedType);
                        }
                        if (feedSubmissionInfo.IsSetSubmittedDate())
                        {
                            Console.WriteLine("                    SubmittedDate");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.SubmittedDate);
                        }
                        if (feedSubmissionInfo.IsSetFeedProcessingStatus())
                        {
                            Console.WriteLine("                    FeedProcessingStatus");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.FeedProcessingStatus);
                        }
                        if (feedSubmissionInfo.IsSetStartedProcessingDate())
                        {
                            Console.WriteLine("                    StartedProcessingDate");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.StartedProcessingDate);
                        }
                        if (feedSubmissionInfo.IsSetCompletedProcessingDate())
                        {
                            Console.WriteLine("                    CompletedProcessingDate");
                            Console.WriteLine("                        {0}", feedSubmissionInfo.CompletedProcessingDate);
                        }
                    }
                }
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata  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);
            }
        }
 /// <summary>
 /// Will continue to call GetFeedSubmissionList until it's completed or canceled
 /// </summary>
 /// <param name="feedSubmissionId">The feed submission id.</param>
 private void WaitForGetFeedSubmissionListToComplete(string feedSubmissionId)
 {
     GetFeedSubmissionListRequest submissionListRequest = new GetFeedSubmissionListRequest();
     submissionListRequest.Merchant = _MerchantId;
     submissionListRequest.FeedSubmissionIdList = new IdList() { Id = { feedSubmissionId } };
     GetFeedSubmissionListResponse submissionListResponse = null;
     // Pause for 5 seconds to give Amazon a little bit to try and process. Otherwise we have to wait 45 seconds.
     System.Threading.Thread.Sleep(5000);
     do
     {
         // Check to see if it's the first time it's been called.
         if (submissionListResponse != null)
             // If it's not finished yet, sleep for 45 seconds. This is the restore rate for GetFeedSubmissionList
             System.Threading.Thread.Sleep(45000);
         submissionListResponse = _AmazonClient.GetFeedSubmissionList(submissionListRequest);
     }
     while (!submissionListResponse.GetFeedSubmissionListResult.FeedSubmissionInfo.First().FeedProcessingStatus.Equals("_CANCELED_")
         && !submissionListResponse.GetFeedSubmissionListResult.FeedSubmissionInfo.First().FeedProcessingStatus.Equals("_DONE_"));
 }