Skip to main content
Participant
June 20, 2023
Answered

Getting the following error when converting pdf to word ServiceApiException 'Access Forbidden

  • June 20, 2023
  • 1 reply
  • 588 views

com adobe pdfservices operation exception ServiceApiException: description ='Access Forbidden; transactionId=xxxxxxxxx'; requestTrackingId='xxxxxxxu'; statusCode=403; errorCode=FORBIDDEN

 

What is the exact error for this message? 

This topic has been closed for replies.
Correct answer Harshvardhan22633942brm2

Hi solved this problem you need to update the SDK to the latest version.

1 reply

Participant
June 23, 2023

I am facing the exact same issue. It's working in other application but that same code and adobe credentials does not work with the other application. I created free adobe account and used that one for converting docx to pdf but that account also not working.

 

To find out the exact error, I implemented the Adobe.PDFServiceSDK classes to my app. So, here is the code:

public static HttpBaseResponse<T> CPFStatusApi<T>(InternalExecutionContext context, string location, string targetFormatExtension)
        {
            HttpBaseRequest baseRequestFromRequestContext = context.GetBaseRequestFromRequestContext(RequestKey.STATUS);
            baseRequestFromRequestContext.SetUriTemplate(location);
            baseRequestFromRequestContext.SetTargetFormatExtension(targetFormatExtension);
            HttpClient instance = HttpClient.GetInstance(); 
            try
            {
                HttpBaseResponse<T> httpBaseResponse = instance.Execute<T>(baseRequestFromRequestContext);

                int millisecond = DateTime.Now.Millisecond;
                while (httpBaseResponse.ResponseCode == HttpStatusCode.Accepted)
                {
                    if ((long)(DateTime.Now.Millisecond - millisecond) > 600000L)
                    {
                        throw new ServiceApiException("Operation execution has timed out!", StringUtil.GetRequestIdFromLocation(location), 0);
                    }

                    try
                    {
                        Thread.Sleep(1000);
                    }
                    catch (ThreadInterruptedException inner)
                    {
                        throw new SDKException("Thread interrupted while waiting for operation execution status!!", inner);
                    }

                    httpBaseResponse = instance.Execute<T>(baseRequestFromRequestContext);
                }

                return httpBaseResponse;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            return null;
        }

 statusResponseContent of the instance object is:

{"cpf:inputs":{"documentIn":{"dc:format":"application/pdf","cpf:location":"file1"},"params":{"cpf:inline":{"targetFormat":"docx"}}},"cpf:engine":{"repo:assetId":"urn:aaid:cpf:Service-26c7fda2890b44ad9a82714682e35888"},"cpf:status":{"completed":true,"type":"","title":"Access Forbidden; transactionId=gVET6L2RYFLjE0uKnntIUUaG3xOFJ29J","status":403,"report":"{\"error_code\":\"FORBIDDEN\"}"}}

 and then instance.Execute also retuns the "Access Forbidden" with 403 status code.

This is frustrating and nightmare for me. Any help is highly appreciated.

Thank you.

Harshvardhan22633942brm2AuthorCorrect answer
Participant
June 24, 2023

Hi solved this problem you need to update the SDK to the latest version.