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 = "https://mws.amazonservices.com/Orders/2011-01-01"; 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