Home
Find the answer to your question
Exception based logging with .NET SDK
Exception based logging with .NET SDK
Summary
With .NET SDK version 485, you can now do logging conditionally.
You can log the SOAP request and response based on API Error Codes, SDK
Exceptions and / or Http Status codes.
/* © 2007-2014 eBay Inc., All Rights Reserved Licensed under CDDL 1.0 - http://opensource.org/licenses/cddl1.php */ //Create the API context object ApiContext context = new ApiContext(); //Set the Credentials context.ApiCredential.ApiAccount.Developer = 'devID'; context.ApiCredential.ApiAccount.Application = 'appID'; context.ApiCredential.ApiAccount.Certificate = 'certID'; context.ApiCredential.eBayToken = 'token'; //Set the URL //Set the version //Http Status Codes for logging Int32Collection httpCodes = new Int32Collection(); httpCodes.Add(404); httpCodes.Add(502); httpCodes.Add(500);
//Trigger Exceptions for logging TypeCollection exceptions = new TypeCollection(); exceptions.Add(typeof(System.Net.ProtocolViolationException)); exceptions.Add(typeof(System.InvalidOperationException));
ExceptionFilter exFilter = new ExceptionFilter(); exFilter.TriggerErrorCodes = errorCodes; exFilter.TriggerExceptions = exceptions; exFilter.TriggerHttpStatusCodes = httpCodes; // Set logging |
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 |