/// <summary>
        /// Default public contructor. All properties are set via the config file
        /// </summary>
        public AmazonIntegration()
        {
            // Verify that the settings in the config file are setup correctly.
            if (string.IsNullOrWhiteSpace(_AccessKeyId))
                throw new InvalidOperationException("AWSAccessKeyId setting in the config file can't be whitespace, blank or null");
            if (string.IsNullOrWhiteSpace(_SecretAccessKey))
                throw new InvalidOperationException("AWSSecretAccessKey setting in the config file can't be whitespace, blank or null");
            if (string.IsNullOrWhiteSpace(_ApplicationName))
                throw new InvalidOperationException("AWSApplicationName setting in the config file can't be whitespace, blank or null");
            if (string.IsNullOrWhiteSpace(_ApplicationVersion))
                throw new InvalidOperationException("AWSApplicationVersion setting in the config file can't be whitespace, blank or null");
            if (string.IsNullOrWhiteSpace(_MerchantId))
                throw new InvalidOperationException("AWSMerchantId setting in the config file can't be whitespace, blank or null");
            if (string.IsNullOrWhiteSpace(_MarketplaceId))
                throw new InvalidOperationException("AWSMarketplaceId setting in the config file can't be whitespace, blank or null");
            if (string.IsNullOrWhiteSpace(_TemporaryFileDirectory))
                throw new InvalidOperationException("TempFileDirectory setting in the config file can't be whitespace, blank or null");

            var config = new MarketplaceWebServiceConfig();
            // Set configuration to use US marketplace
            config.ServiceURL = "https://mws.amazonservices.com";
            // Set the HTTP Header for user agent for the application.
            config.SetUserAgentHeader(
                _ApplicationName,
                _ApplicationVersion,
                "C#");
            _AmazonClient = new MarketplaceWebServiceClient(_AccessKeyId, _SecretAccessKey, config);

            // Setup the orders service client
            var ordersConfig = new MarketplaceWebServiceOrdersConfig();
            ordersConfig.ServiceURL = "https://mws.amazonservices.com/Orders/2011-01-01";
            ordersConfig.SetUserAgent(_ApplicationName, _ApplicationVersion);
            _AmazonOrdersClient = new MarketplaceWebServiceOrdersClient(
                _ApplicationName, _ApplicationVersion, _AccessKeyId, _SecretAccessKey, ordersConfig);
        }
Пример #2
0
 private MarketplaceWebServiceOrdersClient GetOrdersApiService()
 {
     var config = new MarketplaceWebServiceOrdersConfig() { ServiceURL = _amazonAppSettings.OrdersApiEndpoint };
     return new MarketplaceWebServiceOrdersClient("MrCMS", MrCMSApplication.AssemblyVersion, MrCMSApplication.Get<AmazonAppSettings>().AWSAccessKeyId,
                                             MrCMSApplication.Get<AmazonAppSettings>().SecretKey,
                                             config);
 }
Пример #3
0
 /// <summary>
 /// Create client.
 /// </summary>
 /// <param name="accessKey">Access Key</param>
 /// <param name="secretKey">Secret Key</param>
 /// <param name="config">configuration</param>
 public MarketplaceWebServiceOrdersClient(String accessKey, String secretKey, MarketplaceWebServiceOrdersConfig config)
 {
     connection = config.CopyConnection();
     connection.AwsAccessKeyId = accessKey;
     connection.AwsSecretKeyId = secretKey;
     connection.LibraryVersion = libraryVersion;
     servicePath = config.ServicePath;
 }
 public static MarketplaceWebServiceOrders GetClient(ServiceCliamDefinition serviceCliamDefinition)
 {
     if (client == null)
     {
         MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig();
         config.ServiceURL = _serviceURL;
         client            = new MarketplaceWebServiceOrdersClient(serviceCliamDefinition.AccessKey, serviceCliamDefinition.SecretKey, "T-Tek", "1.0", config);
     }
     return(client);
 }
Пример #5
0
        public static void Main(string[] args)
        {
            // TODO: Set the below configuration variables before attempting to run



            // Create a configuration object
            MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig();

            config.ServiceURL = serviceURL;
            // Set other client connection configurations here if needed
            // Create the client itself
            MarketplaceWebServiceOrders client = new MarketplaceWebServiceOrdersClient(accessKey, secretKey, appName, appVersion, config);

            MarketplaceWebServiceOrdersSample sample = new MarketplaceWebServiceOrdersSample(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.InvokeGetOrder();
                // response = sample.InvokeGetServiceStatus();
                // response = sample.InvokeListOrderItems();
                // response = sample.InvokeListOrderItemsByNextToken();
                response = sample.InvokeListOrders();
                // response = sample.InvokeListOrdersByNextToken();
                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 (MarketplaceWebServiceOrdersException 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;
            }
        }
Пример #6
0
 /// <summary>
 /// Constructs MarketplaceWebServiceOrdersClient with AWS Access Key ID and AWS Secret Key
 /// </summary>
 /// <param name="applicationName">Your application's name, e.g. "MyMWSApp"</param>
 /// <param name="applicationVersion">Your application's version, e.g. "1.0"</param>
 /// <param name="awsAccessKeyId">AWS Access Key ID</param>
 /// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
 /// <param name="config">configuration</param>
 public MarketplaceWebServiceOrdersClient(
     String applicationName,
     String applicationVersion,
     String awsAccessKeyId,
     String awsSecretAccessKey,
     MarketplaceWebServiceOrdersConfig config)
 {
     this.awsAccessKeyId     = awsAccessKeyId;
     this.awsSecretAccessKey = awsSecretAccessKey;
     this.config             = config;
     ServicePointManager.Expect100Continue = false;
     ServicePointManager.UseNagleAlgorithm = false;
     config.SetUserAgent(applicationName, applicationVersion);
 }
Пример #7
0
 /// <summary>
 /// Create client.
 /// </summary>
 /// <param name="accessKey">Access Key</param>
 /// <param name="secretKey">Secret Key</param>
 /// <param name="applicationName">Application Name</param>
 /// <param name="applicationVersion">Application Version</param>
 /// <param name="config">configuration</param>
 public MarketplaceWebServiceOrdersClient(
     string accessKey,
     string secretKey,
     string applicationName,
     string applicationVersion,
     MarketplaceWebServiceOrdersConfig config)
 {
     connection = config.CopyConnection();
     connection.AwsAccessKeyId     = accessKey;
     connection.AwsSecretKeyId     = secretKey;
     connection.ApplicationName    = applicationName;
     connection.ApplicationVersion = applicationVersion;
     connection.LibraryVersion     = libraryVersion;
     servicePath = config.ServicePath;
 }
Пример #8
0
        protected override void RegisterServices(IKernel kernel)
        {
            kernel.Bind<MarketplaceWebServiceOrders.MarketplaceWebServiceOrders>().ToMethod(context =>
            {
                var amazonAppSettings = context.Kernel.Get<AmazonAppSettings>();
                var config = new MarketplaceWebServiceOrdersConfig { ServiceURL = amazonAppSettings.OrdersApiEndpoint };
                return new MarketplaceWebServiceOrdersClient
                        ("MrCMS", MrCMSApplication.AssemblyVersion, amazonAppSettings.AWSAccessKeyId, amazonAppSettings.SecretKey, config);
            }).InRequestScope();

            kernel.Bind<MarketplaceWebServiceProducts.MarketplaceWebServiceProducts>().ToMethod(context =>
            {
                var amazonAppSettings = context.Kernel.Get<AmazonAppSettings>();
                var config = new MarketplaceWebServiceProductsConfig { ServiceURL = amazonAppSettings.ProductsApiEndpoint };
                return new MarketplaceWebServiceProductsClient
                        ("MrCMS", MrCMSApplication.AssemblyVersion, amazonAppSettings.AWSAccessKeyId, amazonAppSettings.SecretKey, config);
            }).InRequestScope();
            kernel.Bind<MarketplaceWebService.MarketplaceWebService>().ToMethod(context =>
            {
                var amazonAppSettings = context.Kernel.Get<AmazonAppSettings>();
                var config = new MarketplaceWebServiceConfig { ServiceURL = amazonAppSettings.ProductsApiEndpoint };
                return new MarketplaceWebServiceClient(amazonAppSettings.AWSAccessKeyId, amazonAppSettings.SecretKey, "MrCMS", MrCMSApplication.AssemblyVersion, config);
            }).InRequestScope();
        }
        /**
        * Samples for Marketplace Web Service Orders functionality
        */
        public static void Main(string [] args)
        {
            Console.WriteLine("===========================================");
            Console.WriteLine("Welcome to Marketplace Web Service Orders Samples!");
            Console.WriteLine("===========================================");

            Console.WriteLine("To get started:");
            Console.WriteLine("===========================================");
            Console.WriteLine("  - Fill in your MWS credentials");
            Console.WriteLine("  - Uncomment sample you're interested in trying");
            Console.WriteLine("  - Set request with desired parameters");
            Console.WriteLine("  - Hit F5 to run!");
            Console.WriteLine();

            Console.WriteLine("===========================================");
            Console.WriteLine("Samples Output");
            Console.WriteLine("===========================================");
            Console.WriteLine();

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

            /************************************************************************
             * The application name and version are included in each MWS call's
             * HTTP User-Agent field.
             ***********************************************************************/
            const string applicationName = "<Your Application Name>";
            const string applicationVersion = "<Your Application Version>";

            /************************************************************************
            * Uncomment to try advanced configuration options. Available options are:
            *
            *  - Signature Version
            *  - Proxy Host and Proxy Port
            *  - Service URL
            *  - User Agent String to be sent to Marketplace Web Service Orders  service
            *
            ***********************************************************************/
            MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig();
            //
            // IMPORTANT: Uncomment out the appropriate line for the country you wish
            // to sell in:
            //
            // United States:
            // config.ServiceURL = "https://mws.amazonservices.com/Orders/2011-01-01";
            //
            // Canada:
            // config.ServiceURL = "https://mws.amazonservices.ca/Orders/2011-01-01";
            //
            // Europe:
            // config.ServiceURL = "https://mws-eu.amazonservices.com/Orders/2011-01-01";
            //
            // Japan:
            // config.ServiceURL = "https://mws.amazonservices.jp/Orders/2011-01-01";
            //
            // China:
            // config.ServiceURL = "https://mws.amazonservices.com.cn/Orders/2011-01-01";
            //

            /************************************************************************
            * Instantiate  Implementation of Marketplace Web Service Orders
            ***********************************************************************/
            MarketplaceWebServiceOrdersClient service = new MarketplaceWebServiceOrdersClient(
                applicationName, applicationVersion, accessKeyId, secretAccessKey, config);

            /************************************************************************
            * Uncomment to try out Mock Service that simulates Marketplace Web Service Orders
            * responses without calling Marketplace Web Service Orders  service.
            *
            * Responses are loaded from local XML files. You can tweak XML files to
            * experiment with various outputs during development
            *
            * XML files available under MarketplaceWebServiceOrders\Mock tree
            *
            ***********************************************************************/
            // MarketplaceWebServiceOrders service = new MarketplaceWebServiceOrdersMock();

            /************************************************************************
            * Uncomment to invoke List Orders By Next Token Action
            ***********************************************************************/
            // ListOrdersByNextTokenRequest request = new ListOrdersByNextTokenRequest();
            // @TODO: set request parameters here
            // request.SellerId = merchantId;

            // ListOrdersByNextTokenSample.InvokeListOrdersByNextToken(service, request);
            /************************************************************************
            * Uncomment to invoke List Order Items By Next Token Action
            ***********************************************************************/
            // ListOrderItemsByNextTokenRequest request = new ListOrderItemsByNextTokenRequest();
            // @TODO: set request parameters here
            // request.SellerId = merchantId;

            // ListOrderItemsByNextTokenSample.InvokeListOrderItemsByNextToken(service, request);
            /************************************************************************
            * Uncomment to invoke Get Order Action
            ***********************************************************************/
            // GetOrderRequest request = new GetOrderRequest();
            // @TODO: set request parameters here
            // request.SellerId = merchantId;

            // GetOrderSample.InvokeGetOrder(service, request);
            /************************************************************************
            * Uncomment to invoke List Order Items Action
            ***********************************************************************/
            // ListOrderItemsRequest request = new ListOrderItemsRequest();
            // @TODO: set request parameters here
            // request.SellerId = merchantId;

            // ListOrderItemsSample.InvokeListOrderItems(service, request);
            /************************************************************************
            * Uncomment to invoke List Orders Action
            ***********************************************************************/
            // ListOrdersRequest request = new ListOrdersRequest();
            // @TODO: set request parameters here
            // request.SellerId = merchantId;

            // ListOrdersSample.InvokeListOrders(service, request);
            /************************************************************************
            * Uncomment to invoke Get Service Status Action
            ***********************************************************************/
            // GetServiceStatusRequest request = new GetServiceStatusRequest();
            // @TODO: set request parameters here
            // request.SellerId = merchantId;

            // GetServiceStatusSample.InvokeGetServiceStatus(service, request);

            /************************************************************************
            * Uncomment to invoke OrderFetcher Sample
            ***********************************************************************/
            // OrderFetcherSample.InvokeOrderFetcherSample(service, merchantId, new string [] { marketplaceId } );

            /************************************************************************
            * Uncomment to invoke FetchNewOrdersJob Sample
            ***********************************************************************/
            // FetchNewOrdersJob.InvokeOrderFetcherSample(service, merchantId, new string[] { marketplaceId });

            Console.WriteLine();
            Console.WriteLine("===========================================");
            Console.WriteLine("End of output. You can close this window");
            Console.WriteLine("===========================================");

            System.Threading.Thread.Sleep(50000);
        }
        public static void RunSample()
        {
            DataSet ds = MySqlHelper.GetDataSet(MySqlHelper.Conn, System.Data.CommandType.Text, "select * from t_product", null);
            // TODO: Set the below configuration variables before attempting to run
            IniReader iniReader = new IniReader(System.Environment.CurrentDirectory + "\\config.ini");

            string awsSection = "AWS_US";

            // Developer AWS access key
            string accessKey = iniReader.ReadValue(awsSection, "accessKey");

            // Developer AWS secret key
            string secretKey = "DbRpGI97sF0lot67Wm5Dkgc9chXd7GkmzMxu/JrV";

            // The client application name
            string appName = "UprightBuzSample";

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

            // Create a configuration object
            MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig();
            config.ServiceURL = serviceURL;
            // Set other client connection configurations here if needed
            // Create the client itself
            MarketplaceWebServiceOrders client = new MarketplaceWebServiceOrdersClient(accessKey, secretKey, appName, appVersion, config);

            MarketplaceWebServiceOrdersSample sample = new MarketplaceWebServiceOrdersSample(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.InvokeGetOrder();
                // response = sample.InvokeGetServiceStatus();
                // response = sample.InvokeListOrderItems();
                // response = sample.InvokeListOrderItemsByNextToken();
                response = sample.InvokeListOrders();
                // response = sample.InvokeListOrdersByNextToken();
                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 (MarketplaceWebServiceOrdersException 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;
            }
        }
        /**
         * Samples for Marketplace Web Service Orders functionality
         */
        public static void Main(string[] args)
        {
            Console.WriteLine("===========================================");
            Console.WriteLine("Welcome to Marketplace Web Service Orders Samples!");
            Console.WriteLine("===========================================");

            Console.WriteLine("To get started:");
            Console.WriteLine("===========================================");
            Console.WriteLine("  - Fill in your MWS credentials");
            Console.WriteLine("  - Uncomment sample you're interested in trying");
            Console.WriteLine("  - Set request with desired parameters");
            Console.WriteLine("  - Hit F5 to run!");
            Console.WriteLine();

            Console.WriteLine("===========================================");
            Console.WriteLine("Samples Output");
            Console.WriteLine("===========================================");
            Console.WriteLine();

            /************************************************************************
             * Access Key ID and Secret Access Key ID
             ***********************************************************************/
            String accessKeyId = "AKIAIZAIBEDEFFEWL3OA";
            String secretAccessKey = "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";
            String merchantId = "A3FFNVBB2U6OUI";
            String marketplaceId = "ATVPDKIKX0DER";

            /************************************************************************
             * The application name and version are included in each MWS call's
             * HTTP User-Agent field.
             ***********************************************************************/
            const string applicationName = "<Your Application Name>";
            const string applicationVersion = "<Your Application Version>";

            /************************************************************************
            * Uncomment to try advanced configuration options. Available options are:
            *
            *  - Signature Version
            *  - Proxy Host and Proxy Port
            *  - Service URL
            *  - User Agent String to be sent to Marketplace Web Service Orders  service
            *
            ***********************************************************************/
            MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig();
            //
            // IMPORTANT: Uncomment out the appropiate line for the country you wish
            // to sell in:
            //
            // United States:
            config.ServiceURL = "https://mws.amazonservices.com/Orders/2011-01-01";
            //
            // Canada:
            // config.ServiceURL = "https://mws.amazonservices.ca/Orders/2011-01-01";
            //
            // United Kingdom:
            // config.ServiceURL = "https://mws.amazonservices.co.uk/Orders/2011-01-01";
            //
            // Germany:
            // config.ServiceURL = "https://mws.amazonservices.de/Orders/2011-01-01";
            //
            // France:
            // config.ServiceURL = "https://mws.amazonservices.fr/Orders/2011-01-01";
            //
            // Italy:
            // config.ServiceURL = "https://mws.amazonservices.it/Orders/2011-01-01";
            //
            // Japan:
            // config.ServiceURL = "https://mws.amazonservices.jp/Orders/2011-01-01";
            //
            // China:
            // config.ServiceURL = "https://mws.amazonservices.com.cn/Orders/2011-01-01";
            //

            /************************************************************************
            * Instantiate  Implementation of Marketplace Web Service Orders
            ***********************************************************************/
            MarketplaceWebServiceOrders service = new MarketplaceWebServiceOrdersClient(
                applicationName, applicationVersion, accessKeyId, secretAccessKey, config);

            /************************************************************************
            * Uncomment to try out Mock Service that simulates Marketplace Web Service Orders
            * responses without calling Marketplace Web Service Orders  service.
            *
            * Responses are loaded from local XML files. You can tweak XML files to
            * experiment with various outputs during development
            *
            * XML files available under MarketplaceWebServiceOrders\Mock tree
            *
            ***********************************************************************/
            // MarketplaceWebServiceOrders service = new MarketplaceWebServiceOrdersMock();

            /************************************************************************
            * Uncomment to invoke List Orders By Next Token Action
            ***********************************************************************/
            //ListOrdersByNextTokenRequest request = new ListOrdersByNextTokenRequest();
            //// @TODO: set request parameters here
            //request.SellerId = merchantId;
            //request.NextToken = "NEXT_TOKEN";
            //ListOrdersByNextTokenSample.InvokeListOrdersByNextToken(service, request);

            /************************************************************************
            * Uncomment to invoke List Order Items By Next Token Action
            ***********************************************************************/
            //ListOrderItemsByNextTokenRequest request = new ListOrderItemsByNextTokenRequest();
            //// @TODO: set request parameters here
            //request.SellerId = merchantId;
            //request.NextToken = "NEXT_TOKEN";
            //ListOrderItemsByNextTokenSample.InvokeListOrderItemsByNextToken(service, request);

            /************************************************************************
            * Uncomment to invoke Get Order Action
            ***********************************************************************/
            //GetOrderRequest request = new GetOrderRequest();
            //// @TODO: set request parameters here
            //request.SellerId = merchantId;
            //request.AmazonOrderId = new OrderIdList();
            //request.AmazonOrderId.Id = new List<string>(new string[] { "ORDER_1", "ORDER_2" });
            //GetOrderSample.InvokeGetOrder(service, request);

            /************************************************************************
            * Uncomment to invoke List Order Items Action
            ***********************************************************************/
            //ListOrderItemsRequest request = new ListOrderItemsRequest();
            //// @TODO: set request parameters here
            //request.SellerId = merchantId;
            //request.AmazonOrderId = "ORDER_ID";
            // ListOrderItemsSample.InvokeListOrderItems(service, request);

            /************************************************************************
            * Uncomment to invoke List Orders Action
            ***********************************************************************/
            ListOrdersRequest request = new ListOrdersRequest();
            // @TODO: set request parameters here
            request.CreatedAfter = DateTime.Now.AddDays(-1);
            request.MarketplaceId = new MarketplaceIdList();
            request.MarketplaceId.Id = new List<string>(new string[] { marketplaceId });
            request.SellerId = merchantId;
            ListOrdersSample.InvokeListOrders(service, request);

            /************************************************************************
            * Uncomment to invoke Get Service Status Action
            ***********************************************************************/
            // GetServiceStatusRequest request = new GetServiceStatusRequest();
            // request.SellerId = merchantId;
            //// @TODO: set request parameters here
            // GetServiceStatusSample.InvokeGetServiceStatus(service, request);

            /************************************************************************
            * Uncomment to invoke OrderFetcher Sample
            ***********************************************************************/
            // OrderFetcherSample.InvokeOrderFetcherSample(service, merchantId, new string [] { marketplaceId } );

            /************************************************************************
            * Uncomment to invoke FetchOrderUpdatesJob Sample - A sample
            * implementation of continuously retrieving orders over a given
            * time interval.
            ***********************************************************************/
            // FetchOrderUpdatesJob.InvokeOrderFetcherSample(service, merchantId, new string[] { marketplaceId });

            Console.WriteLine();
            Console.WriteLine("===========================================");
            Console.WriteLine("End of output. You can close this window");
            Console.WriteLine("===========================================");

            System.Threading.Thread.Sleep(50000);
        }
Пример #12
0
        public static void Main(string[] args)
        {
            // TODO: Set the below configuration variables before attempting to run

            // Developer AWS access key
            string accessKey = "AKIAJO3IC7VKEKZOPUZQ";

            // Developer AWS secret key
            string secretKey = "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";

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

            // Create a configuration object
            MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig();

            config.ServiceURL = serviceURL;
            // Set other client connection configurations here if needed
            // Create the client itself
            MarketplaceWebServiceOrders client = new MarketplaceWebServiceOrdersClient(accessKey, secretKey, appName, appVersion, config);

            MarketplaceWebServiceOrdersSample sample = new MarketplaceWebServiceOrdersSample(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.InvokeGetOrder();
                // response = sample.InvokeGetServiceStatus();
                // response = sample.InvokeListOrderItems();
                // response = sample.InvokeListOrderItemsByNextToken();
                // response = sample.InvokeListOrders();
                // response = sample.InvokeListOrdersByNextToken();
                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 (MarketplaceWebServiceOrdersException 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
            MarketplaceWebServiceOrdersConfig config = new MarketplaceWebServiceOrdersConfig();
            config.ServiceURL = serviceURL;
            // Set other client connection configurations here if needed
            // Create the client itself
            MarketplaceWebServiceOrders client = new MarketplaceWebServiceOrdersClient(accessKey, secretKey, appName, appVersion, config);

            MarketplaceWebServiceOrdersSample sample = new MarketplaceWebServiceOrdersSample(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.InvokeGetOrder();
                // response = sample.InvokeGetServiceStatus();
                // response = sample.InvokeListOrderItems();
                // response = sample.InvokeListOrderItemsByNextToken();
                // response = sample.InvokeListOrders();
                // response = sample.InvokeListOrdersByNextToken();
                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 (MarketplaceWebServiceOrdersException 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;
            }
        }