我正在尝试制作一个小型应用程序,可以通过它的 ISBN 在亚马逊搜索一本书。我是亚马逊网络服务的新手。
我正在关注以下链接:
http://flyingpies.wordpress.com/2009/08/01/17/
http://flyingpies.wordpress.com/2009/08/13/signing-amazon-product-advertising-api-cwcf-part-2/
我的代码是:
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
binding.MaxReceivedMessageSize = int.MaxValue;
AWSECommerceServicePortTypeClient amazonClient = new AWSECommerceServicePortTypeClient(
binding, new EndpointAddress("https://webservices.amazon.com/onca/soap?Service=AWSECommerceService"));
amazonClient.ChannelFactory.Endpoint.Behaviors.Add(new AmazonSigningEndpointBehavior(AccessKeyId, SecretAccessKey));
ItemLookup lookup = new ItemLookup();
ItemLookupRequest request = new ItemLookupRequest();
request.IdType = ItemLookupRequestIdType.ISBN;
request.ItemId = new[] {"9780297870470"};
request.ResponseGroup = new[] { "OfferSummary" };
request.SearchIndex = "All";
request.IdTypeSpecified = true;
lookup.Request = new ItemLookupRequest[] { request };
lookup.AWSAccessKeyId = AccessKeyId;
lookup.AssociateTag = "wwwyaodaromane-90";
var response = amazonClient.ItemLookup(lookup);
当我尝试发送请求时,我得到了这个异常
序列化消息 ItemSearchRequest1 的正文时出错:'无法生成临时类(结果 = 1)。
错误 CS0030:无法将类型“Simple.Amazon.ECS.ImageSet[]”转换为“Simple.Amazon.ECS.ImageSet”
内部异常是:
{“无法生成临时类 (result=1)。\r\n错误 CS0030: 无法将类型 'Simple.Amazon.ECS.ImageSet[]' 转换为 'Simple.Amazon.ECS.ImageSet'\r\n错误 CS0029:无法将类型 'Simple.Amazon.ECS.ImageSet' 隐式转换为 'Simple.Amazon.ECS.ImageSet[]'\r\n"}
我不明白为什么我会得到这个。我做错了什么?