public static string GetSoapFaultDetailBody(string soapBody)
{
string detailBody = null;
string elementName = null;
XmlDocument doc = new XmlDocument();
doc.LoadXml(soapBody);
// Prepare XPath
string soapVersion = Common.GetConfigurationPropertyValue("SoapVersion", site);
if (string.Compare(soapVersion, "SOAP11", true) == 0)
{
elementName = "detail";
}
if (string.Compare(soapVersion, "SOAP12", true) == 0)
{
elementName = "Detail";
}
// [Note] According to SOAP1.1 and SOAP 1.2 definitions, SOAP1.1 defines subelement 'detail' in SOAP Fault element, SOAP1.2 defines subelement "Detail". But actually, whether the soap fault response message are formatted
// with SOAP 1.1 or 1.2, the subelement name in O12, O14 and O15 response is still "detail".
string path = string.Format("//{0}", elementName.ToLower());
XmlNode detailNode = doc.SelectSingleNode(path);
XmlElement detailElement = (XmlElement)detailNode;
detailElement.SetAttribute("xmlns", detailNode.FirstChild.NamespaceURI);
detailBody = detailElement.OuterXml;
return detailBody;
}