Exemple #1
0
 public GetProductCategoriesForASINResponse InvokeGetProductCategoriesForASIN(string sellerId, string mwsAuthToken, string marketplaceId, string asin, out APIResults results)
 {
     try
     {
         // Create a request.
         GetProductCategoriesForASINRequest request = new GetProductCategoriesForASINRequest();
         request.SellerId      = sellerId;
         request.MWSAuthToken  = mwsAuthToken;
         request.MarketplaceId = marketplaceId;
         request.ASIN          = asin;
         GetProductCategoriesForASINResponse output = this.productClient.GetProductCategoriesForASIN(request);
         results = new APIResults((IMWSResponse)output);
         return(output);
     }
     catch (MarketplaceWebServiceProductsException ex)
     {
         results = new APIResults(ex);
         throw ex;
     }
 }
Exemple #2
0
        /// <summary>
        /// Gets categories information for a product identified by
        /// the MarketplaceId and ASIN.
        ///
        /// </summary>
        /// <param name="service">Instance of MarketplaceWebServiceProducts service</param>
        /// <param name="request">GetProductCategoriesForASINRequest request</param>
        public static void InvokeGetProductCategoriesForASIN(MarketplaceWebServiceProducts service, GetProductCategoriesForASINRequest request)
        {
            try
            {
                GetProductCategoriesForASINResponse response = service.GetProductCategoriesForASIN(request);


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

                Console.WriteLine("        GetProductCategoriesForASINResponse");
                if (response.IsSetGetProductCategoriesForASINResult())
                {
                    Console.WriteLine("            GetProductCategoriesForASINResult");
                    GetProductCategoriesForASINResult getProductCategoriesForASINResult = response.GetProductCategoriesForASINResult;
                    List <Categories> selfList = getProductCategoriesForASINResult.Self;
                    foreach (Categories self in selfList)
                    {
                        Console.WriteLine("                Self");
                        if (self.IsSetProductCategoryId())
                        {
                            Console.WriteLine("                    ProductCategoryId");
                            Console.WriteLine("                        {0}", self.ProductCategoryId);
                        }
                        if (self.IsSetProductCategoryName())
                        {
                            Console.WriteLine("                    ProductCategoryName");
                            Console.WriteLine("                        {0}", self.ProductCategoryName);
                        }
                    }
                }
                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);
                Console.WriteLine();
            }
            catch (MarketplaceWebServiceProductsException 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);
            }
        }