Esempio n. 1
0
        static void Main(string[] args)
        {
            #region example using ChannelFactory<T> directly
            //ChannelFactory<IEvalService> cf =
            //    new ChannelFactory<IEvalService>("WSHttpBinding_IEvalService");
            //IEvalService channel = cf.CreateChannel();
            #endregion

            Console.WriteLine("Retrieving endpoints via MEX...");

            ServiceEndpointCollection endpoints =
                MetadataResolver.Resolve(typeof(IEvalService),
                                         new EndpointAddress("http://localhost:8080/evals/mex"));

            foreach (ServiceEndpoint se in endpoints)
            {
                EvalServiceClient channel =
                    new EvalServiceClient(se.Binding, se.Address);

                try
                {
                    EvalServiceLibrary.Eval eval =
                        new EvalServiceLibrary.Eval("Aaron", "I'm really liking this");
                    channel.SubmitEval(eval);
                    channel.SubmitEval(eval);

                    List <EvalServiceLibrary.Eval> evals = channel.GetEvals();
                    Console.WriteLine("Number of evals: {0}", evals.Count);

                    #region async example
                    //channel.GetEvalsCompleted += new EventHandler<GetEvalsCompletedEventArgs>(channel_GetEvalsCompleted);
                    //channel.GetEvalsAsync();
                    //Console.WriteLine("Waiting...");
                    //Console.ReadLine();
                    #endregion

                    channel.Close();
                }
                catch (FaultException fe)
                {
                    Console.WriteLine("FaultException handler: {0}",
                                      fe.GetType());
                    channel.Abort();
                }
                catch (CommunicationException ce)
                {
                    Console.WriteLine("CommunicationException handler: {0}",
                                      ce.GetType());
                    channel.Abort();
                }
                catch (TimeoutException te)
                {
                    Console.WriteLine("TimeoutException handler: {0}",
                                      te.GetType());
                    channel.Abort();
                }
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            #region example using ChannelFactory<T> directly
            //ChannelFactory<IEvalService> cf =
            //    new ChannelFactory<IEvalService>("WSHttpBinding_IEvalService");
            //IEvalService channel = cf.CreateChannel();
            #endregion

            Console.WriteLine("Retrieving endpoints via MEX...");

            ServiceEndpointCollection endpoints =
                MetadataResolver.Resolve(typeof(IEvalService),
                    new EndpointAddress("http://localhost:8080/evals/mex"));

            foreach (ServiceEndpoint se in endpoints)
            {
                EvalServiceClient channel =
                    new EvalServiceClient(se.Binding, se.Address);

                try
                {
                    EvalServiceLibrary.Eval eval =
                        new EvalServiceLibrary.Eval("Aaron", "I'm really liking this");
                    channel.SubmitEval(eval);
                    channel.SubmitEval(eval);

                    List<EvalServiceLibrary.Eval> evals = channel.GetEvals();
                    Console.WriteLine("Number of evals: {0}", evals.Count);

                    #region async example
                    //channel.GetEvalsCompleted += new EventHandler<GetEvalsCompletedEventArgs>(channel_GetEvalsCompleted);
                    //channel.GetEvalsAsync();
                    //Console.WriteLine("Waiting...");
                    //Console.ReadLine();
                    #endregion

                    channel.Close();
                }
                catch (FaultException fe)
                {
                    Console.WriteLine("FaultException handler: {0}",
                        fe.GetType());
                    channel.Abort();
                }
                catch (CommunicationException ce)
                {
                    Console.WriteLine("CommunicationException handler: {0}",
                        ce.GetType());
                    channel.Abort();
                }
                catch (TimeoutException te)
                {
                    Console.WriteLine("TimeoutException handler: {0}",
                        te.GetType());
                    channel.Abort();
                }
            }
        }
Esempio n. 3
0
 public void SubmitEvalAsync(EvalServiceLibrary.Eval eval, object userState)
 {
     if ((this.onBeginSubmitEvalDelegate == null))
     {
         this.onBeginSubmitEvalDelegate = new BeginOperationDelegate(this.OnBeginSubmitEval);
     }
     if ((this.onEndSubmitEvalDelegate == null))
     {
         this.onEndSubmitEvalDelegate = new EndOperationDelegate(this.OnEndSubmitEval);
     }
     if ((this.onSubmitEvalCompletedDelegate == null))
     {
         this.onSubmitEvalCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnSubmitEvalCompleted);
     }
     base.InvokeAsync(this.onBeginSubmitEvalDelegate, new object[] {
         eval
     }, this.onEndSubmitEvalDelegate, this.onSubmitEvalCompletedDelegate, userState);
 }
 public System.Threading.Tasks.Task SubmitEvalAsync(EvalServiceLibrary.Eval eval)
 {
     return(base.Channel.SubmitEvalAsync(eval));
 }
 public void SubmitEval(EvalServiceLibrary.Eval eval)
 {
     base.Channel.SubmitEval(eval);
 }
 public EvalServiceLibrary.Eval SubmitEval(EvalServiceLibrary.Eval eval)
 {
     return(base.Channel.SubmitEval(eval));
 }
Esempio n. 7
0
 public void SubmitEvalAsync(EvalServiceLibrary.Eval eval)
 {
     this.SubmitEvalAsync(eval, null);
 }
Esempio n. 8
0
 private System.IAsyncResult OnBeginSubmitEval(object[] inValues, System.AsyncCallback callback, object asyncState)
 {
     EvalServiceLibrary.Eval eval = ((EvalServiceLibrary.Eval)(inValues[0]));
     return(this.BeginSubmitEval(eval, callback, asyncState));
 }
Esempio n. 9
0
 public System.IAsyncResult BeginSubmitEval(EvalServiceLibrary.Eval eval, System.AsyncCallback callback, object asyncState)
 {
     return(base.Channel.BeginSubmitEval(eval, callback, asyncState));
 }