Validation in EDRA

“A business action can provide a semantic input validation method (see the validationMethod attribute in the BusinessAction configuration). If requested in the configuration file, the method is called by the business action pipeline target before the service implementation method is called. The method is given the input data as argument(s) and should raise an exception if the date is not valid. If an exception is raised, the service implementation method is not called.“

To implement it you would have to

  • Write another method it in your BA class (the name is arbitrary)
  • Put these attribute as part of the in the configuration file.
       validate="true"
       validationMethod="ValidateFunds"
  • The method will receive the same request that your BA method
  • If the data doesn't validate throw a BusinessRuleException

EDRA also gives you a method to do syntactic validation of the message.

The syntactic validation is implemented with a handler, and it will validate the request/response message with a XML schema (xsd).

<ra:handler ra:handlerName="SyntacticValidation">
    <ra:syntactValidationSettings ra:requestSchema="C:\Projects\Test\Schemas\FundsTransferRequest.xsd" ra:responseSchema=""/>

“This can be used whenever you need to validate the structure of messages. This would typically be used with public services that can be called by any external client.
With public services, you do not have control over the requester. Another reason for using this handler is to validate messages as early as possible in order to avoid overloading the system. This would also be used in a Service Implementation pipeline.

There is a performance impact to consider as well. When both the request and response messages are validated, you may see a significant decrease in performance.
You can reduce the impact to performance by only validating the request message.“

Published: September 28 2004

blog comments powered by Disqus