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);
}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

A WordPress.com Website.

Up ↑

%d bloggers like this: