Google Search: ebay asp.net api soap wsdl [part deux]

Paul Kinlan

Just following on from one of my previous post about using SOAP requests from ASP.Net to access Ebay.

I have finally worked out [it wasn’t hard in the end] how to do it.

A few things that I had problems with were:

  • Most of the request REQUIRE the version attribute to be set
  • The DetailLevel attribute must be set on some request to enable you to
  • A Authentication Token is required to send request to Ebay. The Authentication token is used so that the user doesn’t need to give their user name and password credentials away to the program. The auth token seems to be a cryptographic hash.
  • If you are using the WSDL url, you must also provide query string parameters so that Ebay know what to do with the request. [http://developer.ebay.com/DevZone/SOAP/docs/WebHelp/wwhelp/wwhimpl/js/html/wwhelp.htm]

The Code Follows:


Ebay.eBayAPIInterfaceService service = new Ebay.eBayAPIInterfaceService();
string appId = “APPID”; // use your app ID
string devId = “DEVID”; // use your dev ID
string certId = “CERTID”; // use your cert ID
string endpoint = “https://api.sandbox.ebay.com/wsapi";
string callName = “GetSearchResults”;
string siteId = “0”;

string version = “437”;
// Build the request URL
string requestURL = endpoint
+ “?callname=” + callName
+ “&siteid=” + siteId
+ “&appid=” + appId
+ “&version=” + version
+ “&routing=default”;
// Create the service

// Assign the request URL to the service locator.
service.Url = requestURL; //“https://api.sandbox.ebay.com/wsapi";
// Set credentials
service.RequesterCredentials = new Ebay.CustomSecurityHeaderType();

service.RequesterCredentials.eBayAuthToken = “MY_TOKEN”; // use your token
service.RequesterCredentials.Credentials = new Ebay.UserIdPasswordType();

service.RequesterCredentials.Credentials.AppId = appId;
service.RequesterCredentials.Credentials.DevId = devId;
service.RequesterCredentials.Credentials.AuthCert = certId;

Ebay.GetSearchResultsRequestType req = new Ebay.GetSearchResultsRequestType();

req.Query = “SSX”;
req.DetailLevel = new Ebay_Test.com.ebay.developer.DetailLevelCodeType[1];
req.DetailLevel[0] = Ebay.DetailLevelCodeType.ReturnAll;

req.Version = version;

Ebay.GetSearchResultsResponseType resp = service.GetSearchResults(req);
//Do some more stuff

Paul Kinlan

Trying to make the web and developers better.

RSS Github Medium