Ephesoft Encryption Framework Web Service API

Overview

This document aims at explaining the Ephesoft Encryption Framework Web Service API. It talks about primarily two web services namely:

  1. DecryptBatchXml
  2. ImportBatchClass

DecryptBatchXml

This web-service helps to decrypt the batch xml file present in the final drop folder. The exported batch xml to be decrypted contains a key which is required for decrypting the batch xml in a Signature tag. This batch XML can only be decrypted on the server on which the batch was executed; this is because of the uniqueness in the Signature which is determined by Ephesoft application in use

Web Service URL

[ http://{serverName}:{port}/dcma/rest/importBatchClass]

Sample client code using apache commons http client:-

private static void decryptBatchXml() {

HttpClient client = new HttpClient();

String url = “http://localhost:8080/dcma/rest/decryptBatchXml”;

PostMethod mPost = new PostMethod(url);

mPost.setDoAuthentication(true);

// Input zip file for importing batch class.

File file1 = new File(“C:\\sample\\BI1_batch.xml”);

Part[] parts = new Part[1];

try {

parts[0] = new FilePart(file1.getName(), file1);

MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());

mPost.setRequestEntity(entity);

int statusCode = client.executeMethod(mPost);

if (statusCode == 200) {

System.out.println(“Batch XML decrypted successfully”);

} else if (statusCode == 403) {

System.out.println(“Invalid username/password.”);

} else {

System.out.println(mPost.getResponseBodyAsString());

}

} catch (FileNotFoundException e) {

System.out.println(“File not found for processing.”);

} catch (HttpException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

} finally {

if (mPost != null) {

mPost.releaseConnection();

}

}

}

ImportBatchClass

This API is used for importing batch class to the Ephesoft. This API takes XML as input parameters and exported batch class zip file as an input. According to the data present in the input XML file and the zip of batch xml a new batch class is imported into Ephesoft. If there is any encryption applied on the batch class to be exported then while importing the batch class Ephesoft can either retain its encryption or set any new encryption as specified in the input XML file. Encryption from a batch class can even be removed while importing it.

Web Service URL

[ http://{serverName}:{port}/dcma/rest/importBatchClass]

Input Parameter Values Descriptions
RolesImported Either “true”/”false” This value is used for importing roles with batch class or not.
EmailAccounts Either “true”/”false” This value is used for importing email accounts with batch class or not.
UseSource Either “true”/”false” This value is used for saving the information of source batch class to be imported
Name This value should not be empty This value is used to configure the batch class name of the imported batch class.
Description This value should not be empty This value is used to configure the description of the imported batch class.
Priority This value should lie in between 1 to 100. This value indicates the priority of batch class.
UseExisting Either “true”/”false” This value is used for overwrite the existing batch class with new batch class.
UncFolder This value should not be empty and have any string value that specified directory path These values specify the UNC folder path for batch class to be imported along with batch class.
Script This tag is configured for ScriptFile to be imported This tag is configured for which Script file to be imported
Folder This tag is configured for Folder to be imported This tag is configured for which folder to be imported along with batch class
UseKey Either “true”/”false” This tag decides if the encryption of exported batch class needs to be retained or not. If “true” then the encryption in exported batch class is retained (if no encryption was there in exported batch class then same will be in imported batch class). If “false” then other settings will be used for generating key.
BatchClassKey String value to be used as batch class key. The value for batch class key. If algorithm is “NONE” then no value for it is required.
EncryptionAlgorithm Name of encryption algorithm:

  • NONE
  • AES_128
  • AES_256
The type of algorithm to be used for encryption. If “NONE” is set for encryption algorithm then all encryption from batch class is removed. If UseKey value is set to true then this tag won’t change anything.

Checklist:-

  1. If UseExisting is “true”, existing batch class will be overwritten.
  2. If UseExisting is “false”, new batch class will be created.
  3. If UseSource is “true”, new batch class will have same Name, Description and Priority as source batch class.
  4. If UseSource is “false”, new batch class will have property like Name, Description and Priority as configured in input xml.

SampleInputXML:

<ImportBatchClassOptions>

<RolesImported>false</RolesImported>

<EmailAccounts>true</EmailAccounts>

<UseSource>false</UseSource>

<Name>BatchClassName</Name>

<Description>Description</Description>

<Priority>10</Priority>

<UseExisting>true</UseExisting>

<UncFolder>C:\ephesoft-data\Test-UNC</UncFolder>

<UseKey>false</UseKey>

<BatchClassKey>key</BatchClassKey>

<EncryptionAlgorithm>NONE</EncryptionAlgorithm>

<BatchClassDefinition>

<Scripts>

<Script>

<FileName>ScriptDocumentAssembler.java</FileName>

<Selected>true</Selected>

</Script>

<Script>

<FileName>ScriptPageProcessing.java</FileName>

<Selected>true</Selected>

</Script>

</Scripts>

<Folders>

<Folder>

<FileName>image-classification-sample</FileName>

<Selected>false</Selected>

</Folder>

</Folders>

<BatchClassModules>

<BatchClassModule>

<ModuleName></ModuleName>

<PluginConfiguration>true</PluginConfiguration>

</BatchClassModule>

</BatchClassModules>

</BatchClassDefinition>

</ImportBatchClassOptions>

Sample client code using apache commons http client:-

private static void importBatchClass() {

HttpClient client = new HttpClient();

String url = “http://localhost:8080/dcma/rest/importBatchClass“;

PostMethod mPost = new PostMethod(url);

mPost.setDoAuthentication(true);

// Input XML for adding parameter.

File file1 = new File(“C:\\sample\\importbatchclass.xml”);

// Input zip file for importing batch class.

File file2 = new File(“C:\\sample\\BC1_050712_1714.zip”);

Part[] parts = new Part[2];

try {

parts[0] = new FilePart(file1.getName(), file1);

parts[1] = new FilePart(file2.getName(), file2);

MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());

mPost.setRequestEntity(entity);

int statusCode = client.executeMethod(mPost);

if (statusCode == 200) {

System.out.println(“Batch class imported successfully”);

} else if (statusCode == 403) {

System.out.println(“Invalid username/password.”);

} else {

System.out.println(mPost.getResponseBodyAsString());

}

} catch (FileNotFoundException e) {

System.out.println(“File not found for processing.”);

} catch (HttpException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

} finally {

if (mPost != null) {

mPost.releaseConnection();

}

}

}

Was this article helpful to you?

Walter Lee