private static RoutingInfo GetRoutingInfo() { string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RoutingInfo.xml"); StreamReader reader = new StreamReader(path); XmlSerializer serializer = new XmlSerializer(typeof(RoutingInfo)); RoutingInfo routingInfo = (RoutingInfo)serializer.Deserialize(reader); reader.Close(); return(routingInfo); }
public static bool Route(Package package) { try { RoutingInfo routingInfo = GetRoutingInfo(); byte[] packageBinary = PrepareForTransport(package); foreach (var endpointDetails in routingInfo.Endpoints.Where(e => e.DataType.Contains(package.DataType))) { Uri endpointUri = new Uri(endpointDetails.Address); EndpointAddress endpointAddr = new EndpointAddress(endpointUri); DataRelayWcf.DataRelayServiceClient client = new DataRelayWcf.DataRelayServiceClient("BasicHttpBinding_IDataRelay", endpointAddr); client.Send(packageBinary); } return(true); } catch (Exception ex) { return(false); } }