Validating Input Messages

Topics:

Every input message that is received by iWay Application Adapter for Microsoft Dynamics CRM 2011 On-Premises is validated before being sent to Microsoft Dynamics CRM. The validation decreases the load on the target MS CRM system, and provides faster return times in the event of invalid messages.

MS CRM has internal validation rules on many attributes, and it is more efficient to allow MS CRM to validate these values. MS CRM metadata can be changed by customization or updates, so strict validation of messages could prevent the execution of some important operations.

The adapter checks contain a limited set of rules that are required. These rule names are derived from the XML parser exceptions of the same name, which are derived from W3C implementation guidelines. The rules are listed and described in the following table. Validation mechanisms allow checked rules to be easily extended.

Code

Message

Comment

cvc-attribute.3

The value {2} of attribute {1} on element {0} is not valid with respect to its type, {3}.

The input value of the indicated attribute must match the fixed list of attribute values provided.

cvc-complex-type.3.1

The value {2} of attribute {1} of element {0} is not valid with respect to the corresponding attribute use. The attribute {1} has a fixed value of {3}.

The input value of the indicated attribute in a complex type (structure) must match the fixed list of attribute values provided.

cvc-complex-type.4

The attribute {1} must appear on element {0}.

A required attribute for an element in a complex type is missing.

cvc-complex-type.2.4.a

An invalid content was found starting with element {0}. One of {1} is expected.

A required element in a complex type is missing.

cvc-complex-type.2.4.b

The content of element {0} is not complete. One of {1} is expected.

A complete group of elements to form a complex type is not provided, the data is incomplete.

cvc-pattern-valid

The value {0} is not facet-valid with respect to pattern {1} for type {2}.

The data provided is not valid for the pattern defined for the set of values.

cvc-complex-type.2.2

Element {0} must have no element (children), and the value must be valid.

The data defined must not be part of a set, and must match the restrictions defined in the schema.

If the validator fails the input message, then an XML document similar to the one reproduced below is received, which contains an error description:

<crm:account.Create.Response schemaVersion="1.0"
xmlns:crm="urn:iwaysoftware:adapter:MSCRM2011:account:Create.Response"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <crm:Error>cvc-complex-type.2.4.b The content of element
&apos;crm:Params&apos; is not complete. One of
&apos;{&quot;urn:iwaysoftware:adapter:MSCRM2011:account:Create&quot;:accountcategorycode, &quot;urn:iwaysoftware:adapter:MSCRM2011:account:Create&quot;:overriddencreatedon, &quot;urn:iwaysoftware:adapter:MSCRM2011:account:Create&quot;:ownerid, &quot;urn:iwaysoftware:adapter:MSCRM2011:account:Create&quot;:ownershipcode, &quot;urn:iwaysoftware:adapter:MSCRM2011:account:Create&quot;:preferredequipmentid, &quot;urn:iwaysoftware:adapter:MSCRM2011:account:Create&quot;:preferredserviceid}&apos; is expected.
    </crm:Error>
</crm:account.Create.Response>"

The message is taken from the validator without any further processing.

If the validator finds more than one error, then all of the errors will be displayed. The request will not be sent to MS CRM in case of a validation failure.

Validation Level

Due to business reasons, you may have to weaken validation or disable it all together. For this purpose, iWay Application Adapter for Microsoft Dynamics CRM 2011 On-Premises has a special parameter named Validation Level. It is represented as a drop-down list containing the following options:

  • System Required. Only attributes, which have this required level in MS CRM metadata, are mandatory in the input XML.
  • System and Business Required. Attributes having one of these required levels must be marked as required and validated. This is the most strict validation level and is also the level by default.
  • None. No attributes should be marked as mandatory and therefore no attributes are validated.

Note: This parameter affects entity attributes only. Other elements, such as EntityList, are structural elements that must be present in all input messages. These elements are always validated.

For a complete understanding of validation and security, see:

http://msdn.microsoft.com/en-us/library/gg309524.aspx

If this link is not available, then search for the Microsoft MSDN topic called The Security Model of Microsoft Dynamics CRM.

Users are assigned to roles. Privileges are assigned to roles. Privilege depth or access level determine the validation of the System Required, System and Business Required, and None settings of the adapter.

For more information, see Understanding Administrative Credentials.