<MessageValidation> attributes

Set to true to specify that the policy should be run in a thread pool different than the pool servicing the request/response flow. Default is false.

Note: This setting is only used for for internal optimization. Contact Apigee support at the Support Portal for more information.

false

Optional

continueOnError

Most policies are expected to return an error when a failure occurs. By setting this attribute to true, Flow execution continues on failure.

false

Optional

enabled

Determines whether a policy is enforced or not. If set to false, a policy is 'turned off', and not enforced (even though the policy remains attached to a Flow).

true

Optional

name

The internal name of the policy. Characters you can use in the name are restricted to: A-Z0-9._\-$ %. However, the Edge management UI enforces additional restrictions, such as automatically removing characters that are not alphanumeric.

Optionally, use the <DisplayName> element to label the policy in the management UI proxy editor with a different, natural-language name.

N/A

Required

<Source> element

Identifies the source message to be validated.

If you do not provide a <Source> value, a value of message is used.

If the <Source> variable cannot be resolved, or resolves to a non-message type, then one of the following occurs:

If the source variable resolves to a null value in the message flow, a steps.messagevalidation.SourceMessageNotAvailable error code is thrown.

If the source variable resolves to a non-message value, a steps.messagevalidation.NonMessageVariable error code is thrown.

<Source>mymessage</Source>

Default:

request

Presence:

Optional

Type:

String

<ResourceURL> element

Identifies the XSD schema or WSDL definition to be used to validate the source message.

If a <ResourceURL> value is not specified, the message is checked for:

Well-formed XML if the content-type is application/xml

Well-formed JSON if the content-type is application/json

If the WSDL does not have schemas or if the maximum import depth exceeds 10, message validation will fail.

<ResourceURL>xsd://sample</ResourceURL>

Default:

wsdl://<name>

Presence:

Optional

Type:

String

<SOAPMessage> element

Provides the SOAP version against which to validate SOAP messages.

<SOAPMessage version="1.1/1.2"/>

Default:

N/A

Presence:

Optional

Type:

N/A

Attributes

Attribute

Description

Default

Valid values

Presence

version

Identifies the SOAP version against which to validate SOAP messages.

None

1.1

1.2

1.1/1.2

Optional

<Element> element

Specifies the root, or parent, element of the messages to be validated.

SourceMessageNotAvailable {0} message is not available for MessageValidation: {1}

NoElements

Resource "{0}" has no element definitions

Failed

MessageValidation {0} failed with reason: "{1}"

Schemas

Each policy type is defined by an XML schema (.xsd). For reference, policy schemas are available on GitHub.

Usage notes

The MessageValidation Policy type enables you to configure API proxies to reject messages that do not conform to schema (.xsd) or WSDL definition(s). That means developers building apps to consume your API are immediately notified if they are submitting non-conformant requests. Message validation helps developers by indicating where XML tags may not be properly closed, for example. Validation also protects backend services by blocking XML or SOAP messages who structure might cause unpredictable behavior.

Validation can save you a call to tech support, and can help developers avoid time in the forums trying to find troubleshooting help. If developers are notified that they are submitting invalid requests, they can refer to the XML schema for the API to understand how to fix the error. This makes well-understood XML schemas a key component of your API documentation.

Apigee Edge enables you to configure your API with a MessageValidation policy that validates messages with the XML payload.

The policy validates that an XML or JSON message is well-formed, and that the SOAP format is correct according to the specified XSD or WSDL file, ensuring that tags are balanced. If the XML configuration is incomplete, the policy returns a message validation error.