Skip to main content
Published: November 26 2013, 3:04:00 PMUpdated: November 28 2020, 3:15:17 PM

I need to execute a request using the .NET SDK, but the call wrapper does not have a method with the parameters that I need to send in. How should I make the call?

Summary

All the SDK call wrapper classes derive from the ApiCall class which has a no argument Execute method.  You can use this to execute your request and pass in inputs by setting the properties of the call.  This is also the recommended way of executing requests using the SDK.


Detailed Description

Lets take the example that you want to make a call to GetCharites and pass in only Query as the input.  The SDK wrapper class GetCharitiesCall does not have a GetCharities method that takes just the Query as a parameter.  In this case, you can set the Query as a property of the GetCharitiesCall object and run the Execute method.  You can get the results of the response by accesssing the appropriate call property.

Here is a C# sample to demonstrate using the Execute method of the GetCharitiesCall class:
 

 /*
© 2007-2013 eBay Inc., All Rights Reserved
Licensed under CDDL 1.0 - http://opensource.org/licenses/cddl1.php
*/ 

 

using System;
using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Util;
using eBay.Service.Core.Soap;

namespace SDK3Examples
{

public class GetCharities
{
public void GetCharitiesUsingQuery(string query)
{
    GetCharitiesCall apicall = new GetCharitiesCall(GetContext());
    apicall.Query = query;
    apicall.Execute;
    // Get the Charity List
    CharityInfoTypeCollection charities = apicall.CharityList;
  }

    public ApiContext GetContext()
    {
       ApiContext context = new ApiContext();

  // Credentials for the call
  context.ApiCredential.ApiAccount.Developer = 'devID';
  context.ApiCredential.ApiAccount.Application = 'appID';
  context.ApiCredential.ApiAccount.Certificate = 'certID';
  context.ApiCredential.eBayToken = 'token';

  // Set the URL
  context.SoapApiServerUrl = 'https://api.sandbox.ebay.com/wsapi'; 

  // Set logging
  context.ApiLogManager = newApiLogManager();
  context.ApiLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger('Messages.log', true, true, true));
  context.ApiLogManager.EnableLogging = true;

  // Set the version
  context.Version = '485';

  return context;

    }

}

}


 


Version Info

The code example above was based on the versions specified below:

API Schema Version 485
.NET SDK Version .NET SDK v485.0 full release



Additional Resources

How well did this answer your question?
Answers others found helpful