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 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:



<Document_Type>US Invoice</Document_Type>



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\\");
		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());
			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 {
		} catch (FileNotFoundException e) {
			System.err.println("File not found for processing.");
		} catch (HttpException e) {
		} catch (IOException e) {
		} finally {
			if (mPost != null) {

Was this article helpful to you?


Comments are closed.