Export to Web Service plugin

This functionality allows the Transact users to export the batches (PDF/TIFF and Batch XML files) to the configured Web Service path. To implement this feature, use the EXPORT_TO_WEB_SERVICE plugin in the Export module of Transact.

You can use the default functionality or modify it according to your requirements.

Default Functionality
In the default case scenario, Transact provides a default service and client to export the PDF/TIFF/XML files to the specified location. You just need to specify the URL where you have deployed the Web Service. This default class provides the functionality to simply export the specified file. Exported files are placed under the path SharedFoldersfinal-drop-folder<Batch Instance Id>.
User Defined Functionality
If required, you can change the default functionality according to your requirements. You can configure the .jar files by modifying the classes and then import them into the Batch Class at run-time. For example, you can add another class in the .jar file to merge all the exported files into one single document. If you want to implement any authentication scheme, you can add your own implementation in the new modified class.

Both default and user-defined functionalities are provided for both REST and SOAP Web Services export.

There are three supported authentication types for REST: no authentication, basic authentication, and OAuth 2.0. For SOAP, no authentication types are supported.

Prerequisites

Add the EXPORT_TO_WEB_SERVICE plugin to the Export module:

  1. Log in to the Transact application.
  2. Open the Batch Class for which you want to configure the plugin.
  3. Go to Modules > Export.

    The Export module lists all the plugins that are configured.

  4. Locate the plugin in the Associated Plugins list.
  5. Drag and drop the plugin to the Selected Plugins list.
  6. Click Apply and Deploy to save the workflow changes.

    The EXPORT_TO_WEB_SERVICE_PLUGIN is added to the module list.

    The EXPORT_TO_WEB_SERVICE plugin must always be placed after the CREATEMULTIPAGE_FILES plugin and before the CLEANUP plugin.

  7. Navigate to the EXPORT_TO_WEB_SERVICE plugin.

    Make sure that the Export Switch is ON.

  8. Click the arrow next to the EXPORT_TO_WEB_SERVICE_PLUGIN and select Configure to open the Export to Web Service Configurations screen.

Now, you are ready to setup the EXPORT_TO_WEB_SERVICE plugin.

The plugin includes several sections. The sections are opened consecutively depending on the details that you provide.

All configuration options are explained in detail in the following topics.

Configure the export to SOAP Web Service

  1. Fill in the Connection Details.

    Field

    Description

    Web Service URL

    This text box is for configuring the target path of the Web Service where the exported files are to be placed. The path depends on the type of the selected Web Service.

    In case of REST Web Services, the URL looks as follows:

    http://<hostname>:<port>/ dcma/export/uploadExportedFile

    In case of SOAP Web Services, the URL looks as follows:

    http://<hostname>:<port>/dcma/soap/UploadFile?wsdl

    Web Service Type

    These radio buttons are used for selecting the type of Web Service. Two types of Web Services are supported: REST and SOAP.

    Once you select the type of Web Service, the Export Details section opens.

  2. Fill in the Export Details.

    Field

    Description

    Export File(s)

    This drop-down list contains the types of files that can be exported. By default, PDF type is selected. To export only TIFF files, select TIFF. To export both PDF and TIFF files, select PDF and TIFF.

    The batch.xml is always exported along with the file.

    The file type selected here must correspond to the file type specified in the Multipage File Creation Type field of CREATE_MULTIPAGE_FILES plugin (see Create Multipage Files plugin).

    Export File Name

    This text box is used for generating the export file name. By default, it follows the EDIT_MASK: $BATCH_IDENTIFIER & _ & $DOCUMENT_ID

    For example: BI1A_DOC1

    Use the following list of keywords to create Export File Name dynamically:

    BATCH_IDENTIFIER BATCH_CLASS BATCH_FIELD_VALUE DOCUMENT_ID DOCUMENT_TYPE SERVER_NAME TIME DATE DLF

  3. At this stage, you can either implement the defined functionality or add a custom .jar file containing custom details for your Web Service.
    • If you want to use the default functionality, click Apply to save your configuration.

    • If you want to import your own client for the Web Service, select Add Custom Jar for Client. The Custom Jar Details section appears.

      Field

      Description

      Upload Zip

      Click Browse to find and import a .zip file containing all .jar files required for the plugin execution. The name of the .zip file and the name of the .jar that has the client implementation should be the same (for example, custom.zip & custom.jar). All the dependencies for this .jar file should be zipped together.

      Class Name

      This drop-down list includes all the classes of the .jar file placed on the server. Once you select the class, the field becomes uneditable. If you want to reload the class names, click Re-Deploy Jar.

      After you fill in the Custom Jar Details, click Apply and Deploy to save the configuration. The batches (PDF/TIFF and Batch XML files) are exported to the specified SOAP Web Service.

    If you do not provide complete and correct information for any mandatory field, the corresponding message is displayed, prompting you to update the details.

Configure the export to REST Web Service

  1. Fill in the Connection Details as described earlier.

    Provide REST Web Service URL and select REST as the Web Service Type.

    Once you select the type of Web Service, a new Authentication Type field is populated on the screen. For a REST Web Service, you can select one of the following authentication types:

    • No authentication

    • Basic authentication

    • OAuth 2.0

    Field

    Description

    Web Service URL

    This text box is for configuring the target path of the Web Service where the exported files are to be placed. The path depends on the type of the selected Web Service.

    In case of REST Web Services, the URL looks as follows:

    http://<hostname>:<port>/ dcma/export/uploadExportedFile

    In case of SOAP Web Services, the URL looks as follows:

    http://<hostname>:<port>/dcma/soap/UploadFile?wsdl

    Web Service Type

    These radio buttons for selecting the type of Web Service. Two types of Web Services are supported - REST and SOAP.

  2. Select the authentication type.
    • If you select NONE, you directly proceed to the Export Details section.

    • If you select BASIC_AUTHENTICATION, you see the Basic Authentication Details section.

      Field

      Description

      Username

      For basic authentication, enter the username in the text box that is verified at the server end to authenticate the user.

      Password

      For basic authentication, enter the password in the text box that is verified at the server end to authenticate the password of the user. The connection is established only if the combination of user name and password is authenticated at the server end.

      After you provide the required information, click Add Export Details. The Basic Authentication details are saved and the Export Details section opens.

    • If you select OAUTH_2, you see OAuth Configuration section.

      Field

      Description

      Client ID

      Client ID is a public identifier for apps, similar to the user name.

      Access Token URL

      This is a URL from which authentication token is received.

      Client Secret

      Client Secret is a secret known only to the application and the authorization server, similar to the password.

      Grant Type

      Grant types are used to authorize access to protected resources in many ways with different security credentials. Currently, Client Credentials is the only supported Grant type.

      Add Token To

      Here you can select whether you want to pass OAuth 2.0 authorization (access token) in the Header or URL.

      After you provide the required information, click Add Export Details. The OAuth 2.0 details are saved and the Export Details section opens.

  3. After you have selected and configured your authentication type, fill in the Export Details.

    Field

    Description

    Export File(s)

    This drop-down list contains the types of files that can be exported. By default, PDF type is selected. To export only TIFF files, select TIFF. To export both PDF and TIFF files, select PDF and TIFF.

    The batch.xml file is always exported along with the file.

    The file type selected here must correspond to the file type specified in the Multipage File Creation Type field of CREATE_MULTIPAGE_FILES plugin (see Create Multipage Files plugin).

    Export File Name

    This text box is used for generating the export file name. By default, it follows the EDIT_MASK: $BATCH_IDENTIFIER & _ & $DOCUMENT_ID

    For example: BI1A_DOC1

    Use the following list of keywords to create Export File Name dynamically:

    • BATCH_IDENTIFIER

    • BATCH_CLASS

    • BATCH_FIELD_VALUE

    • DOCUMENT_ID

    • DOCUMENT_TYPE

    • SERVER_NAME

    • TIME

    • DATE

    • DLF

  4. At this stage, you can either implement the defined functionality or add a custom jar file containing custom details for your Web Service.
    • If you want to use the default functionality, click Apply to save your configuration.

    • If you want to import your own client for the Web Service, select Add Custom Jar for Client. This takes you to the Custom Jar Details section.

      Field

      Description

      Upload Zip

      Click Browse to find and import a .zip file containing all .jar files required for the plugin execution.

      The name of the .zip file and the name of the .jar that has the client implementation should be the same (foe example, custom.zip & custom.jar). All the dependencies for this jar. file should be zipped together.

      Class Name

      This drop-down list includes all the classes of the .jar file placed on the server. Once you select the class, the field becomes uneditable.

      If you want to reload the class names, click Re-Deploy Jar.

      Once you fill in the Custom Jar Details, click Apply and Deploy to save the configuration. The batches (PDF/TIFF and Batch XML files) are exported to the specified REST Web Service.

If any input parameter of Export to Web Services plugin is entered incorrectly, the batch goes into the error state.

In Transact, the SOAP/REST client is implemented via the UI interface described above.

The Custom Client implementation can be performed in the ExportToWebService interface for both SOAP and REST Web Services.

View the following sample client code of CloseableHTTPClient of java with NoAuth as authentication mechanism to send request of Multipart/form-data type.

Sample client code of CloseableHTTPClient