ebay ordersAPI - Validation of the authentication token in API request failed
<p>I'm trying to intergrate ebay's <a href="http://developer.ebay.com/Devzone/XML/docs/Reference/eBay/GetOrders.html#Samples" rel="nofollow noreferrer">order API</a> with my application. I have used following code to perform that. </p>

<pre><code>public class Order {

    public static void getOrders() throws ApiException, SdkException, Exception {


        ApiContext apiContext = new ApiContext();
        ApiCredential cred = apiContext.getApiCredential();
        //Set Auth Token and server URL for sandbox
        cred.seteBayToken("v^1.1#i^1#r^0#p^1#I^3#f^0#t^H4sIAAAAAAAAAOVXa2wUVRTudreFggWJBuQRsw6GgM3MzmNnOzth124ppBX6gF0rrSi5M3OnHdmdGefedXcT1Fpj44+S+EPQCIYmFSNGDFETpUqC4SEJD43WKJGgCYFgNNWgEdRovLNdyrYqRVgNifNncs8599zvfOec+2B7Kqvu6mvsu1DtmVI+0MP2lHs83HS2qrKiZoa3fF5FGVtk4BnoubPH1+s9txSBVNKW10BkWyaC/mwqaSI5L4xQaceULYAMJJsgBZGMVTkea14l8wwr246FLdVKUv6mhggFQVjQFI7TVRUKYSlMpOYlnwkrQgVDgNd5EOYkDbKKWkv0CKVhk4kwMHGE4lkuRHM8zQsJTpQFSRY5JixKnZS/HTrIsExiwrBUNA9Xzs91irBeGSpACDqYOKGiTbEV8dZYU8PylsTSQJGvaIGHOAY4jcaPllka9LeDZBpeeRmUt5bjacIBQlQgOrrCeKdy7BKYa4CfpzqkhhRJ4SRWF2u5oCCWhMoVlpMC+Mo4XImh0XreVIYmNnBuMkYJG8pDUMWFUQtx0dTgd3+r0yBp6AZ0ItTy+lhHrK2NiuJu4CBgIhpDhOl4/Vo6FBR1CfCKRnNaWGI1LlRYZNRTgeIJqyyzTM1wCUP+FgvXQ4IYTuSFL+KFGLWarU5Mxy6aYrvaS/wFhU43oaMZTONu080pTBES/Pnh5OyPzcbYMZQ0hmMeJiry9EQoYNuGRk1U5uuwUDpZFKG6MbblQCCTyTAZgbGcrgDPslxgbfOquNoNU4Aq2Lq9nkXG5BNoIx+KCslMZMg4ZxMsWVKnBIDZRUV5kpLacIH38bCiE6V/EhTFHBjfDaXqDiCxnBgEUFcAK0JBKEV3RAsFGnBxQAXk6BRwNkBsJ4EKaZXUWToFHUOTBVHnBUmHtBYK63QwrOu0ImpkPR1CFkJFUcPS/6VJrrbMlyUNokyQMitZrZekzhsthKF2tXX+l6HFVcuGbVbSUHP/aWxur08an+BobcDBufp0jozjMJkkv+sKV81ncn0JN62SJPIf9Mu1xW0AfGNFzAUlXmRrRYG7vrjIJeaGiku1Uoy7/TIOsLHlMASanYSIcSCy0g65dDGt7mGcsDZAk2xv2LGSSei0Xx8LyG3iG4sHdz4iDoBtML4nducpIdwELECid6Xr86D9xXZ/ZxRQ0jmmK01agwDRoPMvHOyB8U+MaFn+43o9e9lezx7ySmFrWZqrYZdUeu/1eW+ikIEhya2pKVaWMYDOIKPLJDdoBzIbYM4GhlNe6Wk+3d/xeNHjZuAB9rax502Vl5te9NZhF1zWVHAz51RzIY7nBU4UJJHrZBde1vq42b5bX5n7yfKT9yx+8OfDvwpooV8ufy2UY6vHjDyeijJfr6fs5AtfPJWjz/3++vB737YE5w7/uPFMtmL+Las/bF1y980t/Ofvnm0Oex+7OLio7/v7vY8eGfKMVL/zzavH4vs736L3N7w5palCOc8PDfbs277i5Tlbl2w+kr19955mH9fwW/3qWReozqn6mQMXI/4PqnYE9rX3D7RWTkuxzvvPz59mHWgUN9UN9O5aMOT5VHp6+rrnziYC84JHZx6r6VJ/2LjjkQP9W0cursnsrGHve/hL9qftw90rB/teShyqnrXNfntl4+bM+V11ddtO8DuHvju+82DjicWnjo+88cuiur1TzcOZjs++GplR9uT+o8c+uuPgMxS/eHjBqY9Pv7hJaTx0/uuujnXPbpnd31I/ODx7NI1/AO3YK892DgAA");
        apiContext.setApiServerUrl("https://api.sandbox.ebay.com/wsapi");
        ApiLogging apiLogging = new ApiLogging();
        apiContext.setApiLogging(apiLogging);        

        // Set the site based on the seller - for UK sellers, set it to SiteCodeType.UK
        // for US, set to SiteCodeType.US
        apiContext.setSite(SiteCodeType.US); 

        // set detail level to ReturnAll
        DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[]{DetailLevelCodeType.RETURN_ALL};

        // define CreateTimeFrom and CreateTimeTo filters
        // set "To" to the current time 
        Calendar to = new GregorianCalendar(TimeZone.getTimeZone("GMT")).getInstance();         
        Calendar from = (GregorianCalendar) to.clone();

        // In this example we set "From" to 30 mins from current time - you need to set it to the last time you made the call
        from.add(to.MINUTE,-30);        

        GetOrdersCall getOrders = new GetOrdersCall(apiContext);
        getOrders.setDetailLevel(detailLevels);
        getOrders.setCreateTimeFrom(from);
        getOrders.setCreateTimeTo(to);

        OrderType[] orders = getOrders.getOrders();
        System.out.println("Finished " + orders.length);
    }
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        try {
            getOrders();
        } catch (ApiException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SdkException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}
</code></pre>

<p>I got the token using following way. </p>

<p>1) Register a test account with <a href="https://developer.ebay.com/devzone/guides/ebayfeatures/Basics/Call-SandboxTesting.html#CreatingaTestUser" rel="nofollow noreferrer">ebay sandbox</a></p>

<p>2) <a href="https://go.developer.ebay.com/" rel="nofollow noreferrer">Login</a> to ebay developer account</p>

<p>3) My user account > Auth tokens for ebay > Get oAuth ApplicationToken</p>

<p>When I copy that token to my program and executing I got this following exception. </p>

<pre><code>com.ebay.sdk.SdkSoapException: Validation of the authentication token in API request failed.
    at com.ebay.sdk.SdkSoapException.fromSOAPFaultException(Unknown Source)
    at com.ebay.sdk.ApiCall.executeByApiName(Unknown Source)
    at com.ebay.sdk.ApiCall.execute(Unknown Source)
    at com.ebay.sdk.call.GetOrdersCall.getOrders(GetOrdersCall.java:231)
    at ebayHelloWorld.Order.getOrders(Order.java:50)
    at ebayHelloWorld.Order.main(Order.java:56)
</code></pre>

<p>Could anybody please suggest me where I am making mistake here. Quicker responses more welcomed. Thanks</p>