Authentication problems using Java codesample (HTTP 401 response code)

  • 8.4K Views
  • Last Post 19 March 2012
  • Topic Is Solved
Srinivasan Chokkalingam posted this 19 March 2012

Hi

I have download the sample Java client application from github. I have my applicationid and application password But still I am unable to access the cloud and convert the document!

The error message that I am getting is as follows.

Exception in thread "main" java.io.IOException: Server returned HTTP response code: 401 for URL: http://cloud.ocrsdk.com/processImage?language=English&exportFormat=pdfSearchable
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at com.abbyy.ocrsdk.Client.processImage(Client.java:19)
    at com.abbyy.ocrsdk.AbbyyClient.main(AbbyyClient.java:10)

Please advice me on this (Note : applicationid / application password is different from the cloud userid and password)

Thanks Sriniasan. C

Order By: Standard | Newest | Votes
Nikolay_Kh posted this 19 March 2012

Hi there! HTTP 401 response code stands for unauthorized request.

First, please make sure that you're using right Application ID & Application Password. You can find your AppID in your dashboard:

alt text

Keep in mind that capitalization and whitespaces matter.

Your Application Password was sent to you by e-mail when you created it. You can try to reset it (use Reset Application Password link in the dashboard).

If the above doesn't help, please send the piece of code where you perform authentication with the AppID and App password credentials that produce the error to cloudocrsdkbeta@abbyy.com Thanks!

Attached Files

  • Liked by
  • Andrey Isaev
Nikolay_Kh posted this 19 March 2012

I've converted this thread to a separate question for convinience.

Srinivasan Chokkalingam posted this 19 March 2012

@Nikolay_Kh, Thanks for the quick reply. It works for me. Can any one tell me how keep on pinging a particular task to understand whether the conversion is completed or not?

Nikolay_Kh posted this 19 March 2012

Basically, you need to loop a HTTP Get request of http(s)://cloud.ocrsdk.com/getTaskStatus?taskId=<yourtaskid> until the status attribute in xml response has a state of "Completed".

You can refer to this quickstart guide and getTaskStatus method documentation for details.

Close