public HisProviderH00021() { if (_HISClient == null) { _HISClient = new RequestWsProvider <IHisApplay>("H" + _HOSPITALID).ReqClient; } }
public HisProviderH00020() { try { if (_HISClient == null) { _HISClient = new RequestWsProvider <IHisApplay>("H" + _HOSPITALID).ReqClient; } if (WS == null) { WS = new WebServiceAgent("HisUrl".ConfigValue()); } } catch (Exception) { } }
public static string Call(string url, string methodName, params string[] args) { BasicHttpBinding binding = new BasicHttpBinding(); binding.ReaderQuotas = new XmlDictionaryReaderQuotas() { MaxStringContentLength = 2147483647 }; EndpointAddress endpoint = new EndpointAddress(url); using (ChannelFactory <IHisApplay> channelFactory = new ChannelFactory <IHisApplay>(binding, endpoint)) { IHisApplay instance = channelFactory.CreateChannel(); using (instance as IDisposable) { try { string TradeOut = string.Empty; instance.RunService(args[0], args[1], ref TradeOut); return(TradeOut); //Type type = typeof(IHisApplay); //MethodInfo mi = type.GetMethod(methodName); //mi.Invoke(instance, args); //return args[2].ToString(); } catch (TimeoutException tErr) { (instance as ICommunicationObject).Abort(); throw tErr; } catch (CommunicationException cErr) { (instance as ICommunicationObject).Abort(); throw cErr; } catch (Exception vErr) { (instance as ICommunicationObject).Abort(); throw vErr; } } } }
/// <summary> /// ping通网络测试 /// </summary> /// <returns></returns> public static void PingCall(ref System.DateTime TradeMsgOut) { BasicHttpBinding binding = new BasicHttpBinding(); binding.ReaderQuotas = new XmlDictionaryReaderQuotas() { MaxStringContentLength = 2147483647 }; EndpointAddress endpoint = new EndpointAddress(WCFaddr); using (ChannelFactory <IHisApplay> channelFactory = new ChannelFactory <IHisApplay>(binding, endpoint)) { IHisApplay instance = channelFactory.CreateChannel(); using (instance as IDisposable) { try { TradeMsgOut = instance.PCall(); // return TradeMsgOut; } catch (TimeoutException tErr) { (instance as ICommunicationObject).Abort(); throw tErr; } catch (CommunicationException cErr) { (instance as ICommunicationObject).Abort(); throw cErr; } catch (Exception vErr) { (instance as ICommunicationObject).Abort(); throw vErr; } } } }