DataPower Exports and XML Files Referenced by Stylesheets

I was recently presented with an opportunity to be clever while promoting DataPower objects from a development environment to a testing environment.  The WS-Proxy object’s policy rules had a Transform Action that ran a custom stylesheet.  The stylesheet referenced a configuration file that was kept on the local DataPower file system.  After promoting the service object, we found that the XML configuration file was not present in the test environment.  DataPower did not see that the stylesheet referenced  the XML configuration file with a document() function call and so the configuration file was not included in the export.

At the same time, DataPower doesn’t allow you to chose individual files to include in the export-at least, not that I have ever found.

IBM recommends this approach, but it grabs ALL files in the Application Domain.

So, to make sure that the XML configuration file is included in the export file, I needed a way to make sure the file is referenced by something that DataPower will look at while generating the export ZIP.

The solution I found was to add an extra Fetch Action to a rule that fetches the XML configuration file from the local file system.  This Fetch Action can be included in a dummy processing rule that is never used (because it has a URL match of http://abcd7890 or something similar) or it can be included in where in a request or response rule (the overhead would be minimal, the XML file would be in the XML Cache after the first rule execution).

However you do it, the Fetch Action will be seen and it will include the referenced XML file in the export ZIP file.