View Source

{section}
{column}

{warning}This version must be installed on [Petals ESB 5.3.0|petalsesb530:Petals ESB 5.3.0]+{warning}

{multi-excerpt-include:Petals-SE-Validation|name=features|nopanel=true}

{multi-excerpt-include:Petals-SE-Validation|name=recommended-usage|nopanel=true}

{column}

{column:width=350px}{panel:title=Table of contents}{toc:outline=true}{panel}
{panel:title=Contributors}{contributors:order=name|mode=list|showAnonymous=true|showCount=true|showLastTime=true}{panel}
{column}
{section}

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.

This version 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. Service Unit Configuration

All needed information must be defined in the service-unit JBI descriptor. This JBI descriptor is configured through parameters divided in following groups:
* *JBI parameters* that defines the service provider identification,
* *CDK parameters* that are parameters driving the service provider implementation at CDK layer,
* *CDK interceptor parameters* that are parameters driving interceptors at CDK layer,
* *Dedicated parameters* that are parameters driving the service provider implementation at component layer.

{info}A JBI descriptor for an Validation service-unit can only define one _provides_ block.{info}

h3. CDK parameters defining service provider implementation
The following parameters correspond to the CDK configuration of the service provider implementation.

{include:0 CDK SU Provide Configuration 5.8.0}

h3. CDK parameters driving interceptors
The following parameters drive interceptors at CDK layer.

{include:0 CDK SU Interceptor configuration 5.8.0}

h3. Dedicated configuration
The following parameters correspond to the component specific configuration of the service provider implementation.

{table-plus}
|| Parameter || Description || Default || Required ||
| schema | Location of the XSD schema. This path must be a relative path from the root of the SU package. | {center}\-{center} | {center}Yes{center} |
{table-plus}

h3. Service unit content

The service unit has to contain the following elements, packaged in the archive:
* the META-INF/jbi.xml descriptor file as described above,
* it is also highly recommended to provide a WSDL description for service provider embedded in the service-unit. The service provider contract must implement the interface "\{http://petals.ow2.org/components/validation/version-1}ValidationInterface" defined in the abstract WSDL 'ValidationInterface.wsdl' available as resource in the component archive,
* the XML Schema files.

{noformat}
su-xslt-TransformationName-provide.zip
+ META-INF
- jbi.xml (as defined above)
- XsltService.wsdl (recommended)
- myfile.xsd (required)
- myfile2.xsd (required if myfile2.xsd is imported in myfile.xsd)
{noformat}

h3. Example

An example of a Service Unit descriptor to provide an validation service:

{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="validation: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}

h1. Configuring the component

The component can be configured through the parameters of its JBI descriptor file. These parameters are divided in following groups:
* *JBI parameters* that have not to be changed otherwise the component will not work,
* *CDK parameters* that are parameters driving the processing of the CDK layer,
* *Dedicated parameters* that are parameters specific to this component.

{note}Caution: The component requires the right JDBC Shared Libraries to communicate with your databases. Please install first valid Shared Libraries containing your database JDBC drivers. Then you can configure your component by using PETALS Maven plugin with the goal {{jbi:configure}} or the PETALS Ant task {{petals-configure-component}}.{note}

h2. CDK parameters
The component configuration includes the configuration of the CDK. The following parameters correspond to the CDK configuration.

{include:0 CDK Component Configuration Table 5.8.0}

h2. Interception configuration
{include:0 CDK Component Interceptor configuration 5.8.0}

h2. Dedicated configuration

No dedicated configuration parameter is available.

h1. Business monitoring

h2. MONIT traces

{include:0 CDK SE Business Monitoring Traces 5.8.0}

h2. Flow tracing activation

{include:0 CDK SE Business Monitoring Flow Tracing Activation 5.8.0}

h1. Monitoring the component

h2. Using metrics

Several probes providing metrics are included in the component, and are available through the JMX MBean '{{org.ow2.petals:type=custom,name=monitoring_*<component-id>*}}', where {{*<component-id>*}} is the unique JBI identifier of the component.

h3. Common metrics

{include:0 CDK Component Monitoring Metrics 5.8.0}

h3. Dedicated metrics

No dedicated metric is available.

h2. Receiving alerts

Several alerts are notified by the component through notification of the JMX MBean '{{org.ow2.petals:type=custom,name=monitoring_*<component-id>*}}', where {{*<component-id>*}} is the unique JBI identifier of the component.

{tip}To integrate these alerts with Nagios, see [petalsesbsnapshot:Receiving Petals ESB defects in Nagios].{tip}

h3. Common alerts

{include:0 CDK Component Monitoring Alerts 5.6.0}

h3. Dedicated alerts

No dedicated alert is available.