Compression Service

The Compression service is used within a business process to compress or decompress of a document.

The following table provides an overview of the Compression service:

System name CompressionService
Graphical Process Modeler (GPM) category All Services
Description Provides the ability to compress (deflate) a document or group of documents in the business process context. It also provides the ability to decompress (inflate) a document. The following options are available with the Compression service:
  • Compress all documents or just the primary document in a business process context.
  • Decompress a .zip file and put a specified document into the primary document or decompress the file and start a business process for each document.
With the Compress option, parameters can be set to specify whether the files should be deflated or just stored. If the files are being compressed, parameters can be set to determine the level of compression. The decompression option can start a business process for each file, or it can put a specified document in the primary document.
Business usage Used within a business process to perform compression or decompression of a document.
Usage example If you have a .zip file in the primary document, you can use this service to decompress the file and start a business process for each document found.
Preconfigured? Yes
Requires third party files? No
Platform availability All supported Sterling B2B Integrator platforms
Related services No
Application requirements No
Initiates business processes? If decompressing files, and Decompress_result is set to Start_bpml, child business processes are started for each document in compressed file.
Invocation Runs as part of a business process.
Business process context considerations This service uses the primary document and can also compress other documents in the business process context.
Returned status values
Returned status values:
  • Success – Compression or decompression was successful.
  • Error – Errors were encountered during compression or decompression. The report contained in the Workflow Context Status report should be consulted for further detail.
Restrictions When decompressing, if you choose to put a specific document in the primary document area, but fail to specify a filename when multiple files exist in the compressed input file, Sterling B2B Integrator selects the first of the files present, as determined by the compression utility that produced the compressed file.

How the Compression Service Works

The Compression service provides two options:
  • Compression
  • Decompression

The Compression option is used to deflate files, and it enables you to define the level of compression used. You can also use the Compression option to store files without compressing them.

The Decompression option inflates a compressed file, then enables you to use the resulting decompressed files in business processes. The Decompression option can be configured to start a business process for each file, or it can put a specified document in the primary document. For example, if the primary document in a business process contained a .zip file, you could use the Compression service to decompress the file and start a business process for each document contained in the .zip file.

Note: When decompressing, if you choose to put a specific document in the primary document area, but fail to specify a filename when multiple files exist in the compressed input file, Sterling B2B Integrator selects the first of the files present, as determined by the compression utility that produced the compressed file.

If the compression or decompression completed without error, a Done message is written to the status report. If it was unsuccessful, an error message is written to the status report.

The following figure shows the basic flows for compression and decompression:

Business Process Example

The business process example in this section illustrates this sequence of actions:
  1. The File System adapter collects one document.
  2. The business process moves the document to the business process context.
  3. The File System adapter collects a second document.
  4. The Compression service deflates both documents.
<process name="Comp_Deflate_lvl0">
  <sequence>
    <operation name="FileSystem">
      <participant name="FileSystem"/>
      <output message="outputMessage">
        <assign to="Action">FS_COLLECT</assign>
	<assign to ="collectionFolder">/input</assign>
	<assign to ="filter">Excel.xls</assign>
	<assign to ="useSubFolders">false</assign>
	<assign to ="bootstrap">false</assign>
	<assign to ="deleteAfterCollect">false</assign>
	<assign to ="extractionFolder">//dummy</assign>
        <assign to="." from="*"></assign>
      </output>
      <input message="inputMessage">
        <assign to="." from="*"></assign>
      </input>
    </operation>    
    <assign to="ExcelDoc/@SCIObjectID" from="string(//PrimaryDocument/@SCIObjectID)"
append="true"/>
    <operation name="FileSystem">
      <participant name="FileSystem"/>
      <output message="outputMessage">
        <assign to="Action">FS_COLLECT</assign>
	<assign to ="collectionFolder">/input</assign>
	<assign to ="filter">Text.txt</assign>
	<assign to ="bootstrap">false</assign>
	<assign to ="deleteAfterCollect">false</assign>
	<assign to ="useSubFolders">false</assign>
	<assign to ="extractionFolder">//dummy</assign>
        <assign to="." from="*"></assign>
      </output>
      <input message="inputMessage">
        <assign to="." from="*"></assign>
      </input>
    </operation>    
    <operation name="Compress">
      <participant name="CompressionService"/>
      <output message="outputMessage">
        <assign to="." from="*"></assign>
        <assign to ="compression_action">compress</assign>
        <assign to ="compressed_filename">DeflatedFile.zip</assign>
        <assign to ="compression_level">0</assign>
        <assign to ="compression_type">Deflate</assign>
      </output>
      <input message="inputMessage">
        <assign to="." from="*"></assign>
      </input>
    </operation>
  </sequence> 
</process>

Implementing the Compression Service

To implement the Compression service, complete the following tasks:
  1. Configure the pre-installed copy of the Compression service, or create a new configuration. For information, see Configuring the Compression Service.
  2. Use the Compression service in a business process.

Configuring the Compression Service

To configure the Compression service, you must specify settings for the following fields in the GPM:

Field Description
Config Name of the service configuration. Required.
bpml_name Name of the business process to start. Required if you selected Start_bpml for Decompress_result field. Valid value is a string. Decompression parameter only.
compressed_filename What to name the compressed file. Valid value is a string: file name with extension. Default is CompressedFile<date/timestamp>.zip. Date/Timestamp is in the format CCYYMMDDHHMMSSMMS. Compression parameter only.
compression_action Whether to compress or decompress documents. Valid values are Compress and Decompress.
compression_level Level of compression. Valid values are 0 - 9 (default is 0). Compression parameter only.

This value represents a sliding scale of likely resulting compression-level vs. speed of encoding. Value ranges from 0 (do not attempt compression, just store uncompressed) to 9, representing the maximum capability of the service.

compression_type Compression method. Valid values are Deflate and Store (default is Deflate). Compression parameter only.
decompress_result What to do with decompressed files. Valid values are Start a business process and Put a specific document in the primary document. Decompression parameter only. Required.
doc_to_compress Whether to compress all docs or just the primary doc. Valid values are All and Primary Doc (default is All). Compression parameter only.
file_name Name of file to put in primary document. Valid value is a string: name of file with extension. Defaults to first document in the list. Decompression, primary_doc parameter only.
Note: When decompressing: if you choose to put a specific document in the primary document area, but fail to specify a filename when multiple files exist in the compressed input file, Sterling B2B Integrator will select the first of the files present, as determined by the compression utility that produced the compressed file.