Skip to main content
Published: September 05 2006, 1:06:00 PMUpdated: June 13 2024, 10:52:43 AM

I am getting an SdkException with ErrorCode 931 in API response. How do I get hold of the returned ErrorCode programmatically?

Detail Description

   In the JAVA SDK framework, exceptions caught in the header of the eBay API SOAP request are mapped to SdkSoapException, which is extended from SdkException.  

   Note that API request Auth&Auth token is passed in the the SOAP header in your SOAP API request.

   You can get hold of the error message and error code from the exception class captured in your try/catch block as below. The sample code snippet also retrieves an ErrorType array in the case of ApiException, as api request errors are returned in an error container that holds the API error array.
       try{

          .....
       }catch (Exception e) { 
              if ( e instanceof SdkSoapException ) {
                   SdkSoapException sdkSoapExe = (SdkSoapException)e;   
                   ErrorType error = sdkSoapExe.getErrorType();
                      System.out.println("error code: " + error.getErrorCode() + ", error shot message :" + error.getShortMessage());
              }
              if (e instanceof ApiException) {
                    ApiException apiExe = (ApiException) e;
                    ErrorType[] errs = apiExe.getErrors();
                    for (ErrorType error : errs) {
                        System.out.println("error code " + error.getErrorCode() + "error shot message" + error.getShortMessage());
                   }
             }

      }

 

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

Got thoughts? Click the feedback button – your insights help us improve!