I can't seem to get even the most basic Ebay Api Call working. I'm trying to do the tutorial found here:
http://developer.ebay.com/DevZone/xml/docs/HowTo/FirstCall/MakingCallCSharp.html
However i keep getting an error that read:
"the type or namespace 'eBayAPIInterfaceService' could not be found(are you missing a using directive or assembly reference?)
(Using Visual Studio 2012)
I added the service reference http://developer.ebay.com/webservices/latest/ebaySvc.wsdl
I made sure to add the using statement. All other ebay Api objects are being recognized CustomSecurityHeaderType, GeteBayOfficialTimeRequestType and GeteBayOfficialTimeResponseType are not showing up as errors. Its seems to be only eBayAPIInterfaceService
I've searched for solutions to this problem and it seems like others have had this problem in the past however I can't find any solutions.
From what I can tell, this code should work:
eBayAPIInterfaceClient service = new eBayAPIInterfaceClient("eBayAPI");
// Set credentials
CustomSecurityHeaderType requesterCredentials = new CustomSecurityHeaderType();
requesterCredentials.eBayAuthToken = "yourToken"; // use your token
requesterCredentials.Credentials = new UserIdPasswordType();
requesterCredentials.Credentials.AppId = appId;
requesterCredentials.Credentials.DevId = devId;
requesterCredentials.Credentials.AuthCert = certId;
// Make the call to GeteBayOfficialTime
GeteBayOfficialTimeRequestType request = new GeteBayOfficialTimeRequestType();
request.Version = "405";
GeteBayOfficialTimeResponseType response = service.GeteBayOfficialTime(ref requesterCredentials, request);
Console.WriteLine("The time at eBay headquarters in San Jose, California, USA, is:");
Console.WriteLine(response.Timestamp);
I have no eBay API key or anything so I can't really test it.
If you found this page then you are looking in the wrong place for your API hello world example. There is a newer version of this example, this is how you find it:
Download and install eBayDotNET40sdk817.msi file from eBay (you need to do this anyway if you haven't already): https://go.developer.ebay.com/developers/ebay/documentation-tools/sdks/dotnet
Then you will have two example tutorials located on your hard drive here: C:\Program Files\eBay\eBay .NET SDK v817 Release\Tutorials\C#
The two tutorials are: Tutorial_HelloWorld.doc, Tutorial_ConsoleAddItem.doc
I tried the add-item tutorial and it worked great just by copying and pasting the code. I haven't tried the hello world tutorial but i can see that it is an updated version and doesn't use eBayAPIInterfaceClient or eBayAPIInterfaceService.
As a side note: the COM references you need to add to your project are located in C:\Program Files\eBay.
Finally, if you want the code in Sebastian's wonderful answer (above) to work, then don't forget to put requestURL where you instantiate eBayAPIInterfaceClient, like this:
eBayAPIInterfaceClient service = new eBayAPIInterfaceClient("eBayAPI", requestURL);
(I tried to edit his answer but it didn't work)
Good Luck! :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With