public string echo(string message) { if (!Connected) { throw new Exception("Not Connected"); } try { return(proxy.Echo(message)); } catch (Exception x) { return(x.Message); } }
//public bool Connect(string url) //{ // serviceUrl = url; // return Connect(); //} public bool Connect() { try { var binding = new BasicHttpBinding(BasicHttpSecurityMode.None); var endpoint = new EndpointAddress(serviceUrl); var factory = new ChannelFactory <fiskaltrust.ifPOS.v0.IPOS>(binding, endpoint); proxy = factory.CreateChannel(); proxy.Echo(DateTime.Now.ToString()); } catch (Exception) { proxy = null; } return(Connected); }
//public bool Connect(string url) //{ // serviceUrl = url; // return Connect(); //} public bool Connect() { try { var binding = new BasicHttpBinding(BasicHttpSecurityMode.None); var endpoint = new EndpointAddress(serviceUrl); var factory = new ChannelFactory<fiskaltrust.ifPOS.v0.IPOS>(binding, endpoint); proxy = factory.CreateChannel(); proxy.Echo(DateTime.Now.ToString()); } catch (Exception) { proxy = null; } return Connected; }