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 IDstring devId = "DEVID"; // use your dev IDstring certId = "CERTID"; // use your cert IDstring endpoint = "https://api.sandbox.ebay.com/wsapi";string callName = "GetSearchResults";string siteId = "0";
string version = "437";// Build the request URLstring requestURL = endpoint+ "?callname=" + callName+ "&siteid=" + siteId+ "&appid=" + appId+ "&version=" + version+ "&amp;amp;routing=default";// Create the service
// Assign the request URL to the service locator.service.Url = requestURL; //"https://api.sandbox.ebay.com/wsapi";// Set credentialsservice.RequesterCredentials = new Ebay.CustomSecurityHeaderType();
service.RequesterCredentials.eBayAuthToken = "MY_TOKEN"; // use your tokenservice.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;req.DetailLevel = Ebay.DetailLevelCodeType.ReturnAll;
req.Version = version;
Ebay.GetSearchResultsResponseType resp = service.GetSearchResults(req);//Do some more stuff
About Me: Paul Kinlan
I lead the Chrome Developer Relations team at Google.
We want people to have the best experience possible on the web without
having to install a native app or produce content in a walled garden.
Our team tries to make it easier
for developers to build on the web by supporting every Chrome release, creating great content to support
developers on web.dev, contributing to MDN, helping to improve browser
compatibility, and some of the best
developer tools like Lighthouse, Workbox, Squoosh to name just a few.