validationxsd-validationibm-datapower

How can we achive dynamic schema validation in DataPower?


Requirement: Dynamic schema validation.

The request URL will contain the function name in query string.

http://DataPowerIP:Port/CD_HTML/AOL.jsp?function_id=YY_TD_ICT_CER_CREATE

DataPower will have multiple XSDs in its file management. Need an XSLT which can help t0 fetch the query string from the URL and extract the function idYY_TD_ICT_CER_CREATE.

Next it will match function id name with the XSD file name YY_TD_ICT_CER_CREATE.xsd and if match found will do the scema validation.


Solution

  • In your XSL, you can get your URI via dp:variable('var://service/URI'). Write your code to parse out the function_id into an xsl:variable. Then set a DataPower context variable with the name of the schema file to be used for validation:

    <dp:set-variable name="'var://context/this/schema-file'"
        value="concat('local:///my-schemas/', $function-id-value, '.xsd')"/>
    

    The next step in your policy after this XSL Transform step will be a validate step. In the place where you normally specify a static local XSD, specify the context variable instead:

    DataPower Validate using var