Skip to main content
Published: November 11 2013, 11:40:00 AMUpdated: July 24 2022, 2:31:29 PM

How to set retries using JAVA SDK framework?

Access to any web service can be bumpy at times (networking issues for example), so how to handle error and act upon them is very important.

There are two types of errors when communicating with the eBay API Web Service: Infrastructure Errors and Application errors.
Infrastructure errors are either caused by the client application or the eBay API server. Both server faults and client faults are wrapped in SdkSoapException in the eBay SDK JAVA framework.

Infrastructure Errors
A. Server faults : Retry three times when a Server fault is encountered
- (500)Internal Server Error
- A database connection error occurred
- org.xml.sax.SAXParseException: Premature end of file
- (502)Proxy Error
- Read timed out

B. Client faults: Retry three times when a client fault is encountered. Verify the data in your request if the request still fails after three retries.
- Request authentication failures ( Error 931).

Application errors are wrapped in ApiException in JAVA SDK.
- Do not retry if request contains an invalid combination of fields.
- Do not retry if a required field is missing in the request.
- Do retry three times if API server returns 10007 error (“Internal error to the application”) and report the incident via Premium Support.

The SDKs makes it very simple to implement retry for a call. Instantiate an object of the CallRetry class, set the number of retries and the retry time interval, and register the exception classes and error codes for which you want to retry. Retry will be executed if either condition is met.

// Instantiate new CallRetry object and set properties.
CallRetry callretry = new CallRetry();

// Register API Error Codes
Token[] apiErrorCodes = new Token[] {
new Token('10007'),
new Token('')};

// Register exception classes
java.lang.Class[] tcs = new java.lang.Class[] {
        com.ebay.sdk.SdkSoapException.class };

// Register retry object with Api context

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