The API helps to decrypt the HOCR file present in the test folders within the batch class. Test folders that can be used with the API can be:-
- test-advanced-extraction
- test-classification
- test-extraction
- test-table
Web Service URL: http://{serverName}:{port}/dcma/rest/decryptTestHocrXml
Request Method: POST
Input Parameters
Input Parameter | Value | Description |
hocrFileName | A valid HOCR.xml file name to be decrypted | File name must be a valid hocr file |
batchClassIdentifier | Batch class identifier ( BC1) | A valid batch class identifier |
testType |
|
Test type is to be entered for the decryption of HOCR from any of the folders |
documentType | Document type present in the batch class | A valid document type present in the batch class is expected |
Sample client code using apache commons http client:-
private static void decryptTestHocrXml() { HttpClient client = new HttpClient(); String url = "http://localhost:8080/dcma/rest/decryptTestHocrXml"; PostMethod mPost = new PostMethod(url); mPost.setDoAuthentication(true); Part[] parts = new Part[4]; try { parts[0] = new StringPart("hocrFileName", "US-Invoice-0000_HOCR.xml"); parts[1] = new StringPart("batchClassIdentifier", "BC5"); parts[2] = new StringPart("testType", "table"); parts[3] = new StringPart("documentType", "US Invoice"); 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"); String responseBody = mPost.getResponseBodyAsString(); 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.out.println("File not found for processing."); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (mPost != null) { mPost.releaseConnection(); } } }