Go to new doc!

+49 228 5552576-0


info@predic8.com

validator

Can be used in

serviceProxy

Syntax

				<validator
					wsdl="location"?
					schema="location"?
					schematron="location"?
					jsonSchema="location"?
					failureHandler="handler"?
					skipFaults="[true,false]"?
				/>
			
Listing 1: validator Syntax

Samples

The following example shows how to validate requests and responses against the referenced WSDL and included Schemas.

				<serviceProxy port="8080">
					<validator
						wsdl="http://www.predic8.com:8080/material/ArticleService?wsdl" />
				</serviceProxy>			
			
Listing 234: validator Example

The following example shows how to validate XML content. The requests will be validated against the order.xsd Schema, while for responses the confirm.xsd schema will be used for validation.

				<serviceProxy port="8080">
					<request>
						<validator
							schema="http://www.predic8.com/schemas/order.xsd" />
					</request>
					<response>
						<validator
							schema="http://www.predic8.com/schemas/confirm.xsd" />
					</response>
				</serviceProxy>			
			
Listing 234: validator Example

The following example shows how to validate XML using a Schematron XML file.

				<serviceProxy port="8080">
					<request>
						<validator
							schema="examples/validation/schematron/car-schematron.xml"
							failureHandler="log" />
					</request>
				</serviceProxy>			
			
Listing 234: validator Example

Attributes

Name Mandatory Default Description Example
wsdl no null The WSDL (URL or file) to validate against. http://predic8.com:8080/material/ArticleService?wsdl
schema no null The XSD Schema (URL or file) to validate against. http://www.predic8.com/schemas/order.xsd
schematron no null The Schematron schema (URL or file) to validate against. examples/validation/schematron/car-schematron.xml
jsonSchema no null The JSON Schema (URL or file) to validate against. examples/validation/json-schema/schema2000.json
failureHandler no response If "response", the HTTP response will include a detailled error message. If "log", the response will be generic and the validation error will be logged. log
skipFaults no false Whether to skip validation for SOAP fault messages. true

The <validator> element must have exactly one of the {wsdl,schema,schematron,jsonSchema} attributes.

As a child of soapProxy, if no attributes are present, the soapProxy-parent's wsdl attribute is used.

Flow

This interceptor is by default applied to both requests and responses. By wrapping it in an <request>...</request> (or <response>...</response>) element, you can select to apply it only to requests (or only to responses). See request and response.