コード例 #1
0
        static void Main(string[] args)
        {
            try
            {
                InstanceContext site  = new InstanceContext(new CallbackHandler());
                HelloClient     proxy = new HelloClient(site);
                Console.WriteLine("Client");
                proxy.HelloFromClient();

                Console.ReadLine();
                proxy.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #2
0
ファイル: client.cs プロジェクト: spzenk/sfdocsamples
        static void Main()
        {
            // Create a client.
            HelloClient client = new HelloClient();

            // Add a reference-parameter header to the address.
            // Since the EndpointAddress class is immutable, we must use
            // EndpointAddressBuilder to change the value.
            EndpointAddressBuilder builder = new EndpointAddressBuilder(client.Endpoint.Address);
            AddressHeader header = AddressHeader.CreateAddressHeader(IDName, IDNamespace, "John");
            builder.Headers.Add(header);
            client.Endpoint.Address = builder.ToEndpointAddress();

            // Call the Hello service operation.
            Console.WriteLine(client.Hello());

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }
コード例 #3
0
ファイル: client.cs プロジェクト: yongzhao1/dotnet-samples
        static void Main()
        {
            // Create a client.
            HelloClient client = new HelloClient();

            // Add a reference-parameter header to the address.
            // Since the EndpointAddress class is immutable, we must use
            // EndpointAddressBuilder to change the value.
            EndpointAddressBuilder builder = new EndpointAddressBuilder(client.Endpoint.Address);
            AddressHeader          header  = AddressHeader.CreateAddressHeader(IDName, IDNamespace, "John");

            builder.Headers.Add(header);
            client.Endpoint.Address = builder.ToEndpointAddress();

            // Call the Hello service operation.
            Console.WriteLine(client.Hello());

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();

            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate client.");
            Console.ReadLine();
        }