How to Execute NPrinting Reports by External XML Request

    You can set up the NPrinting service to accept requests to execute Tasks and Jobs that are submitted by XML files saved in a specific folder.

     

    There are two steps to this process:

    1. Configure NPrinting Service to accept XML requests (see How to Configure NPrinting Service)
    2. Generate XML files with a specific syntax and save them in the folder you specify in the previous step.

     

    NPrinting Service regularly checks for new XML files with the .request extension in the defined source folder, parses any new ones it finds, executes the contained instructions, and renames the file by changing the .request extension to .processed. It then writes information into a new file about what Task(s) or Job(s) were run and their outcome. Finally it names the file with the .result extension. Execution will be queued with any other schedule jobs to be executed.

     

    The Task or Job can be reactivated just by changing the extension on the XML file back to .request. Paths to files on remote servers must be absolute paths.

     

    When you install NPrinting Server, NPrinting Management Console is also installed as a component and is the GUI for configuring automated report generation and distribution. Launch NPrinting Management Console by clicking on its desktop or taskbar icon or searching for NPrintingSvcConfig.exe and double clicking on it.

    Permit NPrinting Service Config to Make Changes

    Permit-NPrinting-Service-Config-to-Make-Changes.png

    The first thing that happens when you start NPrinting Management Console up is the User Account Control window pops up. Click on the Yes button to proceed.

    Add NPrinting Project File(s)

    Add-NPrinting-Project-File-s-.png
    1. The Service page is pre-selected
    2. Click on the Add button

     

    All paths to NPrinting files saved on computers different from the one running NPrinting Service must be absolute paths (e.g. \\Server\NPrinting\Templates - NOT Z:\NPrinting\Templates).

    Select NPrinting Project File(s)

    Select-NPrinting-Project-File-s-.png
    1. Browse to C:\NPrintingTraining\NPrintingFiles\ and select NPrintingTraining.nsq
    2. Click on the Open button

    Enable External Requests

    Enable-External-Requests.png
    1. Put a check mark in the Enable external requests box
    2. Click the browse button to configure the directory where XML files to be executed by NPrinting Service are to be saved. See: How to Configure NPrinting Service

    Select Source Folder

    Select-Source-Folder.png
    1. Browse to C:\NPrintingTraining\ and select the ExternalRequestsXML folder. Use Make New Folder if necessary
    2. Click on the OK button

    Request files

    Request files are XML files with .request extension. Once they get processed the extension is changed to .processed without changing the content. A .processed extension file can be renamed to a .request extension file by a batch file or other process, reactivating the Task or Job.

    The following is given In the file (feel free to copy, paste, and put in the necessary parameters):

    • .nsq file to use
    • type of entity: Job or Task
    • name of the entity

     

    File structure:


    <?xml version="1.0"?>

    <schedules>

         <schedule file="" type="" entityName="" />

    </schedules>

     

     

    Example1:


    <?xml version="1.0"?>

    <schedules>

         <schedule file="C:\NPrintingTraining\NPrintingFiles\NPrintingTraining.nsq" type="job" entityName="AccessPoint Report" />

    </schedules>


    Note: remember that an absolute path must be used for files residing on a remote server.

    This will execute:

    • NPrinting Job called "AccessPoint Report"

     

    Example2:


    <?xml version="1.0"?>

    <schedules>

         <schedule file="C:\NPrintingTraining\NPrintingFiles\NPrintingTraining.nsq" type="task" entityName="Send an HTML embedded Report" />

         <schedule file="C:\NPrintingTraining\NPrintingFiles\NPrintingTraining.nsq" type="job" entityName="Sales Report" />

    </schedules>

    This will execute:

    • NPrinting Task called "Send an HTML embedded Report"
    • NPrinting Job called "Sales Report"

    Result files

    Results files are XML files with the .result extension. They contain information regarding execution of the XML .request files

    The information they contain is:

    • .nsq file which was used
    • type of entity: Job or Task
    • name of the entity
    • Date-Time of the start of the processing in ISO format
    • Number of errors/warnings (if any)
    • List of errors/warnings (if any)

     

    File structure:


    <?xml version="1.0"?>

    <scheduleResults>

         <scheduleResult file="" type="" entityName="" startTime="" result=""/>

         <scheduleResult file="" type="" entityName="" startTime="" result="" warningCount="" warningMessage=""/>

         <scheduleResult file="" type="" entityName="" startTime="" result="" errorCount="" errorMessage=""/>

    </scheduleResults>

     

    Example1:


    <?xml version="1.0"?>

    <scheduleResults>

         <scheduleResult file="C:\NPrintingTraining\NPrintingFiles\NPrintingTraining.nsq" type="job" entityName="AccessPoint Report" startTime="2013-12-27T16:55:27.421+01:00" result="success"/>

    </scheduleResults>