Пример #1
0
        public void TestMethod1()
        {
            TestProxy.Service1Client client = new TestProxy.Service1Client();

            string data = client.GetData(33);

            client.Close();
        }
Пример #2
0
        static void CallService()
        {
            TestProxy.Service1Client proxy = new TestProxy.Service1Client();

            // Replace "localhost" with "ipv4.fiddler" when trying to capture messages via Fiddler tool
            proxy.Endpoint.Address = new EndpointAddress(
                "http://localhost:8799/Service1.svc"
                );

            string data = proxy.GetData(11);
        }
Пример #3
0
        static void CallService()
        {
            TestProxy.Service1Client client = new TestProxy.Service1Client();
            using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
            {
                HttpRequestMessageProperty httpProps = new HttpRequestMessageProperty();
                httpProps.Headers["User-Agent"] = "Test Client";

                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpProps;

                Console.WriteLine(client.GetData(11));

            }
        }
Пример #4
0
        static void Main(string[] args)
        {
            try
            {
                TestProxy.Service1Client client = new TestProxy.Service1Client();

                using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                {
                    MessageHeader<string> cultureHeader = new MessageHeader<string>("en-US");

                    // Add the culture header into request
                    OperationContext.Current.OutgoingMessageHeaders.Add(
                        cultureHeader.GetUntypedHeader("culture", "urn:wcf:extension")
                        );

                    client.GetData(11);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            TestProxy.Service1Client client = new TestProxy.Service1Client();

            Console.WriteLine(client.GetData(11));
        }