Connecting to Amazon Marketplace Web Services

I'm having some trouble making a connection to the Amazon MWS service. I have not followed the API documentation contained in the samples document with no luck. The samples are working independently. The following code is the same in the samples as well as in my code:

I put in the passkey, merchant ID, etc. inside the code like this (I actually specified my ID):

String accessKeyId = "<Your Access Key Id>";
String secretAccessKey = "<Your Secret Access Key>";
String merchantId = "<Your Merchant Id>";
String marketplaceId = "<Your Marketplace Id>";


I have also declared the following statements:

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using MarketplaceWebServiceOrders;
using MarketplaceWebServiceOrders.Model;


I am creating a class like:

MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig();

config.ServiceURL = "";
MarketplaceWebServiceOrdersClient service = new MarketplaceWebServiceOrdersClient(applicationName, applicationVersion, accessKeyId, secretAccessKey, config);


but I am getting the following errors:

Invalid token '=' in class, structure or interface member declaration
Field initializer cannot refer to non-static fields, method or property "MarketplaceWebService..secretAccessKey"
Field initializer cannot refer to non-static fields, method or property MarketplaceWebService..config
Initializer fields cannot refer to non-static fields, method or property 'MarketplaceWebService..accessKeyId
' MarketplaceWebService. is a "field" but is used as a 'Type'

If I change the first block to:, string accessKeyId = ....

I can remove some of the errors, however the last one I was unable to resolve.


source to share

1 answer

Turns off at 3pm. I can still use more coffee lol. There was no instance of the class in my method, which has since been fixed and I'm fine now!



All Articles