For full functionality of this site it is necessary to enable JavaScript.
Here are the instructions how to enable JavaScript in your web browser.

Knowledge base

Find the answer to your question

Advanced Search PView

Search terms
Search Type
Sort by

Finding API - C#.NET code sample to call Finding API using .NET framework 4.

  • Answer ID 1762
  • Published 01/11/2011 04:26 AM
  • Updated 10/20/2013 06:42 AM
  • Permalink

How to call FindingService API from .Net Framework 4.

  1. Add a service reference to the Finding API definition file (please use the latest version of the WSDL file)

  2. Create an object for FindingServicePortTypeClient class –

FindingServicePortTypeClient client = new FindingServicePortTypeClient()

  1. Create an object for the required request type.
       FindItemsByKeywordsRequest request = new FindItemsByKeywordsRequest();  
  2. Provide value for the required properties.
        request. keywords = “canon”; // for example 
  3. Create an object to the required response type. For example,
       FindItemsByKeywordsResponse response = service.findItemsByKeywords(request);  
  4. Explore the response object for response data.
  5. Increasing the maxBufferSize and maxReceivedMessageSize in the App.Config file to 655360

The following is the code sample for findItemsByKeywords API call using C#.NET framework 4.

Code in the Program.cs file


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using DOTNET4_FindingService_Sample.FindingServiceWebReference;

using System.ServiceModel.Channels;

using System.ServiceModel;


namespace DOTNET4_FindingService_Sample


    class Program


        static void Main(string[] args)


            using (FindingServicePortTypeClient client = new FindingServicePortTypeClient())


                MessageHeader header = MessageHeader.CreateHeader("CustomHeader", "", "");

                using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))




                    HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();

                    httpRequestProperty.Headers.Add("X-EBAY-SOA-SECURITY-APPNAME", "YOUR_APP_ID_HERE");

                    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 = "canon";

                    FindItemsByKeywordsResponse response = client.findItemsByKeywords(request);

                    foreach (var item in response.searchResult.item)














<?xml version="1.0" encoding="utf-8" ?>





                <binding name="FindingServiceSOAPBinding" closeTimeout="00:01:00"

                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

                    maxBufferSize="655360" maxBufferPoolSize="524288" maxReceivedMessageSize="655360"

                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"


                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />

                    <security mode="Transport">

                        <transport clientCredentialType="None" proxyCredentialType="None"

                            realm="" />

                        <message clientCredentialType="UserName" algorithmSuite="Default" />






            <endpoint address=""

                binding="basicHttpBinding" bindingConfiguration="FindingServiceSOAPBinding"


                name="FindingServiceSOAPPort" />














How well did this answer your question?

Answers others found helpful

Print Email This Page Delicious Digg Facebook Reddit StumbleUpon Twitter