using System;
using System.Configuration;
using System.Xml.Serialization;
namespace Endpoint
{
public class SoapEndpointConfiguration : ConfigurationElement, IHttpEndpointConfiguration
{
///
/// Gets or sets the name.
///
/// The name.
[ConfigurationProperty("name", DefaultValue = "", IsKey = true, IsRequired = true)]
public string Name
{
get { return (string)base["name"]; }
set { base["name"] = value; }
}
///
/// URI of the service
///
[XmlIgnore]
public Uri Uri
{
get { return new Uri(UriString); }
}
///
/// Gets or sets the URI string.
///
/// The URI string.
[ConfigurationProperty("uri", DefaultValue = "", IsKey = false, IsRequired = true)]
public string UriString
{
get { return (string)base["uri"]; }
set { base["uri"] = value; }
}
///
/// Gets or sets the xpath query for the html document
///
/// The xpath query.
[ConfigurationProperty("xpathQuery", DefaultValue = "", IsKey = false, IsRequired = true)]
public string XpathQuery
{
get { return (string)base["xpathQuery"]; }
set { base["xpathQuery"] = value; }
}
///
/// Gets or sets the namespaces used in the xpath query
///
/// The xpath namespaces.
[ConfigurationProperty("xpathNamespaces", DefaultValue = "", IsKey = false, IsRequired = false)]
public string XpathNamespaces
{
get { return (string)base["xpathNamespaces"]; }
set { base["xpathNamespaces"] = value; }
}
///
/// Gets or sets the expected query results.
///
/// The expected query results.
[ConfigurationProperty("expectedXpathResult", DefaultValue = "", IsKey = false, IsRequired = true)]
public string ExpectedXpathResult
{
get { return (string)base["expectedXpathResult"]; }
set { base["expectedXpathResult"] = value; }
}
///
/// Gets or sets the SOAP action.
///
/// The post.
[ConfigurationProperty("soapAction", DefaultValue = "", IsKey = false, IsRequired = true)]
public string SoapAction
{
get { return (string)base["soapAction"]; }
set { base["soapAction"] = value; }
}
///
/// Gets or sets the SOAP request.
///
/// The post.
[ConfigurationProperty("soapRequest", DefaultValue = "", IsKey = false, IsRequired = true)]
public string SoapRequest
{
get { return (string)base["soapRequest"]; }
set { base["soapRequest"] = value; }
}
}
///
///
///
public class SoapEndpointConfigurationCollection : ConfigurationElementCollection
{
///
/// When overridden in a derived class, creates a new .
///
///
/// A new .
///
protected override ConfigurationElement CreateNewElement()
{
return new SoapEndpointConfiguration();
}
///
/// Gets the element key for a specified configuration element when overridden in a derived class.
///
///
/// An that acts as the key for the specified .
///
/// The to return the key for.
protected override object GetElementKey(ConfigurationElement element)
{
return ((SoapEndpointConfiguration)element).Name;
}
}
///
///
///
public class SoapEndpointConfigurationSection : ConfigurationSection
{
[ConfigurationProperty("endpoints")]
public SoapEndpointConfigurationCollection Endpoints { get { return (SoapEndpointConfigurationCollection)(base["endpoints"]); } }
}
}