4
votes

I recently looked into Amazon MWS and wanted to develop for it. I do have a seller account and downloaded the the given files for java. I included all the .jars and opened the ListOrderItemsSample.java. There I set the sellerId, mwsAuthTokenand an amazonOrderId. Looking further into the code I also copied the MarketplaceWebServiceOrdersSampleConfig.javainto my project and set all the necessary Strings there. I did not change anything else. The problem is in runtime the program throws an exception.

Following the console output, where Test.java the ListOrderItemsSample.javafile is:

Service Exception:Exception in thread "main" 
Message: null
StatusCode: 0
ErrorCode: null
ErrorType: null
com.amazonservices.mws.orders._2013_09_01.MarketplaceWebServiceOrdersException
    at com.amazonservices.mws.orders._2013_09_01.MarketplaceWebServiceOrdersClient$RequestType.wrapException(MarketplaceWebServiceOrdersClient.java:143)
    at com.amazonservices.mws.client.MwsConnection.call(MwsConnection.java:429)
    at com.amazonservices.mws.orders._2013_09_01.MarketplaceWebServiceOrdersClient.listOrderItems(MarketplaceWebServiceOrdersClient.java:75)
    at Test.invokeListOrderItems(Test.java:44)
    at Test.main(Test.java:89)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1967)
    at com.amazonservices.mws.client.MwsConnection$ServiceEndpoint.<init>(MwsConnection.java:102)
    at com.amazonservices.mws.client.MwsConnection.getServiceEndpoint(MwsConnection.java:398)
    at com.amazonservices.mws.client.MwsConnection.newCall(MwsConnection.java:687)
    at com.amazonservices.mws.client.MwsConnection.call(MwsConnection.java:420)
    ... 3 more

Did I miss to set anything or what is wrong in my code? Hope you can help me out.

1

1 Answers

1
votes

It's hard to definitively say without seeing your config but it sounds like you didn't set all of the required parameters.

For the orders API, it's required that you set the seller id, access key id, secret key and order id.

I'd use the MWS Scratchpad to get an idea of what the required request parameters are for each API.