Exemplo n.º 1
0
        public void BuildSoapCall()
        {
            try{
                MarketplaceAPIServiceClient Client = new MarketplaceAPIServiceClient();
                Client = new MarketplaceAPIServiceClient(MarketplaceAPIServiceClient.EndpointConfiguration.BasicHttpBinding_IMarketplaceAPIService, "http://wsvc.preprod-cdiscount.com/MarketplaceAPIService.svc");
                var b = Client.Endpoint.Binding as System.ServiceModel.BasicHttpBinding;

                b.SendTimeout    = TimeSpan.FromMinutes(10);
                b.ReceiveTimeout = TimeSpan.FromMinutes(10);
                b.OpenTimeout    = TimeSpan.FromMinutes(10);
                b.CloseTimeout   = TimeSpan.FromMinutes(10);
                //  string proxyUrl = "http://*****:*****@eu-west-1-babbage.quotaguard.com:9293";
                string     proxyUrl      = Environment.GetEnvironmentVariable("QUOTAGUARDSTATIC_URL");
                System.Uri proxyUri      = new System.Uri(proxyUrl);
                string     cleanProxyURL = proxyUri.Scheme + "://" + proxyUri.Host + ":" + proxyUri.Port;
                string     user          = proxyUri.UserInfo.Split(':')[0];
                string     password      = proxyUri.UserInfo.Split(':')[1];
                WebProxy   myProxy       = new WebProxy();
                Uri        newUri        = new Uri(cleanProxyURL);
                myProxy.Credentials = new NetworkCredential(user, password);
                myProxy.Address     = newUri;

                /*   b.ProxyAddress =newUri;
                 * WebRequest.DefaultWebProxy = myProxy;
                 * b.Security.Mode = BasicHttpSecurityMode.Transport;
                 * b.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; // !!!
                 * b.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; // !!!
                 * b.UseDefaultWebProxy = true;
                 */

                HeaderMessage hdr = new HeaderMessage()
                {
                    Context = new ContextMessage
                    {
                        CatalogID = 1,
                        SiteID    = 100
                    },
                    Localization = new LocalizationMessage
                    {
                        Country         = Country.Fr,
                        Currency        = Currency.Eur,
                        DecimalPosition = 2,
                        Language        = Language.Fr
                    },
                    Security = new SecurityContext
                    {
                        TokenId = "c1fbbc8cd14a4c8dbade07b202fb69dc"
                                  //TokenId = "4e002e269b044058a9cd2df305861525"
                    },
                    Version = "1.0"
                };

                _CategoryTreeMessage = Client.GetAllAllowedCategoryTreeAsync(hdr);
                //_SellerMessage = Client.GetSellerInformationAsync(hdr);
            }
            catch (SystemException ex)
            {
                _ErrorMessage = ex.Message;
            }
        }
Exemplo n.º 2
0
        public static void GetAllowedCategoryTreeDemo()
        {
            MarketplaceAPIServiceClient client = new MarketplaceAPIServiceClient();

            HeaderMessage headerMessage = new HeaderMessage()
            {
                Context = new ContextMessage()
                {
                    CatalogID      = 1,
                    CustomerPoolID = 1,
                    SiteID         = 100,
                },
                Localization = new LocalizationMessage()
                {
                    Country         = Country.ER,   //国家
                    Currency        = Currency.Eur, //货币
                    DecimalPosition = 2,            //小数位数
                    Language        = Language.Fr,  //语言
                },
                Security = new SecurityContext()
                {
                    UserName        = "******",
                    IssuerID        = null,
                    SessionID       = null,
                    TokenId         = "547ac026827f44a3abeddc20e971cc10", //"${#Project#648f57a70f82416dbc26d3aebe6b4058}",
                    SubjectLocality = null,
                },
                Version = "1.0",
            };
            CategoryTreeMessage result = client.GetAllowedCategoryTree(headerMessage);

            client.Close();
        }
        public Environment()
        {
            _MarketplaceAPIService = new MarketplaceAPIServiceClient();
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            Configuration = builder.Build();
        }
Exemplo n.º 4
0
        public void GetService(Request MyRequest)
        {
            _Environment = MyRequest._EnvironmentSelected;
            if (_Environment == EnvironmentEnum.Production)
            {
                _EndPointAddress       = "https://wsvc.cdiscount.com/MarketplaceAPIService.svc";
                _MarketplaceAPIService = new MarketplaceAPIServiceClient(MarketplaceAPIServiceClient.EndpointConfiguration.BasicHttpBinding_IMarketplaceAPIService, _EndPointAddress);
                _MarketplaceAPIService.Endpoint.EndpointBehaviors.Add(_RequestInterceptor);
                var b = _MarketplaceAPIService.Endpoint.Binding as System.ServiceModel.BasicHttpBinding;

                b.SendTimeout    = TimeSpan.FromMinutes(10);
                b.ReceiveTimeout = TimeSpan.FromMinutes(10);
                b.OpenTimeout    = TimeSpan.FromMinutes(10);
                b.CloseTimeout   = TimeSpan.FromMinutes(10);
            }
            else
            {
                if (_Environment == EnvironmentEnum.Recette)
                {
                    _EndPointAddress = "https://wsvc.recette-cdiscount.com/MarketplaceAPIService.svc";
                }

                else if (_Environment == EnvironmentEnum.Preproduction)
                {
                    _EndPointAddress = "http://wsvc.preprod-cdiscount.com/MarketplaceAPIService.svc";
                }

                _MarketplaceAPIService = new MarketplaceAPIServiceClient(MarketplaceAPIServiceClient.EndpointConfiguration.BasicHttpBinding_IMarketplaceAPIService, _EndPointAddress);
                var b = _MarketplaceAPIService.Endpoint.Binding as System.ServiceModel.BasicHttpBinding;

                b.SendTimeout    = TimeSpan.FromMinutes(10);
                b.ReceiveTimeout = TimeSpan.FromMinutes(10);
                b.OpenTimeout    = TimeSpan.FromMinutes(10);
                b.CloseTimeout   = TimeSpan.FromMinutes(10);
                string     proxyUrl      = Environment.GetEnvironmentVariable("QUOTAGUARDSTATIC_URL");
                System.Uri proxyUri      = new System.Uri(proxyUrl);
                string     cleanProxyURL = proxyUri.Scheme + "://" + proxyUri.Host + ":" + proxyUri.Port;
                string     user          = proxyUri.UserInfo.Split(':')[0];
                string     password      = proxyUri.UserInfo.Split(':')[1];
                WebProxy   myProxy       = new WebProxy();
                Uri        newUri        = new Uri(cleanProxyURL);
                myProxy.Credentials = new NetworkCredential(user, password);
                myProxy.Address     = newUri;

                /*  b.ProxyAddress =newUri;
                 * WebRequest.DefaultWebProxy = myProxy;
                 * b.Security.Mode = BasicHttpSecurityMode.Transport;
                 * b.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; // !!!
                 * b.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; // !!!
                 * b.UseDefaultWebProxy = true;
                 */
                _MarketplaceAPIService.Endpoint.EndpointBehaviors.Add(_RequestInterceptor);
            }
        }
Exemplo n.º 5
0
        public void GetService()
        {
            if (_Environment == Enumeration.EnvironmentEnum.Production)
            {
                _EndPointAddress = "https://wsvc.cdiscount.com/MarketplaceAPIService.svc";
            }
            else if (_Environment == Enumeration.EnvironmentEnum.Local)
            {
                _EndPointAddress = "http://localhost:8030/MarketplaceAPIService.svc";
            }
            else
            {
                _EndPointAddress = "https://wsvc.preprod-cdiscount.com/MarketplaceAPIService.svc";
            }

            _MarketplaceAPIService = new MarketplaceAPIServiceClient(MarketplaceAPIServiceClient.EndpointConfiguration.BasicHttpBinding_IMarketplaceAPIService, "https://wsvc.cdiscount.com/MarketplaceAPIService.svc");
            _MarketplaceAPIService.Endpoint.EndpointBehaviors.Add(_RequestInterceptor);
        }