PL SQL send pdf file via rest api
Thursday, July 13, 2023 at 04:24pmPL SQL send pdf file via rest api
Getting below error while trying to send pdf file via rest api using Oracle utl_http
Response> Status Code: 500
Response> Reason Phrase: Internal Server Error
Response> HTTP Version: HTTP/1.1
Reply to: PL SQL send pdf file via rest api
Thursday, July 13, 2023 at 04:26pmPFA for the code snippet
Reply to: PL SQL send pdf file via rest api
Thursday, July 13, 2023 at 05:46pmHi ratna.p.kandi,
Thanks for the information, your request raw body looks fine to me. At the same time, I doubt that the 500 error comes directly from OSS server. In your code, are you also setting the API URL as "https://dxxxv/api/packages/" instead of "sandbox.esignlive.com" and is it a reverse proxy set up internally? Are you able to directly connect to sandbox.esignlive.com to make sure the response coming from OSS server?
Duo
Reply to: PL SQL send pdf file via rest api
Friday, July 14, 2023 at 07:54amThank you Duo for the response. Yes, I am setting the URL as "https://dxxxv/api/packages/", this is an Dsign Development/SIT instance for our Organization. I am invoking this API call from Our Dev Oracle Server using PL/SQL UTL_HTTP. Please, can you share the IP Address for "sandbox.esignlive.com" servers hosting the API calls.
For your reference, I am attaching the pdf document and I am having no issues uploading it from UI. Also, the code snippet.
Thanks,
Ratna.
Reply to: PL SQL send pdf file via rest api
Friday, July 14, 2023 at 08:30amHi Ratna,
What's the URL of your UI portal? Or can I have an example package ID to locate your account?
Duo
Reply to: PL SQL send pdf file via rest api
Friday, July 14, 2023 at 08:59amHi Duo,
The package on Sandbox. Package ID : fBfQWq45eC2EYYgbNqRKdwzZmmU=
Internal Dsign for our organization
URL for API Calls : https://dxxxv
URL for UI : https://txxxv/ISA/login
Package ID on Internal Dsign : zGE3p5rXjHJ33kYROmrjBTlBGJU=
Thanks,
Ratna.
Reply to: PL SQL send pdf file via rest api
Friday, July 14, 2023 at 12:23pmHi Ratna,
Thanks for the background information! Yes, our support agent confirms that your organization has an on-premise instance.
Could you either test the connection against your on-premise environment with a GET or simple POST call first, or try the code base with sandbox environment (you can find the IP address of all OSS instances in this guide)?
PS: Just FYI that I also have a blog series about PL/SQL integration:
https://www.onespan.com/blog/onespan-sign-developer-integrate-oracle-plsql-part-1
https://www.onespan.com/blog/onespan-sign-developer-integrate-oracle-plsql-part-2
https://www.onespan.com/blog/onespan-sign-developer-integrate-oracle-plsql-part-3
https://www.onespan.com/blog/onespan-sign-developer-integrate-oracle-plsql-part-4
Duo
Reply to: PL SQL send pdf file via rest api
Sunday, July 16, 2023 at 05:07pmHi Duo,
Could you either test the connection against your on-premise environment with a GET or simple POST call first,
Yes, we are able to establish a connection from Oracle Server to On-prem Dsign SIT environment. In fact, we had created multiple packages using POST, and also qurey those packages using GET method. Unfortunately, we are facing issues with attach document API with 500 (Internal Server error).
or try the code base with sandbox environment (you can find the IP address of all OSS instances in this guide)?
I doubt if we can connect to sandbox (i.e external network) from our Internal Oracle Servers. Not sure, if our security team would allow or this request. Hope you understand this limitation on our end.
Thank you for the documentation provided for PL/SQL integration, I will go through it and check if I am missing anything.
Thanks,
Ratna.
Reply to: PL SQL send pdf file via rest api
Monday, July 17, 2023 at 11:53amHi Duo,
Thank you for the documentation on PL/SQL integration. I have gone through provided integration documents & examples. Everything is coved in our code, please let us know still why we are getting the 500 (Internal Server Error) ?
Thanks,
Ratna.
Reply to: PL SQL send pdf file via rest api
Monday, July 17, 2023 at 02:01pmHi Ratna,
I think I might find the issue - I noticed that in your raw request, there are two new lines after the PDF binary, see attachment. Could you make it one new line and see if it makes any difference?
PS: I attached the code works at my end where I removed the extra newline.
Duo
Reply to: PL SQL send pdf file via rest api
Monday, July 17, 2023 at 02:02pm+attachments.
Reply to: PL SQL send pdf file via rest api
Monday, July 17, 2023 at 03:23pmHi Duo,
I have tried the same PL/SQL code that you have provided. Still no luck. Getting below error,
{"code":500,"message":"Unexpected error. We apologize for any inconvenience this may have caused you, please try again. If the problem persists, please contact our support team.","messageKey":"error.internal.default","name":"Unhandled Server Error"}
For your reference I have attached the zip file with the code, output and also the sample pdf file used. Also, please can you send me the pdf file that you have used, want to try with that one too. Likewise can you try with the PDF that I have provided ?
PS.. I am having no issues uploading the same PFD from UI.
Thanks,
Ratna.
Reply to: PL SQL send pdf file via rest api
Monday, July 17, 2023 at 03:42pmHi Ratna,
Two things-
#1 Not sure why, but when i upload your PDF directly to US2 sandbox (it's deployed with the latest OSS SaaS environment), it says your PDF was locked. It works when I resaved your PDF in Adobe Acrobat as attached.
#2 I uncommented the line 55 and 80
Duo
Reply to: PL SQL send pdf file via rest api
Tuesday, July 18, 2023 at 10:33amHi Duo,
Thank you for providing the details. This new PDF worked and I was able to upload the PDF to a packages using API. Thanks a lot for finding the issue.
The PDF that I have provided was generated from our Oracle Servers. Was there any issue in how those PDF's got generated? Please, let us know what should be the workaround.
Thanks,
Ratna.
Reply to: PL SQL send pdf file via rest api
Tuesday, July 18, 2023 at 10:46amHi Ratna,
I am not an expert in PDF, but when I tried to analyze the original PDF with the preflight tool in Acrobat DC, it said the document structure is corrupt, see attachment. Try to regenerate another PDF from your Oracle server, or you can consult with your team which works with the document generation.
Duo
Reply to: PL SQL send pdf file via rest api
Thursday, July 20, 2023 at 11:28amThank You Duo. Now, all our issues have been fixed.