This sample explains how to validate the content of an XML resource uploaded to WSO2 Governance Registry using XPath and regular expressions in a few easy steps. This is useful to introduce additional validation to files such as WSDL, Schema and Policy. We will be reusing the code of the Handler Sample in this example. This sample requires Apache Maven. See Installing Apache Maven for Governance Registry on Windows or Installing Apache Maven for Governance Registry on Linux See Installation Prerequisites for links on how to install it.
Instructions
1. Navigate to GREG_HOME/
samples/handler/src
to find the source code of the Handler Sample.
...
Code Block |
---|
mvn clean install |
Info | title | Note
---|
The command |
A successful run of Apache Maven will generate a report similar to the following:
...
Code Block | ||
---|---|---|
| ||
<handler class="org.wso2.carbon.registry.samples.handler.XPathValidationHandler"> <property name="xPath">//wsdl:service</property> <property name="attribute">name</property> <property name="regEx">SimpleStockQuoteService</property> <property name="namespaces">wsdl:http://schemas.xmlsoap.org/wsdl/</property> <filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher"> <property name="mediaType">application/wsdl+xml</property> </filter> </handler> |
Info | title | Note
---|
The configuration above is used to validate a WSDL file as to whether the service defined in it has the name |
...