This API helps to decrypt the HOCR file present in batch instance folder created during batch processing on the input image. When a batch is run for an encrypted batch class, the HOCR files created for the image files are also encrypted, to decrypt the same decryptBatchInstanceHocrXML web service can be utilized.

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

Request Method: POST

Input Parameters

Input Parameter Value Description
hocrFileName An HOCR.xml file name to be decrypted File name must be a valid hocr file
batchInstanceIdentifier Batch instance identifier ( BI1) A valid batch instance identifier

Sample client code using apache commons http client:-

private static void decryptBatchInstanceHocrXml() {
		HttpClient client = new HttpClient();
		String url = "http://localhost:8080/dcma/rest/decryptBatchInstanceHocrXml";
		PostMethod mPost = new PostMethod(url);
		mPost.setDoAuthentication(true);
		Part[] parts = new Part[2];
		try {
			parts[0] = new StringPart("hocrFileName", "BI3_0_HOCR.xml");
			parts[1] = new StringPart("batchInstanceIdentifier", "BI3");
			MultipartRequestEntity entity = new MultipartRequestEntity(parts, mPost.getParams());
			mPost.setRequestEntity(entity);
			int statusCode = client.executeMethod(mPost);
			if (statusCode == 200) {
				System.out.println("HOCR  XML decrypted successfully");
				System.out.println(mPost.getResponseBodyAsString());
			} 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?

Engineering