Petals-SE-Validation

Features

The Validation Service-Engine allows to validate and filter Petals messages against an XML Schema.

Each configuration of this component embeds an XML Schema (made up of one or several XSD files).
When such a configuration (i.e. service, i.e. service-unit) is called, it validates the received message against the XML Schema.
Depending on the called operation, the returned message is either a boolean (validate operation) or the received message or a fault (filter operation).
filter and validate are the only operations this component supports.

This component only acts as service provider, not as a service consumer.
In fact, it provides a validation / filtering service (the filtering relies on the validity of the message against the XML Schema).

Validation Component overview
Contributors
No contributors found for: authors on selected page(s)

Recommended usage

The Validation component may be used before calling a critical service.
It allows to make sure the message to send has the right shape.
For some services, this can be useless. For some others though, it can be critical to perform this check.

A typical example

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

if( validationService.validate( MSG )) {
criticalService.criticalOperation( MSG );
}
else {
log( "The message was invalid." );
}

Validation and chaining services

Following our previous algorithm, it appears that validating or filtering a message only makes sense if this message is going to be sent to another service.
That supposes that there is a chaining service, that will first call the validation service, and then call the real target service.

  1. Message from the chaining service to the validation / filtering service.
  2. Response from the validation / filtering service to the chaining service (the MEP is InOut, always, no matter what the operation is).
  3. Message from the chaining service to the real target service.
  4. Optional response, depending on the MEP for the second service.

This chaining service can be implemented by a POJO (an home made Java Class) or an Enterprise Integration Pattern (EIP).
It could also be implemented by a BPEL process, but this latter needs that the WSDL proposed by the Validation component is correct and completed.
Note that BPEL can validate by itself the message during its processing, so it may be useless to use the Validation component in some cases.

Limitations

The validated / filtered content is always the payload from the input message.
Do not mistake XML-validation services for interceptors.

Neither to validate attached, nor to intercept and validate messages on the fly.
Interceptors would better fit this kind of use case.

Labels

components-se-family components-se-family Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.