Get Document Info Service

The Get Document Info service provides information about the primary document. You can query the service about many types of information, including DocumentName, DocumentBodyLength, and DocumentID.

The following table provides an overview of the Get Document Info service:

System name GetDocumentInfoServiceType
Graphical Process Modeler (GPM) category All Services
Description The Get Document Info service provides information about the primary document. You can query the service about the following information:
  • DocumentName
  • DocumentBodyLength
  • DocumentId
  • DocumentSubject
  • DocumentCreateTime
  • DocumentContentType
  • DocumentCharEncoding
  • DocumentContentSubType
  • DocumentPreviousDocId
  • DocumentLength
  • Correlations
  • Storage Type
  • Node name
  • File name
  • Storage time
You can also use the service to set the following information, with or without creating a new document in the system:
  • BodyName
  • Document Content Type
  • DocumentCharEncoding
  • DocumentContentSubType
  • updateMetaDataOnly: When set to “true” BodyName, Document Content Type, DocumentCharEncoding, DocumentContentSub Type, Document Subject, and DocumentName can be updated without creating a new document.
Business Usage This service allows information obtained from the document to be used in the business process at run time. You can also use the service to set certain information about the document in the business process.
Usage Example Obtain correlations from a document, such as a correlation for document type, and use this to determine further processing that would be specific to that document type.
Preconfigured? Yes
Requires third-party files? No
Platform availability All supported Sterling B2B Integrator platforms
Related services None
Application requirements None
Initiates Business Processes This service does not initiate a business process
Invocation Not applicable
Business Process Considerations Allows a document ID to be passed instead of the whole document. This makes information from the document available for use in the process without opening the document.
Returned Status Values Returned status values:
  • Success
  • Error
Restrictions None
Persistence Level System default

Implementing the Get Document Info Service

To implement the Get Document Info service, complete the following tasks:
  1. Create a Get Document Info service configuration. See Creating a Service Configuration.
  2. Configure the Get Document Info service. See Configuring the Get Document Info Service.
  3. Use the Get Document Info service in a business process.

Configuring the Get Document Info Service

To configure the Get Document Info service, you must specify settings for the following fields in the GPM:

Field Description
Config Name of the service configuration. Required.
BodyName Body Name of the document. Optional.
CORRELATION Whether to pass correlations associated with the document. Optional. Valid values:
  • true - Pass document correlation parameters
  • false - Do not pass document correlation parameters
Default is false.
DOCUMENT_ID Document ID to look up from the workflow context. If there is no document ID, it will look up the primary document instead. Optional. Valid value: hostname:e52fd2:fd70c53c8c:-7648.
Note: When you specify DOCUMENT_ID, the document specified is loaded into the Primary Document. If a Primary Document already exists, it will be overwritten.
DocumentCharEncoding Type of character encoding used in the document. Optional. Example: iso-8859-1.
DocumentContentSubType Content subtype of the document. Optional. Example: plain.
DocumentContentType Content type of the document. Optional. Example: text.
Encrypted Indicates if the document is encrypted. Optional.
RETRIEVE_INITIAL_DOC_ID Gets the initial document ID. This parameter should be set to false unless you want the initial document ID for the primary document.
  • true - process data after the service will have an entry called DocumentInitialId that is the initial document id for primary document.
  • false - no entry for DocumentInitialId.
Default is true.

Once configured, these parameters are passed from the business process to the Get Document Info service.

Parameters Passed from Business Process to Service

The following parameters are passed from the Business Process to the Get Document Info service:

Field Description
DocumentId Document ID to look up from the workflow context. If there is no document ID, it will look up the primary document instead. Optional. Example: hostname:e52fd2:fd70c53c8c:-7648.
DocumentContentType The current document content type. Optional.
DocumentContentSubType The current document content sub-type. Optional.
DocumentCharEncoding The current document character encoding. Optional
Correlation The current document correlation. Optional.
BodyName The current document body name. Optional
doClone Set to true to modify the document metadata in the clone or copy of the existing document. The modified data is in the cloned document. Valid values are true and false. Optional. For example, when you alter the value in DocumentContentType, setting doClone to true creates a clone of the existing document but with the modified value. If you do not set the doClone parameter or set it to false, the existing document will have the new metadata value and the modified value is available in the process data.
updateMetaDataOnly A flag that indicates if the document data is for a metadata update only. Optional. Valid values are: True or False. If set to true, you can update BodyName, Document Content Type, DocumentCharEncoding, DocumentContentSub Type, Document Subject, and DocumentName without creating a new document. The service can set the following metadata without creating a new document that is stored in the database:
  • doc name
  • bodyName
  • char_encoding
  • subject
  • content_type
  • content_subtype
Default is false. Example of a document with updateMetaDataOnly set to true:
<operation name="SetContentType"> 
<participant name="GetDocumentInfoService"/> 
<output message="xout"> 
<assign to="." from="*"/> 
<assign to="DocumentContentType">
text
</assign> 
<assign to="DocumentContentSubType">
plain
</assign> 
<assign to="DocumentCharEncoding">
iso-8859-1
</assign> 
<assign to="updateMetaDataOnly">
true
</assign> 
</output> 
<input message="xin"> 
<assign to="." from="*"/> 
</input> 
</operation>
Example of a document that is not using updateMetaDataOnly and is set to false, or not set at all. A new document will be saved in the database:
<operation name="SetContentType"> 
<participant name="GetDocumentInfoService"/> 
<output message="xout"> 
<assign to="." from="*"/> 
<assign to="DocumentContentType">
text
</assign> 
<assign to="DocumentContentSubType">
plain
</assign> 
<assign to="DocumentCharEncoding">
iso-8859-1
</assign> 
<assign to="updateMetaDataOnly">
false
</assign> 
</output> 
<input message="xin"> 
<assign to="." from="*"/> 
</input> 
</operation>

Parameters Passed from Service to Business Process

The following parameters are passed from the Get Document Info service to the business process:

Field Description
PrimaryDocument The link of the primary document. Optional. Example: hostname:73ce5c:ff993119fc:-733f
BodyName The current body name. Required.
BodyLength The current body length. Required. Default is 0.
DocumentBodyLength The current document body length. Required. Default is 0.
DocumentName The current document name. Optional.
DocumentId The current document ID. Required. Example: hostname:331059:ff998a9313:-7f71
DocumentSubject The current document subject. Required.
DocumentCreateTime The current document creation time. Required.
DocumentContentType The current document content type. Optional.
DocumentCharEncoding The current document character encoding. Optional.
DocumentContentSubType The current document content sub-type. Optional.
DocumentPreviousDocId The previous document ID. Optional.
DocumentLength The current document length. Optional.
DocumentLifeSpan The current document life span. Optional.
DocumentInitialId The current document initial ID. Optional.
DocumentMaxInlineBodySize The current document maximum inline body size. Optional.
DocumentPurgeAfter The current document purge after. Optional. Valid values: any timestamp value.
DocumentStorageType The current document storage type. Optional.
DocumentTrackingId The current document tracking ID. Optional.
DocumentWorkflowId The current document workflow ID. Optional.
DocumentFileName The current document file name. Optional.
DocumentNodeName The current document node name. Optional.
DocumentType The current document type. Optional.
Encrypted Indicates if the document is encrypted. Optional.
UpdateMetaDataOnly Indicates if the document data is for a metadata update only. Optional.

Business Process Examples

Example 1

Example of the getdocinfo service that shows processing of the primary document created by the xmlencoder.

<process name="GetDocumentInfoService_01">
    <sequence name="simple">
    <operation name="Set Document">
    <participant name="XMLEncoder"/> 
    <output message="XMLEncoderTypeInputMessage">   
      <assign to="mode">process_data_to_document</assign> 
      <assign to="root_element">Document1</assign>
      <assign to="xPath">/ProcessData</assign>
      <assign to="." from="*"/>
    </output>
    <input message="inmsg">  
      <assign to="." from="*"/>
    </input>
    </operation>
    <operation name="SetContentType">
    <participant name="GetDocumentInfoService"/>
    <output message="xout">
      <assign to="." from="*"/>
      <assign to="DocumentContentType">text</assign>
      <assign to="DocumentContentSubType">plain</assign>
      <assign to="DocumentCharEncoding">iso-8859-1</assign>
    </output>
    <input message="xin">
      <assign to="." from="*"/>
    </input>
  </operation>
  </sequence> 
</process>

Example 2

Example of a process document that is collected by the filesystemadapter. The second getinfoservice is processing a document by a document ID.

<process name="GetDocumentInfoService_02">
  <sequence name="simple">
  <!-- Create File System adapter instances for input and output -->
  <!-- Place the document you want processed in the input instance -->
    <operation name="FileSystemAdapter">
    <participant name="FileSystemAdapter"/>
    <output message="outputMessage">
      <assign to="Action">FS_COLLECT</assign>
      <assign to ="filter">My.log</assign>
      <assign to ="useSubFolders">false</assign>
      <assign to ="docStorageType">fs</assign>
      <assign to ="bootstrap">false</assign>
      <assign to ="deleteAfterCollect">false</assign>
      <assign to="." from="*"></assign>
    </output>
    <input message="inputMessage">
      <assign to="." from="*"></assign>
  </input>
  </operation> 
    <operation name="FileSystemAdapter">
    <participant name="FileSystemAdapter"/>
    <output message="outputMessage">
       <assign to="Action">FS_EXTRACT</assign>
       <assign to ="useSubFolders">false</assign>
       <assign to="." from="*"></assign>
  </output>
  <input message="inputMessage">
      <assign to="." from="*"></assign>
  </input>
  </operation>
    <operation name="GetDocumentInfoService">
    <participant name="GetDocumentInfoService"/>
    <output message="xout">
      <assign to="." from="*"/>
      <assign to="DocumentContentType">text</assign>
      <assign to="DocumentContentSubType">plain</assign>
      <assign to="DocumentCharEncoding">iso-8859-1</assign>
  </output>
  <input message="xin">
      <assign to="." from="*"/>
  </input>
  </operation>
    <operation name="GetDocumentInfoService">
    <participant name="GetDocumentInfoService"/>
    <output message="xout">
      <assign to="." from="*"/><
 <!-- The DOCUMENT_ID parameter must contain a correct value from -->
 <!-- the Document table in the business process database.-->
       <assign to="DOCUMENT_ID">somehost:e61fd1:fd70c58c8c:-7478</assign>
       <assign to="DocumentContentType">text</assign>
       <assign to="DocumentContentSubType">plain</assign>
       <assign to="DocumentCharEncoding">iso-8859-1</assign>
  </output>
  <input message="xin">
       <assign to="." from="*"/>
  </input>
  </operation>
  </sequence> 
</process>

Example 3

Example of the correlation for the primary document that is created by the translator.

<process name = "GetDocumentInfoService_04"> 
<!-- GetDocumentInfoService_04 map must be checked in --> 
<!-- This business process uses GetDocumentInfoService_04_input_data.xml -->
  <rule name="New">
    <condition>WF_CORRELATIONS/correlation/value/text() = 'N'</condition>
  </rule>
  <rule name="Not New">
    <condition>WF_CORRELATIONS/correlation/value/text() != 'N'</condition>
  </rule>
  <sequence>
    <sequence name="Translate and Report">
      <operation name="Translation">
         <participant name="Translation"/>
        <output message="TranslationTypeInputMessage">
          <assign to="map_name">PurchaseOrder_Metadata_Test</assign>
          <assign to="." from="*"></assign>
        </output>
        <input message="inmsg">
          <assign to="." from="*"></assign>
        </input>
      </operation>
      <operation name="Correlation Service">
        <participant name="CorrelationService"/>
        <output message="CorrelationServiceTypeInputMessage">
          <assign to="NAME">BPMETA_MESSAGE_TYPE</assign>
          <assign to="VALUE">PurchaseOrder</assign>
          <assign to="TYPE">BUSINESS PROCESS</assign>
          <assign to="." from="*"></assign>
        </output>
        <input message="inmsg">
          <assign to="." from="*"></assign>
        </input>
      </operation>
      <operation name="GetDocumentInfoService">
      <participant name="GetDocumentInfoService"/>
      <output message="xout">
         <assign to="CORRELATION">true</assign>
         <assign to="." from="*"/>
    </output>
    <input message="xin">
         <assign to="." from="*"/>
  </input>
      </operation> 
    </sequence>
 <choice name="Check POType">
   <select>
      <case ref="New" activity="ProcessNewPO"/>
      <case ref="Not New" activity="ProcessOtherPO"/>
  </select>