#region BuildSoapFault
///
/// Build a custom soap error message
///
/// The string to add to the message
///
///
private SoapException BuildSoapFault(string message)
{
// Build the detail element of the SOAP fault.
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlNode node = doc.CreateNode(XmlNodeType.Element,
SoapException.DetailElementName.Name,SoapException.DetailElementName.Namespace);
// Build specific details for the SoapException.
// Add first child of detail XML element.
System.Xml.XmlNode details =
doc.CreateNode(XmlNodeType.Element, "mySpecialInfo1",
"http://tempuri.org/");
System.Xml.XmlNode detailsChild =
doc.CreateNode(XmlNodeType.Element, "childOfSpecialInfo",
"http://tempuri.org/");
details.AppendChild(detailsChild);
// Add second child of detail XML element with an attribute.
System.Xml.XmlNode details2 = doc.CreateNode(XmlNodeType.Element, "mySpecialInfo2",
"http://tempuri.org/");
XmlAttribute attr = doc.CreateAttribute("t", "attrName",
"http://tempuri.org/");
attr.Value = "attrValue";
details2.Attributes.Append(attr);
// Append the two child elements to the detail node.
node.AppendChild(details);
node.AppendChild(details2);
SoapException se = new SoapException(message,
SoapException.ServerFaultCode,
Context.Request.Url.AbsoluteUri ,
node);
return se;
}
#endregion