You are here: Reference > Rule types > Service Files > More about Service File rules

More about Service File rules

  1. About 
  2. New 
  3. Service 
  4. Method 
  5. Request 
  6. History 
  7. More... 

Processing

Each file listener data instance references a single Service File rule. At run time, the listener monitors the contents of a directory to look for files of a specific name (or name pattern). When an eligible input file is discovered, it is copied into a subdirectory folder named Work and deleted from the original directory.

The listener cause the associated Service File rule to start. (If authentication is required, the Operator ID and password in the listener are used, resulting in a full requestor session. The Service File rule parses the input according to instructions in the Request and Method tabs. When an input file is completely processed without error, it is copied to the Completed folder and deleted from the Work folder.

The system places output text files in a subdirectory of the original directory named Report. Output files have a file type of rpt.

Logging

The system saves results and errors from Service File processing in persistent instances of the Log-Service-File class, ordered by date and time. This Log instance contains information about the file name, file size, and errors. You can use the Application Explorer to review these as XML displays in Internet Explorer, or you can create reports.

Debugging

To include the clipboard results of service file processing in the Pega log, temporarily add the Log-Message method as a step in an appropriate place in the service activity. Set the LoggingLevel parameter to InfoForced and the Message parameter to:

Contents of page:\n" + myStepPage.getXML());

Parsing Comma Separated Value files

The CSV (Comma Separated Values) file format is supported by Microsoft Excel and many other programs for simple interchange of flat-file data. If your application needs to import data from CSV files, your Service File rules can use a Parse Delimited rule. For an example, see the PDN article How to parse a Comma-Separated-Values (CSV) file using a file service.

Accepting completed PDF forms

A Service File rule can accept arriving PDF form documents completed by customers, Web site visitors, or other sources, and use a Parse Structured rule (Rule-Parse-Structured rule type) to copy the form to the clipboard. An activity can then extract the completed form fields from the PDF form.

See the PDN article Working with PDF forms and Documents for more information about incoming PDF forms.

Remote logging

You can debug a Service File rule or rules using remote logging. Install the Apache LogFactor5 applet on a workstation and identify this workstation as the target for remote logging in the File Listener form.

Performance statistics

Through changes the prlogging.xml file, you can obtain performance statistics on the execution of services. See Performance tool — Statistics for services.

Through settings in the prconfig.xml file, you can be alerted to unusually long service operations. See How to detect lengthy service operations.

As an alternative to updating the prconfig.xml file, you can use Dynamic System Settings to configure your application. See Prconfig settings and classifications.

Example

For a PDN example of a multithreaded file service, see PDN article How to support high-throughput file services with multithreading.

Related Topics Link IconRelated information