Esempio n. 1
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);
        }
Esempio n. 2
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));
            }
        }
Esempio n. 3
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());
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            TestProxy.Service1Client client = new TestProxy.Service1Client();

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