Beispiel #1
0
 public MagentoServiceSoapClientFactory(string baseMagentoUrl, bool logRawMessages, string sessionId, MagentoConfig config)
 {
     this._baseMagentoUrl = baseMagentoUrl;
     this._logRawMessages = logRawMessages;
     this._session        = sessionId;
     this._config         = config;
     this.ReCreateFactories(baseMagentoUrl, logRawMessages, sessionId, config);
 }
 public IMagentoServiceLowLevelSoap CreateMagentoLowLevelService(MagentoAuthenticatedUserCredentials credentials, MagentoConfig config)
 {
     return(new MagentoServiceLowLevelSoap_v_2_1_0_0_ce(
                credentials.SoapApiUser,
                credentials.SoapApiKey,
                credentials.BaseMagentoUrl,
                credentials.LogRawMessages,
                null,
                config
                ));
 }
Beispiel #3
0
 public MagentoServiceSoapClientFactory(string baseMagentoUrl, bool logRawMessages, MagentoConfig config) : base(baseMagentoUrl, logRawMessages, config)
 {
 }
Beispiel #4
0
        public MagentoServiceLowLevelSoap_v_from_1_7_to_1_9_CE(string apiUser, string apiKey, string baseMagentoUrl, string store, int sessionIdLifeTime, int getProductsMaxThreads, bool logRawMessages, MagentoConfig config)
        {
            this.ApiUser        = apiUser;
            this.ApiKey         = apiKey;
            this.Store          = store;
            this.BaseMagentoUrl = baseMagentoUrl;
            this.LogRawMessages = logRawMessages;

            this._clientFactory      = new MagentoServiceSoapClientFactory(baseMagentoUrl, logRawMessages, config);
            this._magentoSoapService = this._clientFactory.GetClient();
            this.Magento1xxxHelper   = new Magento1xxxHelper(this);
            this.PullSessionId       = async() =>
            {
                var privateClient = this._clientFactory.GetClient();
                var loginResponse = await privateClient.loginAsync(this.ApiUser, this.ApiKey).ConfigureAwait(false);

                return(Tuple.Create(loginResponse.result, DateTime.UtcNow));
            };

            this.getSessionIdSemaphore  = new SemaphoreSlim(1, 1);
            this._getProductsMaxThreads = getProductsMaxThreads;
            this.SessionIdLifeTime      = sessionIdLifeTime;
        }
Beispiel #5
0
 public IMagentoService CreateService(MagentoAuthenticatedUserCredentials userAuthCredentials, MagentoConfig magentoConfig)
 {
     Condition.Requires(userAuthCredentials, "userAuthCredentials").IsNotNull();
     return(new MagentoService(userAuthCredentials, magentoConfig));
 }
Beispiel #6
0
        private void ReCreateFactories(string baseMagentoUrl, bool logRawMessages, string sessionId, MagentoConfig config)
        {
            this._adminClientFactory = new Magento2xCommonClientFactory <integrationAdminTokenServiceV1PortTypeClient, integrationAdminTokenServiceV1PortType>(
                (binding, endpoint) => new integrationAdminTokenServiceV1PortTypeClient(binding, endpoint),
                baseMagentoUrl, "integrationAdminTokenServiceV1", MessageVersion.Soap12, logRawMessages, sessionId, config);

            this._mediaGalleryFactory = new Magento2xCommonClientFactory <catalogProductAttributeMediaGalleryManagementV1PortTypeClient, catalogProductAttributeMediaGalleryManagementV1PortType>(
                (binding, endpoint) => new catalogProductAttributeMediaGalleryManagementV1PortTypeClient(binding, endpoint),
                baseMagentoUrl, "catalogProductAttributeMediaGalleryManagementV1", MessageVersion.Soap11, logRawMessages, sessionId, config);

            this._salesOrderRepositoryFactory = new Magento2xCommonClientFactory <salesOrderRepositoryV1PortTypeClient, salesOrderRepositoryV1PortType>(
                (binding, endpoint) => new salesOrderRepositoryV1PortTypeClient(binding, endpoint),
                baseMagentoUrl, "salesOrderRepositoryV1", MessageVersion.Soap11, logRawMessages, sessionId, config);

            this._categoriesRepositoryFactory = new Magento2xCommonClientFactory <catalogCategoryManagementV1PortTypeClient, catalogCategoryManagementV1PortType>(
                (binding, endpoint) => new catalogCategoryManagementV1PortTypeClient(binding, endpoint),
                baseMagentoUrl, "catalogCategoryManagementV1", MessageVersion.Soap11, logRawMessages, sessionId, config);

            this._catalogProductRepositoryFactory = new Magento2xCommonClientFactory <catalogProductRepositoryV1PortTypeClient, catalogProductRepositoryV1PortType>(
                (binding, endpoint) => new catalogProductRepositoryV1PortTypeClient(binding, endpoint),
                baseMagentoUrl, "catalogProductRepositoryV1", MessageVersion.Soap12, logRawMessages, sessionId, config);

            this._backendModuleServiceFactory = new Magento2xCommonClientFactory <backendModuleServiceV1PortTypeClient, backendModuleServiceV1PortType>(
                (binding, endpoint) => new backendModuleServiceV1PortTypeClient(binding, endpoint),
                baseMagentoUrl, "backendModuleServiceV1", MessageVersion.Soap12, logRawMessages, sessionId, config);

            this._catalogInventoryStockRegistryFactory = new Magento2xCommonClientFactory <catalogInventoryStockRegistryV1PortTypeClient, catalogInventoryStockRegistryV1PortType>(
                (binding, endpoint) => new catalogInventoryStockRegistryV1PortTypeClient(binding, endpoint),
                baseMagentoUrl, "catalogInventoryStockRegistryV1", MessageVersion.Soap11, logRawMessages, sessionId, config);
        }
 public IMagentoServiceLowLevelSoap CreateMagentoLowLevelService(MagentoAuthenticatedUserCredentials credentials, MagentoConfig config)
 {
     return(new MagentoServiceLowLevelSoap_v_1_14_1_0_EE(
                credentials.SoapApiUser,
                credentials.SoapApiKey,
                credentials.BaseMagentoUrl,
                null,
                credentials.SessionLifeTimeMs,
                credentials.LogRawMessages,
                credentials.GetProductsThreadsLimit,
                config
                ));
 }
Beispiel #8
0
            public Magento2xCommonClientFactory(Func <CustomBinding, EndpointAddress, T> clientBuilder, string baseMagentoUrl, string servicesName, MessageVersion messageVersion, bool logRawMessages, string sessionId, MagentoConfig config) : base(baseMagentoUrl, logRawMessages, config)
            {
                this._sessionId     = sessionId;
                this._clientBuilder = clientBuilder;
                this._binding       = CustomBinding(this._baseMagentoUrl, messageVersion, this._config.BindingDecompressionEnabled);
                var endPoint = new List <string> {
                    this._baseMagentoUrl, SoapApiUrl + servicesName
                }.BuildUrl(trimTailsSlash: true);

                this._endpointAddress = new EndpointAddress(endPoint);
            }
Beispiel #9
0
 public MagentoServiceLowLevelSoapFactory(MagentoAuthenticatedUserCredentials magentoAuthenticatedUserCredentials, Dictionary <string, IMagentoServiceLowLevelSoap> factories, MagentoConfig config)
 {
     this._magentoAuthenticatedUserCredentials = magentoAuthenticatedUserCredentials;
     this._factories = factories;
     this._config    = config.DefaultIfNull();
 }
Beispiel #10
0
        public MagentoServiceLowLevelSoap_v_2_0_2_0_ce(string apiUser, string apiKey, string baseMagentoUrl, bool logRawMessages, string store, MagentoConfig config)
        {
            this.ApiUser        = apiUser;
            this.ApiKey         = apiKey;
            this.Store          = store;
            this.BaseMagentoUrl = baseMagentoUrl;
            this.LogRawMessages = logRawMessages;

            this._clientFactory = new MagentoServiceSoapClientFactory(baseMagentoUrl, logRawMessages, this.ApiKey, config);
            this.PullSessionId  = async() =>
            {
                if (!string.IsNullOrWhiteSpace(this.ApiUser) && string.Compare(this.ApiUser, "bearer", StringComparison.InvariantCultureIgnoreCase) != 0)
                {
                    var privateClient = this._clientFactory.CreateMagentoServiceAdminClient();
                    var integrationAdminTokenServiceV1CreateAdminAccessTokenRequest = new IntegrationAdminTokenServiceV1CreateAdminAccessTokenRequest()
                    {
                        username = this.ApiUser, password = this.ApiKey
                    };
                    var loginResponse = await privateClient.integrationAdminTokenServiceV1CreateAdminAccessTokenAsync(integrationAdminTokenServiceV1CreateAdminAccessTokenRequest).ConfigureAwait(false);

                    this._sessionIdCreatedAt = DateTime.UtcNow;
                    this._sessionId          = loginResponse.integrationAdminTokenServiceV1CreateAdminAccessTokenResponse.result;
                }
                else
                {
                    this._sessionId = this.ApiKey;
                }
                if (this._clientFactory != null)
                {
                    this._clientFactory.Session = this._sessionId;
                }
                return(Tuple.Create(this._sessionId, DateTime.UtcNow));
            };

            this.getSessionIdSemaphore = new SemaphoreSlim(1, 1);
        }
 internal BaseMagentoServiceSoapClientFactory(string baseMagentoUrl, bool logRawMessages, MagentoConfig config)
 {
     this._baseMagentoUrl = baseMagentoUrl;
     this._logRawMessages = logRawMessages;
     this._config         = config;
 }
Beispiel #12
0
 public MagentoServiceSoapClientFactoryWithKeepAlive(string baseMagentoUrl, bool logRawMessages, MagentoConfig config, bool keepAlive = true) : base(baseMagentoUrl, logRawMessages, config)
 {
     this._keepAlive = keepAlive;
 }
Beispiel #13
0
 public MagentoServiceSoapClientFactory(string baseMagentoUrl, bool logRawMessages, MagentoConfig config)
 {
     this._clientFactoryDefault          = new MagentoServiceSoapClientFactoryWithKeepAlive(baseMagentoUrl, logRawMessages, config);
     this._clientFactoryWithoutKeepAlive = new MagentoServiceSoapClientFactoryWithKeepAlive(baseMagentoUrl, logRawMessages, config, false);
 }