Esempio n. 1
0
        public BfEmployeeClient InvokeWcf()
        {
            BfEmployeeClient proxy = MB.WcfClient.WcfClientFactory.CreateWcfClient <BfEmployeeClient>(
                "MB.InfoCloud.Common.Hosts/OnlineSales.11.22.33/IBillDayCheckout", MB.WcfClient.SystemCode.Main, "MyBinding");

            return(proxy);
        }
Esempio n. 2
0
        public BfEmployeeClient InvokeWcf()
        {
            //MB.ERP.BaseLibrary.MPrivilege.IFace.IBfEmployee
            BfEmployeeClient proxy = MB.WcfClient.WcfClientFactory.CreateWcfClient <BfEmployeeClient>(
                "IBfEmployee", MB.WcfClient.SystemCode.Main);

            return(proxy);
        }
Esempio n. 3
0
        public BfEmployeeClient InvokeWcf()
        {
            BfEmployeeClient client = new BfEmployeeClient();

            bool   hasSubSystem    = System.Configuration.ConfigurationManager.AppSettings["WcfServers"].IndexOf("nosubsystem") < 0;
            string certificateName = "mb.credential";

            if (!hasSubSystem)
            {
                certificateName = "mb.credential.nosubsystem";
            }

            MB.Util.MyNetworkCredential.CurrentSelectedServerInfo = new MB.Util.Model.ServerConfigInfo("Server", certificateName);
            BfEmployeeClient proxy = MB.WcfClient.WcfClientFactory.CreateWcfClient <BfEmployeeClient>(this);

            return(proxy);
        }
Esempio n. 4
0
        static void Main()
        {
            string serviceCredential = System.Configuration.ConfigurationManager.AppSettings["WcfServers"];
            bool   hasSubSystem      = serviceCredential.IndexOf("nosubsystem") < 0;

            if (hasSubSystem)
            {
                ChannelFactoryTestor test = new ChannelFactoryTestor();
                test.InvokeWcfViaProxy();
                test.InvokeWcfAction();
                test.InvokeWcfFunction();

                TestMB001Rule    rule   = new TestMB001Rule();
                BfEmployeeClient client = rule.InvokeWcf();
                Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:1/MB.ERP.BaseLibrary.MPrivilege.IFace/IBfEmployee.svc");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Domain == "MB001");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator1");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password1");

                TestMB002Rule rule002 = new TestMB002Rule();
                client = rule002.InvokeWcf();
                Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:2/MB.ERP.BaseLibrary.MPrivilege.IFace/IBfEmployee.svc");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Domain == "MB002");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator2");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password2");


                TestMainRule mainRule = new TestMainRule();
                client = mainRule.InvokeWcf();
                Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:18051/MB.ERP.BaseLibrary.MPrivilege.IFace/IBfEmployee.svc");
                Debug.Assert(string.IsNullOrEmpty(client.ClientCredentials.Windows.ClientCredential.Domain));
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password");

                TestMainRuleWithoutAtt mainRuleWithoutAtt = new TestMainRuleWithoutAtt();
                client = mainRuleWithoutAtt.InvokeWcf();
                Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:18051/Service1.svc");
                Debug.Assert(string.IsNullOrEmpty(client.ClientCredentials.Windows.ClientCredential.Domain));
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password");

                TestCreateWcfClientWithoutAtt noAtt = new TestCreateWcfClientWithoutAtt();
                client = noAtt.InvokeWcf();
                Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:18051/IBfEmployee.svc");
                Debug.Assert(string.IsNullOrEmpty(client.ClientCredentials.Windows.ClientCredential.Domain));
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password");
            }
            else
            {
                BfEmployeeClient client = null;
                if (serviceCredential.IndexOf("mb001") > 0)
                {
                    TestMB001Rule rule = new TestMB001Rule();
                    client = rule.InvokeWcf();
                    Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:1/MB.ERP.BaseLibrary.MPrivilege.IFace/IBfEmployee.svc");
                    Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Domain == "MB001");
                    Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator1");
                    Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password1");
                }
                else
                {
                    TestMB001Rule rule = new TestMB001Rule();
                    client = rule.InvokeWcf();
                    Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:18051/MB.ERP.BaseLibrary.MPrivilege.IFace/IBfEmployee.svc");
                    Debug.Assert(string.IsNullOrEmpty(client.ClientCredentials.Windows.ClientCredential.Domain));
                    Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator");
                    Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password");
                }

                TestMB002Rule rule002 = new TestMB002Rule();
                client = rule002.InvokeWcf();
                Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:18051/MB.ERP.BaseLibrary.MPrivilege.IFace/IBfEmployee.svc");
                Debug.Assert(string.IsNullOrEmpty(client.ClientCredentials.Windows.ClientCredential.Domain));
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password");


                TestMainRule mainRule = new TestMainRule();
                client = mainRule.InvokeWcf();
                Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:18051/MB.ERP.BaseLibrary.MPrivilege.IFace/IBfEmployee.svc");
                Debug.Assert(string.IsNullOrEmpty(client.ClientCredentials.Windows.ClientCredential.Domain));
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password");

                TestMainRuleWithoutAtt mainRuleWithoutAtt = new TestMainRuleWithoutAtt();
                client = mainRuleWithoutAtt.InvokeWcf();
                Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:18051/Service1.svc");
                Debug.Assert(string.IsNullOrEmpty(client.ClientCredentials.Windows.ClientCredential.Domain));
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password");

                TestCreateWcfClientWithoutAtt noAtt = new TestCreateWcfClientWithoutAtt();
                client = noAtt.InvokeWcf();
                Debug.Assert(client.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:18051/IBfEmployee.svc");
                Debug.Assert(string.IsNullOrEmpty(client.ClientCredentials.Windows.ClientCredential.Domain));
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.UserName == "administrator");
                Debug.Assert(client.ClientCredentials.Windows.ClientCredential.Password == "password");
            }

            BfEmployeeClient clientBinding = null;
            TestIndicateBindingConfigWithOutReplaceLastDot bindingTest = new TestIndicateBindingConfigWithOutReplaceLastDot();

            clientBinding = bindingTest.InvokeWcf();
            Debug.Assert(clientBinding.Endpoint.Address.Uri.ToString() == @"http://192.168.0.1:18051/MB.InfoCloud.Common.Hosts/OnlineSales.11.22.33/IBillDayCheckout.svc");
            Debug.Assert(string.IsNullOrEmpty(clientBinding.ClientCredentials.Windows.ClientCredential.Domain));
            Debug.Assert(clientBinding.ClientCredentials.Windows.ClientCredential.UserName == "administrator");
            Debug.Assert(clientBinding.ClientCredentials.Windows.ClientCredential.Password == "password");
            Debug.Assert(clientBinding.Endpoint.Binding.CloseTimeout == new TimeSpan(0, 15, 0));

            Console.WriteLine("OK");
            Console.ReadLine();
        }
Esempio n. 5
0
        public BfEmployeeClient InvokeWcf()
        {
            BfEmployeeClient proxy = MB.WcfClient.WcfClientFactory.CreateWcfClient <BfEmployeeClient>(this);

            return(proxy);
        }