Extracting values from ServiceReference.ClientConfig

You can open the document as an XDocument and go from there:

var streamInfo = Application.GetResourceStream(new Uri(“ServiceReferences.ClientConfig”, UriKind.Relative));
var config = XDocument.Load(streamInfo.Stream);
var endpoints = from endpoint in config.Descendants(“endpoint”)
where endpoint.Attribute(“name”).Value == endPointName
select new { Address = endpoint.Attribute(“address”).Value };
foreach (var endpoint in endpoints)
{
if (_binding.Security.Mode == BasicHttpSecurityMode.Transport)
{
String address = endpoint.Address.Replace(“http://”, “https://”);
//address = string.Concat(address, “/secure/”);
result = new EndpointAddress(address);
}
else
{
result = new EndpointAddress(endpoint.Address);
}
}

Comments

Leave a comment