You need to sign in to do that
Don't have an account?
alexsummers
Exception code description
Good Day!
Is there a way to get the Exception code description? I'm using partner 5 and C#.NET
Thanks in advance
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Good Day!
Is there a way to get the Exception code description? I'm using partner 5 and C#.NET
Thanks in advance
Hi alexsummers,
Here, this will work.
private void btnException_Click(object sender, System.EventArgs e)
{
try
{
//Some kind of web service call.
}
catch (System.Web.Services.Protocols.SoapException ex)
{
System.Diagnostics.Trace.WriteLine("Status: " + GetSoapExceptionStatusCode(ex) + ", Message: " + GetSoapExceptionMessage(ex));
}
}
private string GetSoapExceptionMessage(System.Web.Services.Protocols.SoapException ex)
{
System.Xml.XmlNode faultDetail = ex.Detail.ChildNodes.Item(1);
System.Xml.NameTable nt = new System.Xml.NameTable();
System.Xml.XmlNamespaceManager xnm = new System.Xml.XmlNamespaceManager(nt);
xnm.AddNamespace(faultDetail.Prefix, faultDetail.NamespaceURI);
return faultDetail.SelectSingleNode(faultDetail.Prefix + ":exceptionMessage", xnm).InnerText;
}
private string GetSoapExceptionStatusCode(System.Web.Services.Protocols.SoapException ex)
{
System.Xml.XmlNode faultDetail = ex.Detail.ChildNodes.Item(1);
System.Xml.NameTable nt = new System.Xml.NameTable();
System.Xml.XmlNamespaceManager xnm = new System.Xml.XmlNamespaceManager(nt);
xnm.AddNamespace(faultDetail.Prefix, faultDetail.NamespaceURI);
return faultDetail.SelectSingleNode(faultDetail.Prefix + ":exceptionCode", xnm).InnerText;
}