Inheritance: MWSClientCsRuntime.AbstractMwsObject
コード例 #1
0
 public ListMatchingProductsResponse InvokeListMatchingProducts()
 {
     // Create a request.
     ListMatchingProductsRequest request = new ListMatchingProductsRequest();
     string sellerId = "example";
     request.SellerId = sellerId;
     string mwsAuthToken = "example";
     request.MWSAuthToken = mwsAuthToken;
     string marketplaceId = "example";
     request.MarketplaceId = marketplaceId;
     string query = "example";
     request.Query = query;
     string queryContextId = "example";
     request.QueryContextId = queryContextId;
     return this.client.ListMatchingProducts(request);
 }
コード例 #2
0
        /// <summary>
        /// ListMatchingProducts can be used to
        /// find products that match the given criteria.
        /// 
        /// </summary>
        /// <param name="service">Instance of MarketplaceWebServiceProducts service</param>
        /// <param name="request">ListMatchingProductsRequest request</param>
        public static void InvokeListMatchingProducts(MarketplaceWebServiceProducts service, ListMatchingProductsRequest request)
        {
            try
            {
                ListMatchingProductsResponse response = service.ListMatchingProducts(request);

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

                Console.WriteLine("        ListMatchingProductsResponse");
                if (response.IsSetListMatchingProductsResult())
                {
                    Console.WriteLine("            ListMatchingProductsResult");
                    ListMatchingProductsResult  listMatchingProductsResult = response.ListMatchingProductsResult;
                    if (listMatchingProductsResult.IsSetProducts())
                    {
                        Console.WriteLine("                Products");
                        ProductList  products = listMatchingProductsResult.Products;
                        List<Product> productList = products.Product;
                        foreach (Product product in productList)
                        {
                            Console.WriteLine("                    Product");
                            if (product.IsSetIdentifiers())
                            {
                                Console.WriteLine("                        Identifiers");
                                IdentifierType  identifiers = product.Identifiers;
                                if (identifiers.IsSetMarketplaceASIN())
                                {
                                    Console.WriteLine("                            MarketplaceASIN");
                                    ASINIdentifier  marketplaceASIN = identifiers.MarketplaceASIN;
                                    if (marketplaceASIN.IsSetMarketplaceId())
                                    {
                                        Console.WriteLine("                                MarketplaceId");
                                        Console.WriteLine("                                    {0}", marketplaceASIN.MarketplaceId);
                                    }
                                    if (marketplaceASIN.IsSetASIN())
                                    {
                                        Console.WriteLine("                                ASIN");
                                        Console.WriteLine("                                    {0}", marketplaceASIN.ASIN);
                                    }
                                }
                                if (identifiers.IsSetSKUIdentifier())
                                {
                                    Console.WriteLine("                            SKUIdentifier");
                                    SellerSKUIdentifier  SKUIdentifier = identifiers.SKUIdentifier;
                                    if (SKUIdentifier.IsSetMarketplaceId())
                                    {
                                        Console.WriteLine("                                MarketplaceId");
                                        Console.WriteLine("                                    {0}", SKUIdentifier.MarketplaceId);
                                    }
                                    if (SKUIdentifier.IsSetSellerId())
                                    {
                                        Console.WriteLine("                                SellerId");
                                        Console.WriteLine("                                    {0}", SKUIdentifier.SellerId);
                                    }
                                    if (SKUIdentifier.IsSetSellerSKU())
                                    {
                                        Console.WriteLine("                                SellerSKU");
                                        Console.WriteLine("                                    {0}", SKUIdentifier.SellerSKU);
                                    }
                                }
                            }
                            if (product.IsSetAttributeSets())
                            {
                                Console.WriteLine("                                Attributes");
                                foreach (var attribute in product.AttributeSets.Any)
                                {
                                    Console.WriteLine(ProductsUtil.FormatXml((System.Xml.XmlElement)attribute));
                                }
                            }
                            if (product.IsSetRelationships())
                            {
                                Console.WriteLine(string.Empty);
                                Console.WriteLine("                                Relationships");
                                foreach (var relationship in product.Relationships.Any)
                                {
                                    Console.WriteLine(ProductsUtil.FormatXml((System.Xml.XmlElement)relationship));
                                }
                            }
                            if (product.IsSetCompetitivePricing())
                            {
                                Console.WriteLine("                        CompetitivePricing");
                                CompetitivePricingType  competitivePricing = product.CompetitivePricing;
                                if (competitivePricing.IsSetCompetitivePrices())
                                {
                                    Console.WriteLine("                            CompetitivePrices");
                                    CompetitivePriceList  competitivePrices = competitivePricing.CompetitivePrices;
                                    List<CompetitivePriceType> competitivePriceList = competitivePrices.CompetitivePrice;
                                    foreach (CompetitivePriceType competitivePrice in competitivePriceList)
                                    {
                                        Console.WriteLine("                                CompetitivePrice");
                                    if (competitivePrice.IsSetcondition()) {
                                        Console.WriteLine("                            condition");
                                        Console.WriteLine();
                                        Console.WriteLine("                                    {0}",  competitivePrice.condition);
                                        Console.WriteLine();
                                    }
                                    if (competitivePrice.IsSetsubcondition()) {
                                        Console.WriteLine("                            subcondition");
                                        Console.WriteLine();
                                        Console.WriteLine("                                    {0}",  competitivePrice.subcondition);
                                        Console.WriteLine();
                                    }
                                    if (competitivePrice.IsSetbelongsToRequester()) {
                                        Console.WriteLine("                            belongsToRequester");
                                        Console.WriteLine();
                                        Console.WriteLine("                                    {0}",  competitivePrice.belongsToRequester);
                                        Console.WriteLine();
                                    }
                                        if (competitivePrice.IsSetCompetitivePriceId())
                                        {
                                            Console.WriteLine("                                    CompetitivePriceId");
                                            Console.WriteLine("                                        {0}", competitivePrice.CompetitivePriceId);
                                        }
                                        if (competitivePrice.IsSetPrice())
                                        {
                                            Console.WriteLine("                                    Price");
                                            PriceType  price = competitivePrice.Price;
                                            if (price.IsSetLandedPrice())
                                            {
                                                Console.WriteLine("                                        LandedPrice");
                                                MoneyType  landedPrice = price.LandedPrice;
                                                if (landedPrice.IsSetCurrencyCode())
                                                {
                                                    Console.WriteLine("                                            CurrencyCode");
                                                    Console.WriteLine("                                                {0}", landedPrice.CurrencyCode);
                                                }
                                                if (landedPrice.IsSetAmount())
                                                {
                                                    Console.WriteLine("                                            Amount");
                                                    Console.WriteLine("                                                {0}", landedPrice.Amount);
                                                }
                                            }
                                            if (price.IsSetListingPrice())
                                            {
                                                Console.WriteLine("                                        ListingPrice");
                                                MoneyType  listingPrice = price.ListingPrice;
                                                if (listingPrice.IsSetCurrencyCode())
                                                {
                                                    Console.WriteLine("                                            CurrencyCode");
                                                    Console.WriteLine("                                                {0}", listingPrice.CurrencyCode);
                                                }
                                                if (listingPrice.IsSetAmount())
                                                {
                                                    Console.WriteLine("                                            Amount");
                                                    Console.WriteLine("                                                {0}", listingPrice.Amount);
                                                }
                                            }
                                            if (price.IsSetShipping())
                                            {
                                                Console.WriteLine("                                        Shipping");
                                                MoneyType  shipping = price.Shipping;
                                                if (shipping.IsSetCurrencyCode())
                                                {
                                                    Console.WriteLine("                                            CurrencyCode");
                                                    Console.WriteLine("                                                {0}", shipping.CurrencyCode);
                                                }
                                                if (shipping.IsSetAmount())
                                                {
                                                    Console.WriteLine("                                            Amount");
                                                    Console.WriteLine("                                                {0}", shipping.Amount);
                                                }
                                            }
                                        }
                                    }
                                }
                                if (competitivePricing.IsSetNumberOfOfferListings())
                                {
                                    Console.WriteLine("                            NumberOfOfferListings");
                                    NumberOfOfferListingsList  numberOfOfferListings = competitivePricing.NumberOfOfferListings;
                                    List<OfferListingCountType> offerListingCountList = numberOfOfferListings.OfferListingCount;
                                    foreach (OfferListingCountType offerListingCount in offerListingCountList)
                                    {
                                        Console.WriteLine("                                OfferListingCount");
                                    if (offerListingCount.IsSetcondition()) {
                                        Console.WriteLine("                            condition");
                                        Console.WriteLine();
                                        Console.WriteLine("                                    {0}",  offerListingCount.condition);
                                        Console.WriteLine();
                                    }
                                    if (offerListingCount.IsSetValue()) {
                                        Console.WriteLine("                            Value");
                                        Console.WriteLine();
                                        Console.WriteLine("                                    {0}",  offerListingCount.Value);
                                    }
                                    }
                                }
                                if (competitivePricing.IsSetTradeInValue())
                                {
                                    Console.WriteLine("                            TradeInValue");
                                    MoneyType  tradeInValue = competitivePricing.TradeInValue;
                                    if (tradeInValue.IsSetCurrencyCode())
                                    {
                                        Console.WriteLine("                                CurrencyCode");
                                        Console.WriteLine("                                    {0}", tradeInValue.CurrencyCode);
                                    }
                                    if (tradeInValue.IsSetAmount())
                                    {
                                        Console.WriteLine("                                Amount");
                                        Console.WriteLine("                                    {0}", tradeInValue.Amount);
                                    }
                                }
                            }
                            if (product.IsSetSalesRankings())
                            {
                                Console.WriteLine("                        SalesRankings");
                                SalesRankList  salesRankings = product.SalesRankings;
                                List<SalesRankType> salesRankList = salesRankings.SalesRank;
                                foreach (SalesRankType salesRank in salesRankList)
                                {
                                    Console.WriteLine("                            SalesRank");
                                    if (salesRank.IsSetProductCategoryId())
                                    {
                                        Console.WriteLine("                                ProductCategoryId");
                                        Console.WriteLine("                                    {0}", salesRank.ProductCategoryId);
                                    }
                                    if (salesRank.IsSetRank())
                                    {
                                        Console.WriteLine("                                Rank");
                                        Console.WriteLine("                                    {0}", salesRank.Rank);
                                    }
                                }
                            }
                            if (product.IsSetLowestOfferListings())
                            {
                                Console.WriteLine("                        LowestOfferListings");
                                LowestOfferListingList  lowestOfferListings = product.LowestOfferListings;
                                List<LowestOfferListingType> lowestOfferListingList = lowestOfferListings.LowestOfferListing;
                                foreach (LowestOfferListingType lowestOfferListing in lowestOfferListingList)
                                {
                                    Console.WriteLine("                            LowestOfferListing");
                                    if (lowestOfferListing.IsSetQualifiers())
                                    {
                                        Console.WriteLine("                                Qualifiers");
                                        QualifiersType  qualifiers = lowestOfferListing.Qualifiers;
                                        if (qualifiers.IsSetItemCondition())
                                        {
                                            Console.WriteLine("                                    ItemCondition");
                                            Console.WriteLine("                                        {0}", qualifiers.ItemCondition);
                                        }
                                        if (qualifiers.IsSetItemSubcondition())
                                        {
                                            Console.WriteLine("                                    ItemSubcondition");
                                            Console.WriteLine("                                        {0}", qualifiers.ItemSubcondition);
                                        }
                                        if (qualifiers.IsSetFulfillmentChannel())
                                        {
                                            Console.WriteLine("                                    FulfillmentChannel");
                                            Console.WriteLine("                                        {0}", qualifiers.FulfillmentChannel);
                                        }
                                        if (qualifiers.IsSetShipsDomestically())
                                        {
                                            Console.WriteLine("                                    ShipsDomestically");
                                            Console.WriteLine("                                        {0}", qualifiers.ShipsDomestically);
                                        }
                                        if (qualifiers.IsSetShippingTime())
                                        {
                                            Console.WriteLine("                                    ShippingTime");
                                            ShippingTimeType  shippingTime = qualifiers.ShippingTime;
                                            if (shippingTime.IsSetMax())
                                            {
                                                Console.WriteLine("                                        Max");
                                                Console.WriteLine("                                            {0}", shippingTime.Max);
                                            }
                                        }
                                        if (qualifiers.IsSetSellerPositiveFeedbackRating())
                                        {
                                            Console.WriteLine("                                    SellerPositiveFeedbackRating");
                                            Console.WriteLine("                                        {0}", qualifiers.SellerPositiveFeedbackRating);
                                        }
                                    }
                                    if (lowestOfferListing.IsSetNumberOfOfferListingsConsidered())
                                    {
                                        Console.WriteLine("                                NumberOfOfferListingsConsidered");
                                        Console.WriteLine("                                    {0}", lowestOfferListing.NumberOfOfferListingsConsidered);
                                    }
                                    if (lowestOfferListing.IsSetSellerFeedbackCount())
                                    {
                                        Console.WriteLine("                                SellerFeedbackCount");
                                        Console.WriteLine("                                    {0}", lowestOfferListing.SellerFeedbackCount);
                                    }
                                    if (lowestOfferListing.IsSetPrice())
                                    {
                                        Console.WriteLine("                                Price");
                                        PriceType  price1 = lowestOfferListing.Price;
                                        if (price1.IsSetLandedPrice())
                                        {
                                            Console.WriteLine("                                    LandedPrice");
                                            MoneyType  landedPrice1 = price1.LandedPrice;
                                            if (landedPrice1.IsSetCurrencyCode())
                                            {
                                                Console.WriteLine("                                        CurrencyCode");
                                                Console.WriteLine("                                            {0}", landedPrice1.CurrencyCode);
                                            }
                                            if (landedPrice1.IsSetAmount())
                                            {
                                                Console.WriteLine("                                        Amount");
                                                Console.WriteLine("                                            {0}", landedPrice1.Amount);
                                            }
                                        }
                                        if (price1.IsSetListingPrice())
                                        {
                                            Console.WriteLine("                                    ListingPrice");
                                            MoneyType  listingPrice1 = price1.ListingPrice;
                                            if (listingPrice1.IsSetCurrencyCode())
                                            {
                                                Console.WriteLine("                                        CurrencyCode");
                                                Console.WriteLine("                                            {0}", listingPrice1.CurrencyCode);
                                            }
                                            if (listingPrice1.IsSetAmount())
                                            {
                                                Console.WriteLine("                                        Amount");
                                                Console.WriteLine("                                            {0}", listingPrice1.Amount);
                                            }
                                        }
                                        if (price1.IsSetShipping())
                                        {
                                            Console.WriteLine("                                    Shipping");
                                            MoneyType  shipping1 = price1.Shipping;
                                            if (shipping1.IsSetCurrencyCode())
                                            {
                                                Console.WriteLine("                                        CurrencyCode");
                                                Console.WriteLine("                                            {0}", shipping1.CurrencyCode);
                                            }
                                            if (shipping1.IsSetAmount())
                                            {
                                                Console.WriteLine("                                        Amount");
                                                Console.WriteLine("                                            {0}", shipping1.Amount);
                                            }
                                        }
                                    }
                                    if (lowestOfferListing.IsSetMultipleOffersAtLowestPrice())
                                    {
                                        Console.WriteLine("                                MultipleOffersAtLowestPrice");
                                        Console.WriteLine("                                    {0}", lowestOfferListing.MultipleOffersAtLowestPrice);
                                    }
                                }
                            }
                            if (product.IsSetOffers())
                            {
                                Console.WriteLine("                        Offers");
                                OffersList  offers = product.Offers;
                                List<OfferType> offerList = offers.Offer;
                                foreach (OfferType offer in offerList)
                                {
                                    Console.WriteLine("                            Offer");
                                    if (offer.IsSetBuyingPrice())
                                    {
                                        Console.WriteLine("                                BuyingPrice");
                                        PriceType  buyingPrice = offer.BuyingPrice;
                                        if (buyingPrice.IsSetLandedPrice())
                                        {
                                            Console.WriteLine("                                    LandedPrice");
                                            MoneyType  landedPrice2 = buyingPrice.LandedPrice;
                                            if (landedPrice2.IsSetCurrencyCode())
                                            {
                                                Console.WriteLine("                                        CurrencyCode");
                                                Console.WriteLine("                                            {0}", landedPrice2.CurrencyCode);
                                            }
                                            if (landedPrice2.IsSetAmount())
                                            {
                                                Console.WriteLine("                                        Amount");
                                                Console.WriteLine("                                            {0}", landedPrice2.Amount);
                                            }
                                        }
                                        if (buyingPrice.IsSetListingPrice())
                                        {
                                            Console.WriteLine("                                    ListingPrice");
                                            MoneyType  listingPrice2 = buyingPrice.ListingPrice;
                                            if (listingPrice2.IsSetCurrencyCode())
                                            {
                                                Console.WriteLine("                                        CurrencyCode");
                                                Console.WriteLine("                                            {0}", listingPrice2.CurrencyCode);
                                            }
                                            if (listingPrice2.IsSetAmount())
                                            {
                                                Console.WriteLine("                                        Amount");
                                                Console.WriteLine("                                            {0}", listingPrice2.Amount);
                                            }
                                        }
                                        if (buyingPrice.IsSetShipping())
                                        {
                                            Console.WriteLine("                                    Shipping");
                                            MoneyType  shipping2 = buyingPrice.Shipping;
                                            if (shipping2.IsSetCurrencyCode())
                                            {
                                                Console.WriteLine("                                        CurrencyCode");
                                                Console.WriteLine("                                            {0}", shipping2.CurrencyCode);
                                            }
                                            if (shipping2.IsSetAmount())
                                            {
                                                Console.WriteLine("                                        Amount");
                                                Console.WriteLine("                                            {0}", shipping2.Amount);
                                            }
                                        }
                                    }
                                    if (offer.IsSetRegularPrice())
                                    {
                                        Console.WriteLine("                                RegularPrice");
                                        MoneyType  regularPrice = offer.RegularPrice;
                                        if (regularPrice.IsSetCurrencyCode())
                                        {
                                            Console.WriteLine("                                    CurrencyCode");
                                            Console.WriteLine("                                        {0}", regularPrice.CurrencyCode);
                                        }
                                        if (regularPrice.IsSetAmount())
                                        {
                                            Console.WriteLine("                                    Amount");
                                            Console.WriteLine("                                        {0}", regularPrice.Amount);
                                        }
                                    }
                                    if (offer.IsSetFulfillmentChannel())
                                    {
                                        Console.WriteLine("                                FulfillmentChannel");
                                        Console.WriteLine("                                    {0}", offer.FulfillmentChannel);
                                    }
                                    if (offer.IsSetItemCondition())
                                    {
                                        Console.WriteLine("                                ItemCondition");
                                        Console.WriteLine("                                    {0}", offer.ItemCondition);
                                    }
                                    if (offer.IsSetItemSubCondition())
                                    {
                                        Console.WriteLine("                                ItemSubCondition");
                                        Console.WriteLine("                                    {0}", offer.ItemSubCondition);
                                    }
                                    if (offer.IsSetSellerId())
                                    {
                                        Console.WriteLine("                                SellerId");
                                        Console.WriteLine("                                    {0}", offer.SellerId);
                                    }
                                    if (offer.IsSetSellerSKU())
                                    {
                                        Console.WriteLine("                                SellerSKU");
                                        Console.WriteLine("                                    {0}", offer.SellerSKU);
                                    }
                                }
                            }
                        }
                    }
                }
                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);
            }
        }
コード例 #3
0
        /// <summary>
        /// Get ListMatching Products
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnListMatchingSearch_Click(object sender, RoutedEventArgs e)
        {
            string SellerId = CommonValue.strMerchantId;
            string MarketplaceId = CommonValue.strMarketplaceId;
            string AccessKeyId = CommonValue.strAccessKeyId;
            string SecretKeyId = CommonValue.strSecretKeyId;
            string ApplicationVersion = CommonValue.strApplicationVersion;
            string ApplicationName = CommonValue.strApplicationName;
            string MWSAuthToken = CommonValue.strMWSAuthToken;
            string strbuff = string.Empty;

            MarketplaceWebServiceProductsConfig config = new MarketplaceWebServiceProductsConfig();
            config.ServiceURL = CommonValue.strServiceURL;

            MarketplaceWebServiceProductsClient client = new MarketplaceWebServiceProductsClient(
                                                             ApplicationName,
                                                             ApplicationVersion,
                                                             AccessKeyId,
                                                             SecretKeyId,
                                                             config);

            ListMatchingProductsRequest request = new ListMatchingProductsRequest();

            request.SellerId = SellerId;
            request.MWSAuthToken = MWSAuthToken;
            request.MarketplaceId = MarketplaceId;
            request.Query = txtListMatchingSearchValue.Text.ToString().Trim();

            ListMatchingProductsResponse response = client.ListMatchingProducts(request);
            if (response.IsSetListMatchingProductsResult())
            {
                ListMatchingProductsResult ListMatchingProductsResult = response.ListMatchingProductsResult;
                if (ListMatchingProductsResult.IsSetProducts())
                {
                    ProductList productList = ListMatchingProductsResult.Products;
                    List<Product> products = productList.Product;
                    foreach (Product product in products)
                    {
                        System.Xml.XmlElement elements = (System.Xml.XmlElement)product.AttributeSets.Any[0];

                        foreach (System.Xml.XmlElement element in elements)
                        {
                            switch (element.LocalName)
                            {
                                case "Title":
                                    strbuff += element.InnerText + System.Environment.NewLine;
                                    break;
                                default:
                                    break;
                            }
                        }

                    }
                    txtListMatchingResult.Text = strbuff;
                }
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: swapnilraut-ww/ECoupoun
 public ListMatchingProductsResponse ListMatchingProducts(ListMatchingProductsRequest request)
 {
     throw new NotImplementedException();
 }