![](../images/icons/arrow_down.png)
Configurations for this component cannot be used as a proxy to call other services.
Neither to validate attached, nor to intercept and validate messages on the fly.
Interceptors would better fit this kind of use case.
\\
The validated / filtered content is always the payload from the input message.
h1. Creating a XML Validation service (Provides mode)
Each Validation service runs on the Petals Validation component.
The Petals Validation component has native operations to invoke. These operations are inherited by the Validation services.
A Validation service cannot add additional operations. It only has the ones of the XSLT component.
The version 1.1 of the Petals Validation component exposes two operations.
* *validate*: the received message is validated against a XML-Schema. The service returns a boolean response indicating if the message is valid.
* *filter*: the received message is validated against a XML-Schema. If the message is valid, this same message is returned. Otherwise, a fault is raised.
h2. The "validate" operation
The fully qualified name of this operation is:
* Name space URI: *{html}http://petals.ow2.org/components/validation/version-1{html}\*
* Local part: *validate*
\\
This operation only supports the *InOut* message exchange pattern (MEP).
When invoking this operation, you must call it using its fully qualified name.
\\
Here is the execution flow for this operation:
# The received message is validated against the XML-Schema embedded by the service.
# The validation response is wrapped into a message and sent back.
\\
More precisely, if the message is valid, the returned message is
{code:lang=xml}
<!-- The target name space depends on the version of the Validation component -->
<tns:validateResponse xmlns:tns='http://petals.ow2.org/components/validation/version-1'>
<tns:valid>true</tns:valid>
</tns:validateResponse>
{code}
\\
Otherwise, it is
{code:lang=xml}
<!-- The target name space depends on the version of the Validation component -->
<tns:validateResponse xmlns:tns='http://petals.ow2.org/components/validation/version-1'>
<tns:valid>false</tns:valid>
<tns:comment>The reason explaining why it is invalid.</tns:comment>
</tns:validateResponse>
{code}
h2. The "filter" operation
The fully qualified name of this operation is:
* Name space URI: *{html}http://petals.ow2.org/components/validation/version-1{html}\*
* Local part: *filter*
\\
This operation only supports the *InOut* message exchange pattern (MEP).
When invoking this operation, you must call it using its fully qualified name.
\\
Here is the execution flow for this operation:
# The received message is validated against the XML-Schema embedded by the service.
# If the message is valid, this same message is sent back. Otherwise, a fault is raised.
\\
{code:lang=xml}
<!-- The target name space depends on the version of the Validation component -->
<tns:validationFault xmlns:tns='http://petals.ow2.org/components/validation/version-1'>
<tns:message>The fault message.</tns:message>
<tns:validationFault>
{code}
\\
{warning}
If the operation is invalid (i.e. is neither *validate*, nor *filter*), then *filter* is the operation by default.
{warning}
h2. WSDL definitions
By default, services deployed on the Validation component do not need a WSDL.
However, as a good practice, it is better to provide it one.
The operations are known.
The only unknown is whether the input messages will be *anyType* or the *exact top element of the XML Schema*.
It is let to the choice of the user.
The output message for the operation *filter* should however be described by the XML Schema.
h2. JBI descriptor
The Service Unit descriptor file ( jbi.xml ) looks like this:
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<jbi:jbi version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:validation="http://petals.ow2.org/components/validation/version-1"
xmlns:serviceNs="http://petals.ow2.org/simpletransformation">
<jbi:services binding-component="false">
<jbi:provides
interface-name="serviceNs:ValidationInterface"
service-name="serviceNs:ValidationService"
endpoint-name="ValidationEndpoint">
<!-- WSDL file -->
<petalsCDK:wsdl>your optional description wsdl file.wsdl</petalsCDK:wsdl>
<!-- Validation specific fields -->
<validation:schema>schema.xsd</validation:schema>
</jbi:provides>
</jbi:services>
</jbi:jbi>
{code}
\\
A JBI descriptor for an Validation service-unit can only define one _provides_ block.
\\
{include:0 CDK SU Provide Configuration}
{center}