public static void Main(string[] args) { var chain = new CredentialProfileStoreChain(); AWSCredentials awsCredentials; chain.TryGetAWSCredentials("DD MWS", out awsCredentials); var creds = awsCredentials.GetCredentials(); // Developer AWS access key string accessKey = creds.AccessKey; // Developer AWS secret key string secretKey = creds.SecretKey; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; string sellerId = "ARA1ZW7ZHL5MQ"; string marketplaceId = "ATVPDKIKX0DER"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "https://mws.amazonservices.com"; // Create a configuration object MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(accessKey, secretKey, appName, appVersion, config); MWSSubscriptionsServiceSample sample = new MWSSubscriptionsServiceSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; // response = sample.InvokeCreateSubscription(); response = sample.InvokeDeleteSubscription(); // succesfully called //response = sample.InvokeRegisterDestination(); //RegisterDestinationResponse registerDestinationResponse = (RegisterDestinationResponse)response; //response = sample.InvokeCreateSubscription(); //CreateSubscriptionResponse createSubscriptionResponse = (CreateSubscriptionResponse)response; // response = sample.InvokeGetSubscription(); //response = sample.InvokeListRegisteredDestinations(); //response = sample.InvokeListSubscriptions(); response = sample.InvokeRegisterDestination(); //response = sample.InvokeSendTestNotificationToDestination(); // response = sample.InvokeUpdateSubscription(); // response = sample.InvokeGetServiceStatus(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (MWSSubscriptionsServiceException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }
public static void Main(string[] args) { // TODO: Set the below configuration variables before attempting to run // Developer AWS access key string accessKey = "replaceWithAccessKey"; // Developer AWS secret key string secretKey = "replaceWithSecretKey"; // The client application name string appName = "CSharpSampleCode"; // The client application version string appVersion = "1.0"; // The endpoint for region service and version (see developer guide) // ex: https://mws.amazonservices.com string serviceURL = "replaceWithServiceURL"; // Create a configuration object MWSSubscriptionsServiceConfig config = new MWSSubscriptionsServiceConfig(); config.ServiceURL = serviceURL; // Set other client connection configurations here if needed // Create the client itself MWSSubscriptionsService client = new MWSSubscriptionsServiceClient(accessKey, secretKey, appName, appVersion, config); MWSSubscriptionsServiceSample sample = new MWSSubscriptionsServiceSample(client); // Uncomment the operation you'd like to test here // TODO: Modify the request created in the Invoke method to be valid try { IMWSResponse response = null; // response = sample.InvokeCreateSubscription(); // response = sample.InvokeDeleteSubscription(); // response = sample.InvokeDeregisterDestination(); // response = sample.InvokeGetSubscription(); // response = sample.InvokeListRegisteredDestinations(); // response = sample.InvokeListSubscriptions(); // response = sample.InvokeRegisterDestination(); // response = sample.InvokeSendTestNotificationToDestination(); // response = sample.InvokeUpdateSubscription(); // response = sample.InvokeGetServiceStatus(); Console.WriteLine("Response:"); ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata; // We recommend logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); } catch (MWSSubscriptionsServiceException ex) { // Exception properties are important for diagnostics. ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata; Console.WriteLine("Service Exception:"); if (rhmd != null) { Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); } Console.WriteLine("Message: " + ex.Message); Console.WriteLine("StatusCode: " + ex.StatusCode); Console.WriteLine("ErrorCode: " + ex.ErrorCode); Console.WriteLine("ErrorType: " + ex.ErrorType); throw ex; } }