AWS Product Advertising API ItemSearch错误请求

时间:2016-07-24 15:54:27

标签: c# amazon-web-services

我正在尝试使用亚马逊产品广告API。我确实在我的项目中添加了WDSL,但是当我发送请求时遇到了问题。它只是给出了错误的请求异常。

 try
        {
            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
            binding.MaxReceivedMessageSize = int.MaxValue;
            this.Proxy = new AWSECommerceServicePortTypeClient(
            binding,
            new EndpointAddress("https://webservices.amazon.com/onca/soap?Service=AWSECommerceService"));
            this.Proxy.ChannelFactory.Endpoint.Behaviors.Add(new AmazonSigningEndpointBehavior(accessKeyId, secretKey));
            this.ListOfResult = new List<string>();
            ItemSearchRequest request = new ItemSearchRequest();
            request.SearchIndex = "Books";
            request.Title = "WCF";
            request.ResponseGroup = new string[] { "Small" };

            ItemSearch itemSearch = new ItemSearch();
            itemSearch.Request = new ItemSearchRequest[] { request };
            itemSearch.AWSAccessKeyId = accessKeyId;
            itemSearch.AssociateTag = "-21";

            // issue the ItemSearch request
            ItemSearchResponse response = this.Proxy.ItemSearch(itemSearch);

            // write out the results
            foreach (var item in response.Items[0].Item)
            {
                this.ListOfResult.Add(item.ItemAttributes.Title);
            }
        }
        catch (System.Exception ex)
        {
            throw;
        }

0 个答案:

没有答案