Handling SOAP Exceptions In Microsoft Dynamics CRM

The only exception thrown by the CRM Web service is a common

SoapException whose message property is always “Server was unable to process



To handle that exception, catch the exception and display the InnerXml error

code, error text, and error description






// Delete the non-existent Contact

service.Delete(EntityName.contact.ToString(), contactGuid);


catch (SoapException ex)


// This will contain the error message from the platform

Console.WriteLine(“Microsoft Dynamics CRM Error



// The InnerXml contains the details of the error in a

parsable XML format

XmlDocument error = new XmlDocument();


// Render out the details of the error

Console.WriteLine(“Error Code: ” +


Console.WriteLine(“Error Description: ” +


Console.WriteLine(“Error Type: ” +





Author: Arvind Singh

Solution Architect with 15+ years of exp. Dynamics CRM, Power Platform, Azure which includes Solution, Design, Development, Deployment, Maintenance and support experience.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: