SoapFaultException
This commit is contained in:
parent
04bf10f65c
commit
d512a8afc4
19
Program.cs
19
Program.cs
@ -398,11 +398,24 @@ internal class Plat_integ
|
||||
}
|
||||
}
|
||||
|
||||
int rowsAffected = await cmdUpdate.ExecuteNonQueryAsync();
|
||||
public static void VerificarRespostaSOAP(string responseXml)
|
||||
{
|
||||
var doc = XDocument.Parse(responseXml);
|
||||
XNamespace env = "http://schemas.xmlsoap.org/soap/envelope/";
|
||||
XNamespace tns = "http://xmlns.energia.org.br/FM/v2";
|
||||
|
||||
if (rowsAffected == 1)
|
||||
var fault = doc.Descendants(env + "Fault").FirstOrDefault();
|
||||
if (fault != null)
|
||||
{
|
||||
Console.WriteLine("atualizado");
|
||||
string faultCode = fault.Element("faultcode")?.Value ?? "";
|
||||
string faultString = fault.Element("faultstring")?.Value ?? "";
|
||||
|
||||
var detail = fault.Element("detail")?.Descendants().First();
|
||||
string errorCode = detail?.Element(tns + "errorCode")?.Value ?? "";
|
||||
string message = detail?.Element(tns + "message")?.Value ?? "";
|
||||
|
||||
throw new SoapFaultException(faultCode, faultString, errorCode, message);
|
||||
}
|
||||
}
|
||||
|
||||
public class RateLimiter
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user