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