Soap Request FaultException.Detail is always empty

380 Views Asked by At

I am using a third party service & hence has no access to change anything from service side. I WSDL which I added as connect service.

The problem is that I have enabled the raw request & I can see error details in trace or debug log. But When I try to fetch details using following code it always return empty Detail Object.

try {
   // my code to call service
}
catch (System.ServiceModel.FaultException<Error[]> errors) {
    var err = Newtonsoft.Json.JsonConvert.SerializeObject(errors.Detail)
    Console.WriteLine(err);
}
1

There are 1 best solutions below

1
VisualBean On

Edit: looks to be a duplicate of FaultException.Detail coming back empty

The problem was the visual studio didn't quite map out the ErrorDetail objects right. The ErrorDetail node is called "ErrorDetail", but the type generated for it is "ErrorDetailType." I edited the reference.cs class generated for each service I was using and added a TypeName: