Petals-SE-Validation

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (26)

View Page History
\\
One typical example would be a service converting the received message as data and manipulating it then (e.g. to insert it into a database).
In Petals ESB, that would concern the Petals-BC-SQL component or even the Petals-SE-Talend component.
Notice that this last one has a built-in feature to validate received messages against the job's WSDL.

Another example could be a service that accesses an EJB.
The received message is mapped to a Java object that is about to be manipulated in a JEE container.
Making sure the sent message is valid may prevent errors from occurring later in the processing.

In a perfect SOA world, this component would be useless.
Every service would have a WSDL, and every service consumer would rely on this WSDL to send a message.
But this is only good practices. It happens that service consumers do not send the perfect messages.

It can be the case with *integration* use cases (e.g. with an EIP - Enterprise Integration Pattern - or a POJO that consumes a service by generating dynamically the message to send).
Before calling this service, you might want to ensure the validity of the built message. An this is where you will use the Validation component.

\\
Roughly, the principle looks like



h1. General Miscellaneous information

h2. Validation and chaining services
It could also be implemented by a BPEL process, but in fact, that would not be a good idea.
A BPEL process needs any called service to have a WSDL, and sends messages according to these WSDLs.
Typically, working with assumes BPEL means you assume that you are in a perfect SOA world. Thus, using the Validation component with BPEL is useless.


h2. Validate or filter
h2. Supported operations

The Validation component supports two operations.
h3. The "validate" operation

*validate* validates the received message against the XML Schema embedded in the service-unit.
The returned message is either
If the message is valid, the returned message is

{code:lang=xml}
{code}

(if the message is valid), or
\\
Otherwise, it is

{code:lang=xml}
<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}

(if the message is invalid).

\\
The associated name space (a WSDL operation is a QName) depends on the version of the Validation component.
For the version 1.1, this name space is [http://petals.ow2.org/components/validation/version-1]
This operation only supports the *InOut* message exchange pattern.


\\
{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}

\\
The associated name space (a WSDL operation is a QName) depends on the version of the Validation component.
For the version 1.1, this name space is [http://petals.ow2.org/components/validation/version-1]
This operation only supports the *InOut* message exchange pattern.

\\
{warning}
If the operation is invalid (i.e. is neither *validate*, nor *filter*), then *filter* is the operation by default.

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