Exemple #1
0
 static void Main(string[] args)
 {
     try
     {
       IStateName proxy = XmlRpcProxyGen.Create<IStateName>();
       RequestResponseLogger dumper = new RequestResponseLogger();
       dumper.Directory = "C:/temp";
       dumper.Attach(proxy);
       Console.WriteLine("Synchronous call");
       string ret = proxy.GetStateName(45);
       Console.WriteLine("state #45 is {0}", ret);
       Console.WriteLine("Asynchronous call");
       IAsyncResult asr = proxy.BeginGetStateName(46);
       asr.AsyncWaitHandle.WaitOne();
       string aret = proxy.EndGetStateName(asr);
       Console.WriteLine("state #46 is {0}", aret);
     }
     catch (XmlRpcFaultException fex)
     {
       Console.WriteLine(fex.FaultString);
     }
     catch (Exception ex)
     {
       Console.WriteLine(ex.Message);
     }
 }
		private void LogXmlTraffic()
		{
			RequestResponseLogger dumper = new RequestResponseLogger
			{
				Directory = ConfigurationManager.AppSettings.Get("NETWORK_LOGGING_PATH")
			};

			if (!Directory.Exists(dumper.Directory))
			{
				Directory.CreateDirectory(dumper.Directory);
			}

			dumper.Attach(this.clientProxy);
		}