Quantcast
Channel: Ephesoft Docs
Viewing all 478 articles
Browse latest View live

extractFuzzyDB

$
0
0

This API will create the document level fields for the document type using fuzzy Db based extraction for the specified batch class for HOCR file.

Request Method POST

Input Parameters

Input Parameter Values Descriptions
documentType This should not be empty and valid document type for that batch class This parameter is used for generating document level fields for defined document type.
batchClassIdentifier This should not be empty and valid batch class identifier This parameter used for fetching the information of the document for defined document type
hocrFile This value should not and empty and should have same name as HOCR file attached for processing. This parameter is used for verifying the HOCR file name.

 

Web Service URL: http://{serverName}:{port}/dcma/rest/extractFuzzyDB

 

CheckList:-

  1. hocrFile should have same HOCR file name that are passed for processing.
  2. BatchClass having that batchClassIdentifier should have fuzzyDB plugin configured for processing.
  • DocumentType should have document level fields for specified document type.

 

Sample client code using apache commons http client:-

private static void extractFuzzyDB() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/extractFuzzyDB";
		PostMethod mPost = new PostMethod(url);
		// Adding HOCR file for processing
		File file = new File("C:\\sample\\US-Invoice_HOCR.xml");
		Part[] parts = new Part[4];
		try {
			parts[0] = new FilePart(file.getName(), file);
			// Adding parameter for docuement type.
			String documentType = "US Invoice";
			parts[1] = new StringPart("documentType", documentType);
			// Adding parameter for batch class.
			String batchClassIdentifier = "BC5";
			parts[2] = new StringPart("batchClassIdentifier", batchClassIdentifier);
			parts[3] = new StringPart("hocrFile", file.getName());
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = mPost.getResponseBodyAsString();
				// Generating result as responseBody.
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

barcodeExtraction

$
0
0

This API will create the document level fields for the document type for the specified batch class for barcode in the input tiff file.

Request Method POST

Input Parameters

Input Parameter Values Descriptions
documentType This should not be empty and valid document type for that batch class This parameter is used for generating document level fields for defined document type.
batchClassIdentifier This should not be empty and valid batch class identifier This parameter used for fetching the information of the document for defined document type
imageName This value should not and empty. On this file extraction operation will be performed.

 

Web Service URL: http://{serverName}:{port}/dcma/rest/barcodeExtraction

Sample XML file

 

<WebServiceParams>

<Params>

<Param>

<Name>batchClassIdentifier</Name>

<Value>BC5</Value>

</Param>

<Param>

<Name>imageName</Name>

<Value>US-Invoice.tif</Value>

</Param>

<Param>

<Name>docType</Name>

<Value>US Invoice</Value>

</Param>

</Params>

</WebServiceParams>

 

CheckList:-

  1. BatchClass having that batchClassIdentifier should have Barcode Extraction plugin for processing.
  2. DocumentType should have document level fields for specified document type.
  • Image name should have valid extension i.e. TIF/TIFF.

 

Sample client code using apache commons http client:-

private static void barcodeExtraction() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/barcodeExtraction";
		PostMethod mPost = new PostMethod(url);
		File file1 = new File("C:\\sample\\sample.xml");
		// adding xml file for taking input
		File file2 = new File("C:\\sample\\US-Invoice.tif");
		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("Web service executed successfully.");
				System.out.println(mPost.getResponseBodyAsString());
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

regularRegexExtraction

$
0
0

This API will extract the document level fields for the document type for the specified batch class using regular regex extraction.

Request Method POST

Input Parameters

Input Parameter Values Descriptions
documentType This should not be empty and valid document type for that batch class This parameter is used for generating document level fields for defined document type.
batchClassIdentifier This should not be empty and valid batch class identifier This parameter used for fetching the information of the document for defined document type.
hocrFile This value should not be empty. XML file name for which document level fields will be extracted.

 

An input string parameter hocrFile is to be supplied to denote the name of the HOCR file input to the web service.

 

Web Service URL: http://{serverName}:{port}/dcma/rest/extractFieldsUsingRegex

Sample XML file

<WebServiceParams>

<Params>

<Param>

<Name>documentType</Name>

<Value>US Invoice</Value>

</Param>

<Param>

<Name>batchClassIdentifier</Name>

<Value>BC5</Value>

</Param>

<Param>

<Name>hocrFileName</Name>

<Value>US-Invoice_HOCR.xml</Value>

</Param>

</Params>

</WebServiceParams>

 

CheckList:-

  1. This batch class specified should have Regular Regex plugin configured.
  2. DocumentType should have document level fields for specified document type.
  • HOCR file name should have valid extension, i.e., XML.

 

Sample client code using apache commons http client:-

private static void extractFieldsUsingRegex() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/extractFieldsUsingRegex";
		PostMethod mPost = new PostMethod(url);
		File file1 = new File("C:\\sample\\sample.xml");
		// adding xml file for taking input
		File file2 = new File("C:\\sample\\US-Invoice_HOCR.xml");
		Part[] parts = new Part[3];
		try {
			parts[0] = new FilePart(file1.getName(), file1);
			parts[1] = new FilePart(file2.getName(), file2);
			parts[2] = new StringPart("hocrFile ", file2.getName());
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				System.out.println(mPost.getResponseBodyAsString());
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

commonAPIForExtraction

$
0
0

This API can be utilised to perform extraction from the list of extraction plugins depicted below. Rest of the information for the individual API can be found above.

Request Method POST

 

Input for Extraction Type:

Pass the name of extraction API that is to be used in the client header as shown in following code snippet.

The header extractionAPI can have any of the values from the list given below

  • BARCODE_EXTARCTION
  • RECOSTAR_EXTARCTION
  • REGULAR_REGEX_EXTRACTION
  • KV_EXTRACTION
  • FUZZY_DB

Other inputs to the web service are used as per the extraction performed.

 

Web Service URL: http://{serverName}:{port}/dcma/rest/extractFields

Here’s the sample client code using Regular Regex Extraction:

private static void extractFields() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/extractFields";
		PostMethod mPost = new PostMethod(url);
		File file1 = new File("C:\\sample\\sample.xml");
		// adding xml file for taking input
		File file2 = new File("C:\\sample\\US-Invoice_HOCR.xml");
		try {
			/*
			 * Pass the name of extraction API that is to used: BARCODE_EXTARCTION RECOSTAR_EXTARCTION REGULAR_REGEX_EXTRACTION
			 * KV_EXTRACTION FUZZY_DB
			 */
			Header header = new Header("extractionAPI", "REGULAR_REGEX_EXTRACTION");
			Part[] parts = new Part[3];
			parts[0] = new FilePart(file1.getName(), file1);
			parts[1] = new FilePart(file2.getName(), file2);
			parts[2] = new StringPart("hocrFileName", file2.getName());
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.addRequestHeader(header);
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				System.out.println(mPost.getResponseBodyAsString());
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

ExtractKVForDocumentType

$
0
0

This Web Service API is used to perform Key Value Extraction for the Document type of the specified Batch Class, for the input HOCR XML provided.

Request Method POST

Input Parameters

Input Parameter Values Descriptions
BATCH_CLASS_IDENTIFIER This value should be an existing batch class Id. This Parameter specifies the Batch Class Id for key Value extraction needs to be performed.
DOCUMENT_TYPE This should be an existing document type. This tag should contain name of document type of the Batch Class Identifier

For which KV extraction to be performed through Web service API.

HOCR_ZIP_FILE HOCR XML/(s) zipped to a folder name should be specified ZIP file which is uploaded, containing HOCR XML’s on basis of which extraction is performed. For example HOCR.zip. Please add .zip extension to file name.

 

Web Service URL:[http://{serverName}:{port}/dcma/rest/batchClass/ExtractKVForDocumentType]

Check List:-

  1. Batch_Class_Identifier should be existing and non-empty.
  2. DOCUMENT_TYPE should be existing and non-empty.
  3. HOCR_ZIP_FILE should contain file*_HOCR.xml zipped directly to a folder

Sample Input XML:

<KV_Extraction_DocType>

<Batch_Class>BC5</Batch_Class>

<Document_Type>US Invoice</Document_Type>

<HOCR_File>US-Invoice_HOCR.zip</HOCR_File>

</KV_Extraction_DocType>

Note: Values highlighted in blue should be replaced with corresponding values while executing the Web service for performing key value extraction.

Sample client code using apache commons http client:-

private static void extractKVForDocumentType () {
		HttpClient client = new HttpClient();
		String url = " http://localhost:8080/dcma/rest/batchClass/ExtractKVForDocumentType ";
		PostMethod mPost = new PostMethod(url);
		// Adding Input XML file for processing
		File file = new File("C:\\sample\\sample.xml");
		File hocrZipFile = new File("C:\\sample\\US-Invoice_HOCR.zip");
		Part[] parts = new Part[2];
		try {
			parts[0] = new FilePart(file.getName(), file);
			parts[1] = new FilePart(hocrZipFile.getName(), hocrZipFile);
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = mPost.getResponseBodyAsString();
				// Generating result as responseBody.
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

createOCR

$
0
0

This API will generate the OCR result for the specified sample image file.  This API works for single page tif and png file. While processing the color image we accept the png/tif file as input and for black and white image we accept tif file as input.

Request Method POST

Input Parameters:

Input Parameter Values Descriptions
ocrEngine Either “recostar”/”tesseract”/”nuance” This parameter is used for configuring the ocrEngine  to be used
colorSwitch Either “ON”/”OFF” This parameter is used to define the input file is coloured or not
tesseractVersion Currently we are supporting “tesseract_version_3” This parameter is used for tesseract version to be used.
cmdLanguage Either “tha”/”eng” This parameter is used for configure the language that has been learnt by tessearact.
projectFile This will be empty in case of tesseract and nuance ocrEngine but mandatory for recostar This parameter is validating the RSP used for OCRing in case of recostar. For tesseract and nuance this wil remain empty

 

Web Service URL: http://{serverName}:{port}/dcma/rest/createOCR

CheckList:-

  1. In case ocrEngine is recostar, than colorSwitch and projectFile is mandatory parameters.
  2. In case ocrEngine is tesseract than colorSwitch, tesseractVersion and cmdLanguage is mandatory parameters.Files required as input will be image file and xml file.
  • In case ocrEngine is nuance, mandatory files to the web service would be image file and an xml file. No project processing file is required while ocring
  1. If colorSwitch is ON, input image can be tif/png.
  2. If colorSwitch is OFF than input image should be TIFF.

File format for XML file:

<WebServiceParams>

<Params>

<Param>

<Name>ocrEngine</Name>

<Value>recostar</Value>

</Param>

<Param>

<Name>colorSwitch</Name>

<Value>off</Value>

</Param>

<Param>

<Name>tesseractVersion</Name>

<Value>tesseract_version_3</Value>

</Param>

<Param>

<Name>cmdLanguage</Name>

<Value>eng</Value>

</Param>

<Param>

<Name>projectFile</Name>

<Value>Fpr.rsp</Value>

</Param>

</Params>

</WebServiceParams>

 

Sample client code using apache commons http client:-

private static void createOCR() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/createOCR";
		PostMethod mPost = new PostMethod(url);
		// adding image file for processing
		File file1 = new File("C:\\sample\\sample.xml");
		// adding xml file for taking input
		File file2 = new File("C:\\sample\\US-Invoice.tif");
		// adding rsp file used for creating OCR in case of recostar
		File file3 = new File("C:\\sample\\FPR.rsp");
		Part[] parts = new Part[3];
		try {
			parts[0] = new FilePart(file1.getName(), file1);
			parts[1] = new FilePart(file2.getName(), file2);
			parts[2] = new FilePart(file3.getName(), file3);
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				InputStream in = mPost.getResponseBodyAsStream();
				// saving result generated.
				File outputFile = new File("F:\\sample\\serverOutput.zip");
				FileOutputStream fos = new FileOutputStream(outputFile);
				try {
					byte[] buf = new byte[1024];
					int len = in.read(buf);
					while (len > 0) {
						fos.write(buf, 0, len);
						len = in.read(buf);
					}
				} finally {
					if (fos != null) {
						fos.close();
					}
				}
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

Copy Batch Class

$
0
0

This API will create the copy of an existing batch class whose identifier is provided as input/source. Other parameters required for the batch class creation are as follows:

Request Method POST

Web Service URL:http://{serverName}:{port}/dcma/rest/batchClass/copyBatchClass

Input Parameter Values Descriptions
batchClassName The Name of batch class should not be empty or contains characters like space(“ “) or hyphen(“-“) and should not be more than 255 characters. The unique character is used for naming the new copied batch class.
batchClassDescription This should be a non-empty Value This parameter is the description of the new copied batch class.
batchClassPriority The batch class priority cannot be null or empty and should be between 1 and 100 inclusive of both. The priority of the batch class.
batchUNCFolder The UNC folder name for the batch class. This UNC folder name for the new copied batch class.
copyBatchClassIdentifier This value should be non-empty and a preexisting Batch Class Idenitifer The identifier of the Batch Class which is used as reference for copying.
gridWorkflow Can be true or false States the workflow, is the batch class deployed as grid workflow or normal workflow.

 

Sample Input XML:


<WebServiceParams>

 

<Params>

 

<Param>

 

<Name>batchClassName</Name>

 

<Value>AsiDocTypeClasTem_ticket_copy222</Value>

 

</Param>

 

<Param>

 

<Name>batchClassDescription</Name>

 

<Value>AsiDocTypeClasTem_ticket</Value>

 

</Param>

 

<Param>

 

<Name>batchClassPriority</Name>

 

<Value>1</Value>

 

</Param>

 

<Param>

 

<Name>batchUNCFolder</Name>

 

<Value>/opt/Ephesoft/SharedFolders/Copy_BC12</Value>

 

</Param>

 

<Param>

 

<Name>copyBatchClassIdentifier</Name>

 

<Value>BC4</Value>

 

</Param>

 

<Param>

 

<Name>gridWorkflow</Name>

 

<Value>FALSE</Value>

 

</Param>

 

</Params>

 

</WebServiceParams>

 

Note: Values highlighted in blue should be replaced with corresponding values while executing the Web service for copying an existing batch Class.

 

Sample client code using apache commons http client:-

private static void copyBatchClass() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/batchClass/copyBatchClass";
		PostMethod mPost = new PostMethod(url);
		// Adding Input XML file for processing
		File file = new File("C:\\sample\\sample.xml");
		Part[] parts = new Part[1];
		try {
			parts[0] = new FilePart(file.getName(), file);
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = mPost.getResponseBodyAsString();
				// Generating result as responseBody.
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

extractKV

$
0
0

This API will extract the document level fields for the corresponding Key Value pattern provided using input XML. This API will take the HOCR file as input. If the Key Value pattern is not found in the HOCR file then it will create the empty document level fields.

Request Method POST

Input Parameters

Input Parameter Values Descriptions
AdvancedKV Either “true”/”false” This parameter is used to specifying the KeyValue extraction is perform by advanced key value or not.
LocationType This value should be one of the following:

TOP, RIGHT, LEFT, BOTTOM, TOP_RIGHT, TOP_LEFT, BOTTOM_LEFT, BOTTOM_RIGHT

 

This parameter will fetch the Value pattern of the particular key pattern on the location provided.
NoOfWords Should be Integer This parameter is used for specify in case of AdvancedKV is false. This parameter is used for adding number word of RIGHT location in the result of the value pattern found in the HOCR.
KeyPattern This value should not be empty.

This value should be valid regex expression.

 

This is used for verify the Key pattern present in given HOCR.
ValuePattern This value should not be empty.

This value should be valid regex expression.

 

This is used for verify the Value pattern present in given HOCR for that particular Key Pattern.
KVFetchValue This value should be one of the following:

ALL, FIRST, LAST

This parameter is used to specify the whether we need fetch all, first or last value pattern found.

 

 

Multiplier This value should be float and should be in between 0 to 1 This value is used to multiply with confidence for updating the confidence of the fields extracted using advanced KV.
Length This value should be integer For getting length value use Ephesoft Admin Screen as display screen shot above
Width This value should be integer For getting width value use Ephesoft Admin Screen as display screen shot above
Xoffset This value should be integer For getting xoffset value use Ephesoft Admin Screen as display screen shot above
Yoffset This value should be integer For getting yoffset value use Ephesoft Admin Screen as display screen shot above
Weight This value should be float and should be in between 0 to 1 This value is used to set the weightage for a extraction rule for a particular document level field.
KeyFuzziness This value should be float and should be in between 0 to 1 This value is used to define the acceptable fuzziness in the key generated from HOCR
hocrFileName This value should be string This value should be having HOCR file name passing for processing in XML file format.

Along these parameters hocrFileName string parameter is also to be supplied containing the name of the HOCR file uploaded.

Web Service URL: http://{serverName}:{port}/dcma/rest/extractKV

CheckList:

  • For using Advance KV user should have admin access to fetch the accurate value of Length, Width, Xoffset and Yoffset. Before using AdvancedKV, please test the image with Ephesoft Admin Screen and note the values of Length, Width, Xoffset, Yoffset and LocationType for the particular KeyValue pattern.
  • If AdvancedKV is true than NoOfWords is not use and all other parameters is used.
  • If AdvancedKV is false than NoOfWords, KeyPattern, ValuePattern and LocationType will work.

Format for XML:

<ExtractKVParams>

<Params>

<AdvancedKV>true</AdvancedKV>

<LocationType>BOTTOM_LEFT</LocationType>

<NoOfWords>0</NoOfWords>

<KeyPattern>Invoice</KeyPattern>

<ValuePattern> [a-zA-Z]{10,15}</ValuePattern>

<KVFetchValue>ALL</KVFetchValue>

<Multiplier>1</Multiplier>

<Length>384</Length>

<Width>251</Width>

<Xoffset>284</Xoffset>

<Yoffset>105</Yoffset>

<Weight>0.1</Weight>

<KeyFuzziness>0.2</KeyFuzziness>

</Params>

</ExtractKVParams>

 

Sample client code using apache commons http client:-

private static void extractKV() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/extractKV";
		PostMethod mPost = new PostMethod(url);
		// Adding XML for the input.
		File f1 = new File("C:\\sample\\ExtractKVParam.xml");
		// Adding HOCR for processing.
		File f2 = new File("C:\\sample\\US-Invoice_HOCR.xml");
		Part[] parts = new Part[3];
		try {
			parts[0] = new FilePart(f1.getName(), f1);
			parts[1] = new FilePart(f2.getName(), f2);
			parts[2] = new StringPart("hocrFileName", f2.getName());
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = mPost.getResponseBodyAsString();
				// Generating result as responseBody.
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}	}


createHOCRforBatchClass

$
0
0

This Web Service API is used to create HOCR XML forsingle page/multipage tiff/tif or zip containg tiff or pdf passed as input for a particular batch class. This Web Service API requires two Inputs i.e. Input xml and image file to create HOCR_xml.

On the basis of Batch Class Identifier provided as an input, this API will Extract plugin configuration settings of RECOSTAR_HOCR/TESSERACT_HOCR/NUANCE_HOCR plugin in Page Process module, if property named “Recostar Switch” value is turned ON then process of OCRing will be done for Recostar and its corresponding plugin configurations will be used else Tesseract will be used to perform OCRingin case of windows.Similarly OCRing can be performed on Linux using either Tesseract or Nunace.

Request Method POST

Input parameters required for the batch class creation are as follows:

Input Parameter Value Description
batchClassIdentifier It should contain a valid value of an existing batch Class Identifier. The Batch Class name whose configurations are to be utilised to generate HOCR.xml.
imageName Optional parameter This parameter value contain name tif/tiff or ZIP file for which HOCR XML need to be created with extension specified.

 

Web Service URL: [http://{serverName}:{port}/dcma/rest/batchClass/createHOCRforBatchClass]

Check list:

  1. Batch Class Identifier should be valid and existing.
  2. Only single page tif/tiff should be passed as an input or a zip file (which may contain single/multipage tiff or pdf).

Sample Input XML:

<WebServiceParams>

<Params>

<Param>

<Name>batchClassIdentifier</Name>

<Value>BC5</Value>

</Param>

<Param>

<Name>imageName</Name>

<Value>US-Invoice.zip</Value>

</Param>

</Params>

</WebServiceParams>

 

Sample client code using apache commons http client:-

private static void createHOCRXML() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/batchClass/createHOCRforBatchClass";
		PostMethod mPost = new PostMethod(url);
		// Adding Input XML file for processing
		File file = new File("C:\\sample\\createHOCR.xml");
		File imageFile = new File("C:\\sample\\US-Invoice.tif");
		Part[] parts = new Part[2];
		try {
			parts[0] = new FilePart(file.getName(), file);
			parts[1] = new FilePart(imageFile.getName(), imageFile);
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				InputStream in = mPost.getResponseBodyAsStream();
				// saving result generated.
				File outputFile = new File("F:\\sample\\serverOutput.zip");
				FileOutputStream fos = new FileOutputStream(outputFile);
				try {
					byte[] buf = new byte[1024];
					int len = in.read(buf);
					while (len > 0) {
						fos.write(buf, 0, len);
						len = in.read(buf);
					}
				} finally {
					if (fos != null) {
						fos.close();
					}
				}
				System.out.println("Web service executed successfully.");
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

Learn File

$
0
0

This API will learn all the files present in the batch class folders for the batch class whose identifier is provided as input.

Request Method POST

Web Service URL: http://{serverName}:{port}/dcma/rest/batchClass/learnFile/{BatchClassIdentifier}

Input Parameter Values Descriptions
BatchClassIdentifier This value should be nonempty and a pre-existing Batch Class’s identifier. The value is provided in the URL only. The identifier of the batch class for which learning has to be done.

Note: – Replace the parameter BatchClassIdentifier in the input URL for which learning should be performed.

Sample client code using apache commons http client:-

private static void fileLearningService() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/batchClass/learnFile/BC5";
		PostMethod mPost = new PostMethod(url);
		try {
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = mPost.getResponseBodyAsString();
				// Generating result as responseBody.
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}

getBatchInstanceForRole

$
0
0

This API is used to fetch the list of all batch instance accessable to the specific user role.

Request Method: GET

Input Parameter

Input Parameter Values Descriptions
role This value should not be empty.

 

This parameter is used for specifying the role name for which batch instance list to be fetched.

 

Web Service URL: http://{serverName}:{port}/dcma/rest/getBatchInstanceForRole/{role}

 

Sample client code using apache commons http client:-

private static void getBatchInstanceForRole() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/getBatchInstanceForRole/admin";
		GetMethod getMethod = new GetMethod(url);
		int statusCode;
		try {
			statusCode = client.executeMethod(getMethod);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = getMethod.getResponseBodyAsString();
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(getMethod.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (getMethod != null) {
				getMethod.releaseConnection();
			}
		}
	}

getBatchClassForRole

$
0
0

This API is used to fetch all batch class list accessable to the specified user role.

Request Method: GET

Input Parameters

Input Parameter Values Descriptions
role This value should not be empty.

 

This parameter is used for specifying the role name for which batch class list to be fetched.

Web Service URL: http://{serverName}:{port}/dcma/rest/getBatchClassForRole/{role}

 

Sample client code using apache commons http client:-

private static void getBatchClassForRole() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/getBatchClassForRole/admin";
		GetMethod getMethod = new GetMethod(url);
		int statusCode;
		try {
			statusCode = client.executeMethod(getMethod);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = getMethod.getResponseBodyAsString();
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(getMethod.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (getMethod != null) {
				getMethod.releaseConnection();
			}
		}
	}

BatchInstanceList

$
0
0

The API will return a list of all the batch instances with the status given in the input parameter. Only the list of batches will be returned that are accessible by the particular authenticated user.

Request Method: GET

Input Parameters:

Input Parameter Values Descriptions
status This values can be  NEW, LOCKED,READY,ERROR, FINISHED,ASSIGNED, RUNNING, READY_FOR_REVIEW,

READY_FOR_VALIDATION, RESTARTED, DELETED, TRANSFERRED, RESTART_IN_PROGRESS

This parameter is used for specifying the batch instance status for which batch instance list to be fetched.

 

Web Service URL: http://{serverName}:{port}/dcma/rest/BatchInstanceList/{status}

Checklist:-

Batches must have status provided in the list above.

 

Sample client code using apache commons http client:-

private static void getBatchInstanceList() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/BatchInstanceList/ERROR";
		GetMethod getMethod = new GetMethod(url);
		int statusCode;
		try {
			statusCode = client.executeMethod(getMethod);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = getMethod.getResponseBodyAsString();
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(getMethod.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (getMethod != null) {
				getMethod.releaseConnection();
			}
		}
	}

getAllModulesWorkflowNameByBatchClass

$
0
0

This API will return the module workflow names and the module names for the specified batch class identifier.

Request Method: GET

Input Parameters

Input Parameter Values Descriptions
batchClassIdentifier This value should not be empty. This parameter is used for specifying the batch class identifier for which module name to be fetched.

Web Service URL: http://{serverName}:{port}/dcma/rest/getAllModulesWorkflowNameByBatchClass/{batchClassIdentifier}

Sample client code using apache commons http client:-

private static void getAllModulesWorkflowNameByBatchClass() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/getAllModulesWorkflowNameByBatchClass/BC1";
		GetMethod getMethod = new GetMethod(url);
		int statusCode;
		try {
			statusCode = client.executeMethod(getMethod);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = getMethod.getResponseBodyAsString();
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(getMethod.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (getMethod != null) {
				getMethod.releaseConnection();
			}
		}
	}

restartBatchInstance

$
0
0

This API is used to restart the batch from the specified module. User can restart only those batch instances that are accessible to their role.

Request Method: GET

Input Parameters

Input Parameter Values Descriptions
batchInstanceIdentifier This value should be valid batch instance identifier. This parameter is used to specifying the batch instance identifier for which batch instance to be restart.
restartAtModuleName This value should not be empty.

Example Folder_Import

This parameter is used specifying the module name from where batch needs to be restarted.

 

Web Service URL: http://{serverName}:{port}/dcma/rest/restartBatchInstance/{batchInstanceIdentifier}/{restartAtModuleName}

Checklist:-

  1. Batch Instance identifier should be valid and must be acessible to the user.
  2. restartAtModuleName parameter value should valid module name and it can be differ with batch class.

Sample client code using apache commons http client:-

private static void restartBatchInstance() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/restartBatchInstance/BI1/Folder_Import_Module";
		GetMethod getMethod = new GetMethod(url);
		int statusCode;
		try {
			statusCode = client.executeMethod(getMethod);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = getMethod.getResponseBodyAsString();
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(getMethod.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (getMethod != null) {
				getMethod.releaseConnection();
			}
		}
	}

deleteBatchInstance

$
0
0

This API is used to delete the batch instance for the specific batch instance identifier. This API will delete that batch instance being accessed by the authenticated user.

Request Method: GET

Web Service URL: http://{serverName}:{port}/dcma/rest/deleteBatchInstance/{identifier}

Input Parameter Values Descriptions
batchInstanceIdentifier This value should be a valid batch instance identifier.Example BI10 This parameter is used to specify the batch instance to be deleted.

 

Sample client code using apache commons http client:-

private static void deleteBatchInstance() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/deleteBatchInstance/BI2";
		GetMethod getMethod = new GetMethod(url);
		int statusCode;
		try {
			statusCode = client.executeMethod(getMethod);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = getMethod.getResponseBodyAsString();
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(getMethod.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (getMethod != null) {
				getMethod.releaseConnection();
			}
		}
	}

restartAllBatchInstance

$
0
0

This API is used to restart all the batches that can be accessed by the authenticated user having status READY_FOR_REVIEW or READY_FOR_VALIDATION.

Request Method: GET

Web Service URL: http://{serverName}:{port}/dcma/rest/restartAllBatchInstance

Checklist:-

  1. Only user accesbile batches will restart whose status is READY_FOR_REVIEW or READY_FOR_VALIDATION.

 

Sample client code using apache commons http client:-

private static void restartAllBatchInstance() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/restartAllBatchInstance";
		GetMethod getMethod = new GetMethod(url);
		int statusCode;
		try {
			statusCode = client.executeMethod(getMethod);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				String responseBody = getMethod.getResponseBodyAsString();
				System.out.println(statusCode + " *** " + responseBody);
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(getMethod.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (getMethod != null) {
				getMethod.releaseConnection();
			}
		}
	}

importBatchClass

$
0
0

This API is used to import an existing batch class. This API takes XML (with input parameters) and batch class to be imported. Batch class is in zip format when exported by Ephesoft which is required by the API

Request Method POST

Web Service URL: http://{serverName}:{port}/dcma/rest/importBatchClass

Inputs to the web service

  • An XML fle for configurations
  • A zip file of batch class

 

 

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.
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.
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
importWithLearnFiles Either “true”/”false” This value is used to define if learned files needs to be imported or not

 

Checklist:-

  1. If UseExisting is “true”, existing batch class will be overwriting with the Folders and Script as well as others parameter.
  2. If UseExisting is “false”, new batch class will created and Folders and Scripts will be used as false.
  • If UseSource is “true”, new batch class will have same Name, Description and Priority as source batch class.

 

SampleInputXML:

<ImportBatchClassOptions>

<RolesImported>false</RolesImported>

<EmailAccounts>true</EmailAccounts>

<UseSource>false</UseSource>

<Name>BC9</Name>

<Description>Description </Description>

<Priority>10</Priority>

<UseExisting>false</UseExisting>

<UncFolder>F:\Ephesoft\SharedFolders\bc9unc</UncFolder>

<UseKey>false</UseKey>

<BatchClassKey>key</BatchClassKey>

<EncryptionAlgorithm>NONE</EncryptionAlgorithm>

<importWithLearnFiles>true</importWithLearnFiles> 

<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\\sample.xml");
		// Input zip file for importing batch class.
		File file2 = new File("C:\\sample\\BC4_021315_118.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();
			}
		}
	}

Windows 4.x Release

$
0
0

 

Server Environments
Operating System Windows 7 SP1
Windows Server 2008 32 bit
Windows Server 2008 64 bit
Windows Server 2008 R2
Windows Server 2012
Windows Server 2012 R2
Windows Server 2016 (4.1.2.0 or higher)
Databases Microsoft SQL Server 2008 – All Versions
Microsoft SQL Server 2012 (X64) – All Versions
Microsoft SQL Server 2014
Microsoft SQL Server 2016 (4.1.2.0 or higher)
Microsoft SQL Azure – 12.0.2000.8 (Release 4.0.6.0 Onwards) – Fuzzydb and Export DB Only
MariaDB – 10.0.19
MySql – 5.5
Oracle -11.2.0.4 (Release 4.1 Onwards)
Oracle -12.1.0.2.0 (Release 4.1 Onwards)
Application Server Tomcat 7.0.73
Web Server Apache 2.2 (httpd)
Authentication LDAP 2.2
LDAP 2.4
Active Directory
Java Platforms Java 7 & Java 8 from Release 4.1 Onwards
Client Environments
Browser Support IE Version 10 and above
Chrome Version  43.0.2357.124 m
Firefox Version 38.0.1 and above
Scanners Fujitsu Scanners
– Fujitsu fi-6130
– Fujitsu fi-6140z
– Fujitsu fi-7160
Drivers
– Twain driver
– PaperStream driver
Web Scanner Support 32-bit Browser
32-bit Java Plugin
Screen Resolution 1366*768 and above

 

 

commonAPIForExtraction

$
0
0

This API can be utilised to perform extraction from the list of extraction plugins depicted below. Rest of the information for the individual API can be found above.

Request Method POST

 

Input for Extraction Type:

Pass the name of extraction API that is to be used in the client header as shown in following code snippet.

The header extractionAPI can have any of the values from the list given below

  • BARCODE_EXTARCTION
  • RECOSTAR_EXTARCTION
  • REGULAR_REGEX_EXTRACTION
  • KV_EXTRACTION
  • FUZZY_DB

Other inputs to the web service are used as per the extraction performed.

 

Web Service URL: http://{serverName}:{port}/dcma/rest/extractFields

Here’s the sample client code using Regular Regex Extraction:

private static void extractFields() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/extractFields";
		PostMethod mPost = new PostMethod(url);
		File file1 = new File("C:\\sample\\sample.xml");
		// adding xml file for taking input
		File file2 = new File("C:\\sample\\US-Invoice_HOCR.xml");
		try {
			/*
			 * Pass the name of extraction API that is to used: BARCODE_EXTARCTION RECOSTAR_EXTARCTION REGULAR_REGEX_EXTRACTION
			 * KV_EXTRACTION FUZZY_DB
			 */
			Header header = new Header("extractionAPI", "REGULAR_REGEX_EXTRACTION");
			Part[] parts = new Part[3];
			parts[0] = new FilePart(file1.getName(), file1);
			parts[1] = new FilePart(file2.getName(), file2);
			parts[2] = new StringPart("hocrFileName", file2.getName());
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.addRequestHeader(header);
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("Web service executed successfully.");
				System.out.println(mPost.getResponseBodyAsString());
			} else if (statusCode == 403) {
				System.out.println("Invalid username/password.");
			} else {
				System.out.println(mPost.getResponseBodyAsString());
			}
		} catch (HttpException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (mPost != null) {
				mPost.releaseConnection();
			}
		}
	}
Viewing all 478 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>