The Validate action can be used to check the content of any variable against an element or
type of an XML schema. The validation can be configured to either save the Boolean result of
the validation in a variable or to raise an error if the validation fails. An error will hold the error
code BEA-382505 and the message will hold further details about the failed validation.

By using the XPath expression, it's also possible to only check fragments, inside a larger XML
message, for validity.

We will show how to use the Validate action to perform message validation.

In Eclipse OEPE, perform the following steps:

1. Open the MessageValidation proxy service and navigate to the Message Flow tab.

2. Insert a new stage into the MessageProcessingPipelinePair and name it MessageValidationStage.

3. Insert a Validate action into the stage.

4. On the Properties tab of the Validate action, enter body into the In Variable field.

5. Click <XPath> and enter ./cus:Customer into the Expression field. Click OK.

6. Click Browse to the right of Against Resource and select the Customer (element) in the xsd/Customer.xsd XML Schema. Click OK.

7. Select the Raise Error option.

8. Deploy the project to the OSB server.

Now let's test the validation of our proxy service. In the Service Bus console, perform the following steps:

9. In the Project Explorer navigate to proxy folder inside the using-validate-to-domessage-validation project.

10. Click on the Launch Test Console icon of the MessageValidation proxy service.

11. Enter a message with an invalid CardIssuer (only the lowercase values visa and mastercard are valid) and click Execute.


12. The Validate action will raise a validation error, which is shown in the following screenshot:


Leave a Reply

Subscribe to Posts | Subscribe to Comments

About This Site

Howdy! My name is Suersh Rohan and I am the developer and maintainer of this blog. It mainly consists of my thoughts and opinions on the technologies I learn,use and develop with.
Powered by Blogger.

- Copyright © My Code Snapshots -Metrominimalist- Powered by Blogger - Designed by Suresh Rohan -