public object Create(
            object parent,
            object configContext,
            System.Xml.XmlNode section)
        {
            string callingAssemblyName = System.Reflection.Assembly.GetCallingAssembly().GetName().Name;
            string timeStamp           = DateTime.Now.ToString();
            string message             = "";

            try
            {
                message = "Attempting to deserialize a configuration object based on a configuration section node.";
                //Ram
                _avaLog.Debug(string.Format(GetDateTimeStamp() + ",DEBUG," + message));
                //Debug.WriteLine(GetDateTimeStamp()+ ",DEBUG," + message);

                XPathNavigator nav      = section.CreateNavigator();
                string         typename = ( string )nav.Evaluate("string(@type)");

                message = "Object to deserialize: " + typename;
                //Debug.WriteLine(GetDateTimeStamp()+ ",DEBUG," + message);
                _avaLog.Debug(string.Format(GetDateTimeStamp() + ",DEBUG," + message));

                Type          t   = Type.GetType(typename);
                XmlSerializer ser = new XmlSerializer(t);
                return(ser.Deserialize(new XmlNodeReader(section)));
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine(ex);
#endif
                message = "Failed to deserialize object. " + ex.Message;
                //Trace.WriteLine(GetDateTimeStamp()+ ",ERROR," + message);
                _avaLog.Error(GetDateTimeStamp() + ",ERROR," + message);
                throw;
            }
        }
コード例 #2
0
        public ProxyGetTaxResult GetTax(ProxyGetTaxRequest GetTaxRequest)
        {
            AvaLogger _avaLog = AvaLogger.GetLogger();
            Perf      monitor = new Perf();

            monitor.Start();

            object[] results = this.Invoke("GetTax", new object[] {
                GetTaxRequest
            });

            monitor.Stop();
            _avaLog.Debug("GetTax (webservice method): " + monitor.ElapsedSeconds(3).ToString());

            return((ProxyGetTaxResult)(results[0]));
        }
 /// <include file='AddressSvc.Doc.xml' path='adapter/common/members[@name="Constructor"]/*' />
 public AddressSvc()
 {
     try
     {
         _avaLog = AvaLogger.GetLogger();
         _avaLog.Debug(string.Format("Instantiating AddressSvc: {0}", base.UniqueId));
         base.ServiceName = SERVICE_NAME;
         ProxyAddressSvc proxy = new ProxyAddressSvc();
         proxy.ProfileValue = new ProxyProfile();
         proxy.Security     = new ProxySecurity();
         base.SvcProxy      = proxy;
     } catch (Exception ex)
     {
         ExceptionManager.HandleException(ex);
     }
 }
        public PingResult Ping(string message)
        {
            try
            {
                _avaLog.Debug("AddressSvc.Ping");
                ProxyPingResult svcResult = (ProxyPingResult)base.InvokeService(typeof(ProxyAddressSvc), MethodBase.GetCurrentMethod().Name, new object[] { message });

                _avaLog.Debug("Copying result from proxy object");
                PingResult localResult = new PingResult();
                localResult.CopyFrom(svcResult);                                                        //load local object with service results

                return(localResult);
            } catch (Exception ex)
            {
                return(PingResult.CastFromBaseResult(ExceptionManager.HandleException(ex)));
            }
        }