.NET RESTful Engine Custom Processing

As of .NET RESTful Engine version 21.3, we now offer the ability to preform custom processing on your generated document before we mark it as done and ready for delivery. You can find a sample custom processing project to use for testing, and later implementing your own, on our github.

What You Need

In order to implement your own custom processing plugin for the RESTful Engine, you will need the following:

  • RESTful engine version 21.3+
  • WindwardCustomProcessing.dll
    • You will find this dll in the bin folder in the RESTful engine installation

The WindwardCustomProcessing.dll contains the following:

  1.  IDocumentPostProcessor: This is the interface that you will implement 
  2. CustomDocument: This is the model used as the data transfer object between the RESTful engine and your defined custom plugin
  3.  CustomProcessingTestUtil Class: This class contains methods that will help you test your custom code before using it in the RESTful Engine.

Setting It Up

Create a new C# project and add the dll to the project dependencies. You can do that by right clicking on references, then add reference, then browse to find the WindwardCustomProcessing dll in the bin folder of your RESTful Engine installation.

Note: Keep the WindwardCustomProcessing dll in the bin folder. If you wish to have it in a separate location, make a copy of the dll and leave the original in the bin folder.

Then include the libraries to your class file, and define a class that implements IDocumentPostProcessor:

using WindwardCustomProcessing;

namespace CustomProcessing
   public class PostProcess: IDocumentPostProcessor

The IDocumentPostProcessor only defines one method that you must implement:

Task<CustomDocument> Process(CustomDocument document);

This is an async method that takes in a CustomDocument object. These are the properties in the CustomDocument model:

/*The generated report as a single file in the user specified format. If this is populated Pages will be null. */ 
  public virtual byte[] Data { get; set; }

/*The generated report as a distinct file per page in the user specified format. If this is populated Data will be null. This is produced by the image report generator and by the HTML report generator when it is in per page mode.*/
   public virtual byte[][] Pages { get; set; }

You can use the process method to do your own custom processing on the generated reports data before it is marked as complete. Whatever processing you do, make sure to return a Task<CustomDocument>.

Testing It

In the WindwardCustomProcessing.dll we provide a class (GenerateDocumentModel) that has the following method:

 public CustomDocument GetDocument(String path)

This method will return an object similar to the one we will use in the RESTful Engine with your custom code. The method takes in the path for a docgen.complete file (the xml file for a generated report). So in order to use this method, you must initially produce output from the base RESTful engine. Once you have done that, navigate to the directory where the RESTful engine stores output. The default directory is:


Then find the {guid}.docgen.complete file, pass its absolute path into the GetDocument() method and it will return a CustomDocument object for you to test with.

To use this method, instantiate the class and call the method:

GenerateDocumentModel test = new GenerateDocumentModel();
CustomDocument customDoc = test.GetDocument("PATH_TO_docgen.complete_FILE")

Using the Custom Processing Plugin

After you have defined and tested your implementation of IDocumentPostProcessor, you are now ready to inject it and use it in your production RESTful Engine. 

The first thing you need to do is compile your custom processor project into a dll. Once you have the dll, do the following in your RESTful engine's web.config:

   <add key="postProcessor" value="PATH_TO_DLL!CLASS_NAME" />


  • PATH_TO_DLL is the path to your IDocumentPostProcessor.dll implementation (if there are spaces in the path, put it in quotes)
  • CLASS_NAME is the full class name of your repository class:
    • ie. if your namespace is CustomDocumentProcessor and your class is named DocumentProcessor, classname would be CustomDocumentProcessor.DocumentProcessor.


Add your comment

E-Mail me when someone replies to this comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.