View Source

{section}
{column}

{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.

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}*Configuration of a Service Unit to provide a service (Validation)*{center}
{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}
{include:0 CDK SU Interceptor configuration}


h2. Service-Unit content

The service unit must contain the XML Schema and the JBI descriptor (jbi.xml file).
It is also highly recommended to provide a WSDL description for this service (though it is optional).
This WSDL is not mandatory, but not providing it will prevent your service from interacting with other Petals services and components.

\\
The directory structure of a SU for the Petals-SE-Validation looks like this:

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


h1. Configuring the component

The component can be configured through its JBI descriptor file, as shown below.
{code:lang=xml}<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<jbi version="1.0"
xmlns='http://java.sun.com/xml/ns/jbi'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5">

<component type="service-engine">
<identification>
<name>petals-se-validation</name>
<description>A VALIDATION Service Engine</description>
</identification>

<component-class-name description="Validation Component class">org.ow2.petals.se.validation.ValidationComponent</component-class-name>
<component-class-path><path-element/></component-class-path>
<bootstrap-class-name>org.ow2.petals.component.framework.DefaultBootstrap</bootstrap-class-name>
<bootstrap-class-path><path-element/></bootstrap-class-path>

<petalsCDK:acceptor-pool-size>3</petalsCDK:acceptor-pool-size>
<petalsCDK:processor-pool-size>10</petalsCDK:processor-pool-size>
<petalsCDK:ignored-status>DONE_AND_ERROR_IGNORED</petalsCDK:ignored-status>
<petalsCDK:notifications>false</petalsCDK:notifications>
<petalsCDK:jbi-listener-class-name>org.ow2.petals.se.validation.listener.JBIListener</petalsCDK:jbi-listener-class-name>
</component>
</jbi>{code}


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

{include:0 CDK Component Configuration Table 2.1}
{include:0 CDK Parameter scope}
{include:0 CDK Component Interceptor configuration}

\\
This component does not have any specific configuration parameter.

h1. Monitoring the component

{warning}In this documentation, the term "Allocated threads" must be understood as "Active threads", see [PETALSDISTRIB-37|https://jira.petalslink.com/browse/PETALSDISTRIB-37]. This naming error will be fixed in the next version.{warning}

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.4.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.4.0}

h3. Dedicated alerts

No dedicated alert is available.