question

Bastie avatar image
0 Likes"
Bastie asked

HelloWorld Tutorial with No XML or was found in XML Request.

Environment: JavaSDK 825

Tutorial: HelloWorld with follow change

 

Replace

input = ConsoleUtil.readString("Enter your eBay Authentication Token: ");

cred.seteBayToken(input);

 

with

ApiCredential cred = apiContext.getApiCredential();

ApiAccount aa = new ApiAccount();

aa.setDeveloper ("..."); // Removed data at ... for post

aa.setApplication("..."); // Removed data at ... for post

aa.setCertificate("..."); // Removed data at ... for post

cred.setApiAccount(aa);

 

result:

Fail to get eBay official time. com.ebay.sdk.SdkSoapException: No XML or was found in XML Request.

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.GeteBayOfficialTimeCall.geteBayOfficialTime(GeteBayOfficialTimeCall.java:63)

 

 

 

Help, please!

Thanx

Java
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
zhuowei.developersupport@ebay.com avatar image
0 Likes"
zhuowei.developersupport@ebay.com answered

Hi real_bastie,

 

    eBay User token is required for making Trading API calls so adding this cred.seteBayToken() line back and specifying your token will fix the error :

 

private static ApiContext getApiContext() throws IOException {

 

        String TOKEN = "YOUR USER TOKEN";

 

        ApiContext apiContext = new ApiContext();

       

        ApiCredential cred = apiContext.getApiCredential();

        ApiAccount aa = new ApiAccount();

        aa.setDeveloper(""); // Removed data at ... for post

        aa.setApplication(""); // Removed data at ... for post

        aa.setCertificate(""); // Removed data at ... for post

        cred.setApiAccount(aa);

        

       //set Api Token to access eBay Api Server

        cred.seteBayToken("TOKEN");

 

        apiContext.setApiServerUrl("https://api.sandbox.ebay.com/wsapi");

 

        return apiContext;

    }

 

  You can refer to the following KB article for how to generate an user token:

Title: Steps to generate a new and renew user token

URL: https://ebaydts.com/eBayKBDetails?KBid=2018

 

Best Regards,

10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.