Web service API to query the current running status of the web service. This web service is only useful with initiateOcrClassifyExtract web service. Using this web service the user can figure out the completed state of the ocrClassifyExtract web service request. On running the initiateOcrClassifyExtract web service, a numeric token is returned. The checkWSStatus web service uses this token to determine the current operational state. The various states a web service can be into are
Input Parameters
Input parameters to the Web Service API would be a valid numeric token. ocrToken
Output Parameters
The outputs to the web service varies as follows.
When the initiateOcrClassifyExtract web service is performing split, OCR or classification results would be SPLIT_COMPLETED, OCRing_COMPLETED and CLASSIFICATION_COMPLETED respectively. When the web service completes the extraction, the result is a valid xml file with extracted fields and values.
Service Request : GET
Web Service URL

Sample client code using apache commons http client:-

private static void checkWSStatus () { HttpClient client = new HttpClient(); String url = ” http://localhost:8080/dcma/rest/checkWSStatus?ocrToken=1233232323 “; 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(); } } }

Was this article helpful to you?


Comments are closed.