jueves, 12 de septiembre de 2013

ASP.NET - Capturar excepciones SOAP

FYI: Catching the SoapException

There are quite some posts on the news groups concerning exceptions when calling the Crm webservice, like this: "I'm trying to create an appointment, but I'm getting a 'Service was unable to process request' error." Followed by a large (and usually unuseful) stack trace.
This doesn't give much usable information, only a lot of overhead.
It might be obvious for some what to do, but apparently not for all. So, once and for all, here's what you do:

You catch the SoapException and you look at the Detail.InnerXml property. E.g.
try{ // call crmservice}catch(SoapException ex){ string error = ex.Detail.InnerXml;}
This will give you the real error message. Post this on the news group and people will probably be able to help you.

No hay comentarios:

Publicar un comentario