我使用以下代码根据某些关键字
搜索项目using System;
using System.IO;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using ConsoleApplication1.EbayServiceReference;
using System.ServiceModel;
using System.ServiceModel.Channels;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
TextWriter tw = new StreamWriter("1001.txt");
using (FindingServicePortTypeClient client = new FindingServicePortTypeClient())
{
MessageHeader header = MessageHeader.CreateHeader("My-CustomHeader", "http://www.mycustomheader.com", "Custom Header");
using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
{
OperationContext.Current.OutgoingMessageHeaders.Add(header);
HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();
httpRequestProperty.Headers.Add("X-EBAY-SOA-SECURITY-APPNAME", "myappid");
httpRequestProperty.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "findItemsByKeywords");
httpRequestProperty.Headers.Add("X-EBAY-SOA-GLOBAL-ID", "EBAY-US");
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
FindItemsByKeywordsRequest request = new FindItemsByKeywordsRequest();
request.keywords = "gruen wristwatch parts -(sara,quartz,embassy,bob,robert,elephants,adidas)";
FindItemsByKeywordsResponse check = client.findItemsByKeywords(request);
int totalEntries = check.paginationOutput.totalEntries;
Console.WriteLine(totalEntries);
int totalPages = (int)Math.Ceiling((double)totalEntries / 100.00);
for (int curPage = 1; curPage <= totalPages; curPage++)
{
PaginationInput pagination = new PaginationInput();
pagination.entriesPerPageSpecified = true;
pagination.entriesPerPage = 100;
pagination.pageNumberSpecified = true;
pagination.pageNumber = curPage;
request.paginationInput = pagination;
FindItemsByKeywordsResponse response = client.findItemsByKeywords(request);
foreach (var item in response.searchResult.item)
{
Console.WriteLine(item.viewItemURL.ToString());
tw.WriteLine(item.viewItemURL.ToString());
}
}
}
}
tw.Close();
Console.WriteLine("end");
Console.ReadKey();
}
}
}
以下是原始关键字集
gruen腕表零件-sara -quartz -embassy -bob -robert -elephants -adidas
如果我使用此关键字设置,则返回3个项目。结果是here
我已根据此reference
将其格式化为在FindingAPI中使用gruen腕表零件 - (sara,quartz,embassy,bob,robert,elephants,adidas)
它返回13项。我认为它也应该返回3项。 我怎样才能解决这个错误?