Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.net.SocketTimeoutException when upload image #1

Open
kofinder opened this issue Nov 4, 2019 · 1 comment
Open

java.net.SocketTimeoutException when upload image #1

kofinder opened this issue Nov 4, 2019 · 1 comment

Comments

@kofinder
Copy link

kofinder commented Nov 4, 2019

I cannot upload image file and then I use Free Tier plan but i can upload less than 1MB image file.
image size -> 1.9MB
image type -> jpg

public String cloudOcrService(File file) throws IOException {
		final ApiClient client = new ApiClient();
		final ImageOcrApi apiInstance = new ImageOcrApi();
		final ApiClient defaultClient = Configuration.getDefaultApiClient();
		final StringBuilder sb = new StringBuilder();
		
        client.addDefaultHeader(OCRConstant.CLOUD_MERSIVE_API_KEY, OCRConstant.CLOUD_MERSIVE_API_SERECT);
        ApiKeyAuth apikey = (ApiKeyAuth) defaultClient.getAuthentication(OCRConstant.CLOUD_MERSIVE_API_KEY);
        apikey.setApiKey(OCRConstant.CLOUD_MERSIVE_API_SERECT);
        
        try {
			ImageToTextResponse result = apiInstance.imageOcrPost(file, OCRConstant.CLOUD_MERSIVE_LANGUAGE, OCRConstant.CLOUD_MERSIVE_PROCESS);
			sb.append(result.getTextResult().replaceAll("\n", ""));
		} catch (ApiException e) {
			System.err.println("Exception when calling OCR Service ====>:"+ e.getMessage());
			e.printStackTrace();
		}
        
        return sb.toString();
	}

I getting those error when upload image.
pls help me thanks

com.cloudmersive.client.invoker.ApiException: java.net.SocketTimeoutException: timeout
at com.cloudmersive.client.invoker.ApiClient.execute(ApiClient.java:845)
at com.cloudmersive.client.ImageOcrApi.imageOcrPostWithHttpInfo(ImageOcrApi.java:1267)
at com.cloudmersive.client.ImageOcrApi.imageOcrPost(ImageOcrApi.java:1251)

@Michi-2142
Copy link

Any news on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants