General Information
Policy Type
Description
XML Schema Validation policy validates XML request/response bodies against XML Schema (XSD) definitions. It ensures that XML data conforms to the specified schema structure, types, and constraints before processing or forwarding. It can validate against custom schemas or against the WSDL specification.Endpoints
List Policies
Add Policy
Update Policy
Delete Policy
List Policies
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
Response
Success Response (200 OK)
cURL Example
Add Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example - Custom Schema Validation
Full JSON Body Example - Validate Against WSDL Specification
Request Body Fields
operationMetadata
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| targetScope | string | Yes | - | Policy scope: ALL or ENDPOINT |
| targetEndpoint | string | No* | - | Endpoint path (required if targetScope=ENDPOINT) |
| targetEndpointHTTPMethod | string | No* | - | HTTP method (required if targetScope=ENDPOINT) |
| targetPipeline | string | Yes | - | Pipeline: REQUEST, RESPONSE, or ERROR |
| deploy | boolean | No | true | Whether to deploy after adding policy |
| deployTargetEnvironmentNameList | array | No | [] | List of environment names to deploy to |
| order | integer | No | null | Policy execution order (starts from 1) |
ALL- Policy applies to all endpointsENDPOINT- Policy applies only to specified endpoint
REQUEST- Executes in request pipeline (validates request body)RESPONSE- Executes in response pipeline (validates response body)ERROR- Executes in error pipeline
GET,POST,PUT,DELETE,PATCH,OPTIONS,HEAD
policy
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| type | string | Yes | - | Policy type: policy-xml-schema-validation |
| description | string | No | - | Policy description |
| active | boolean | No | true | Whether policy is active |
| pathForBody | string | No | - | XPath expression to locate XML body to validate |
| validateAgainstSpec | boolean | No | false | Validate against WSDL specification instead of custom schemas |
| schemaDefinitionList | array | No* | [] | List of XML schema definitions (required if validateAgainstSpec=false) |
XPath Examples
/- Root of XML document/root- Root element named “root”/root/data- Data element under root/soap:Envelope/soap:Body/*- SOAP body content
Note
- If
validateAgainstSpec: false,schemaDefinitionListmust contain at least one schema definition. - If
validateAgainstSpec: true, validation uses the WSDL specification from the API Proxy (schemaDefinitionList is ignored).
schemaDefinitionList
Each schema definition is an object with the following fields:| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| schemaNo | integer | No | 0 | Schema number (for ordering multiple schemas) |
| schemaBody | string | Yes | - | XML Schema (XSD) definition (XML string) |
| systemId | string | No | null | System ID for schema reference |
| targetNamespace | string | No | null | Target namespace extracted from schema |
| rootSchema | boolean | No | false | Whether this is the root schema |
XML Schema Format
TheschemaBody must be a valid XML Schema (XSD). Example:
Schema Numbering
schemaNois used for ordering when multiple schemas are defined- Schemas are validated in order
rootSchema: trueindicates the primary schema
Response
Success Response (200 OK)
cURL Example
Update Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example
Response
Success Response (200 OK)
Delete Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example
Response
Success Response (200 OK)
Notes and Warnings
-
XPath:
pathForBodymust be a valid XPath expression pointing to the XML to validate -
Schema Definition:
- If
validateAgainstSpec: false,schemaDefinitionListmust contain at least one schema definition - If
validateAgainstSpec: true, validation uses WSDL specification (schemaDefinitionList ignored)
- If
-
XML Schema:
schemaBodymust be a valid XML Schema (XSD) definition -
Schema Number:
schemaNois used for ordering when multiple schemas are defined -
Root Schema: Set
rootSchema: truefor the primary schema - Target Namespace: Extracted automatically from schema or can be specified manually
- System ID: Used for schema references (import/include)
- Validation Failure: When validation fails, the request/response is rejected with an error
- Performance: Schema validation adds processing overhead. Use for critical validation only.
-
Pipeline:
REQUESTpipeline validates request body before processingRESPONSEpipeline validates response body before sending to client
-
WSDL Specification: When
validateAgainstSpec: true, uses schemas from the API Proxy’s WSDL - Error Messages: Configure error messages in the policy to customize validation error responses
-
Deployment: Policy changes require deployment to take effect. Set
deploy: trueor deploy manually.
Related Documentation
- List Policies - List all policies
- Add Policy - General policy addition guide
- Update Policy - General policy update guide
- Delete Policy - General policy deletion guide
- JSON Schema Validation Policy - Validate JSON messages

