Example #1
0
    public static void Main()
    {
        FooProxy proxy = new FooProxy(
            new BasicHttpBinding(),
            new EndpointAddress("http://localhost:8080/"));

        proxy.Open();
        Console.WriteLine(proxy.Echo("TEST FOR ECHO"));
        Console.WriteLine(proxy.Add(1000, 2000));
        Console.WriteLine("done");
    }
Example #2
0
    public static void Main(string [] args)
    {
        bool     bar     = args.FirstOrDefault(s => s == "--bar") != null;
        var      binding = new BasicHttpBinding();
        FooProxy proxy   = new FooProxy(binding,
                                        new EndpointAddress("http://localhost:8080/samplesvc3.svc/" + (bar ? "bar" : "foo")));

        proxy.Open();
        Console.WriteLine(proxy.Echo("TEST FOR ECHO"));
        Console.WriteLine(proxy.Add(1000, 2000));
        Console.WriteLine("done");
    }
Example #3
0
    static void Run(string user, string pass)
    {
        var binding = new BasicHttpBinding();

        binding.Security.Mode =
            BasicHttpSecurityMode.TransportCredentialOnly;
        binding.Security.Transport.ClientCredentialType =
            HttpClientCredentialType.Basic;
        FooProxy proxy = new FooProxy(binding,
                                      new EndpointAddress("http://localhost:8080/auth.svc"));

        proxy.ClientCredentials.UserName.UserName = user;
        proxy.ClientCredentials.UserName.Password = pass;
        proxy.Open();
        Console.WriteLine(proxy.Echo("TEST FOR ECHO"));
        Console.WriteLine(proxy.Add(1000, 2000));
        Console.WriteLine("done");
    }