Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Apex 21.2 BUG: apex_web_service.make_request HTTPS end-of-input reached only on first call

massi_cicDec 10 2021 — edited Dec 10 2021

Hi all,
We are using the APEX 21.2 API APEX_WEB_SERVICE.make_request to call a webservice in HTTPS: but running it the first time, after 70 seconds Oracle returns an error of end-of-input reached.
After this error, calling the same procedure we get the correct response from webservice immediately, every subsequent time.
If we don't run the procedure on the machine for 40 mins more or less, the same error comes up again, even though after the procedure apex_web_service.make_request we call APEX_CUSTOM_AUTH.LOGOUT
No matter the certificate we are using, we tried both with a correct and an expired certificate. The behaviour is the same as described. 

We tried:
Using another tool like Postman to make the same POST call: we have the correct reply from webservice every time.
Calling the same webservice in Httpd with apex_web_service.make_request, it works correctly evert time.
Using another machine with Apex 20.2 installed, the procedure apex_web_service.make_request works correctly every time, even if the first time takes 50 seconds to get the response (using HTTPS).
Looks like the problem exists in apex 21.2.
Oracle side - error stack:

ORA-29273: HTTP request failed
ORA-06512: at "APEX_210200.WWV_FLOW_WEB_SERVICES", line 1663
ORA-06512: at "APEX_210200.WWV_FLOW_WEB_SERVICES", line 782
ORA-29259: end-of-input reached
ORA-06512: at "SYS.UTL_HTTP", line 380
ORA-06512: at "SYS.UTL_HTTP", line 1148
ORA-06512: at "APEX_210200.WWV_FLOW_WEB_SERVICES", line 756
ORA-06512: at "APEX_210200.WWV_FLOW_WEB_SERVICES", line 1546
ORA-06512: at "APEX_210200.WWV_FLOW_WEB_SERVICES", line 1685
ORA-06512: at "APEX_210200.WWV_FLOW_WEBSERVICES_API", line 396
ORA-06512: at "APEX_210200.WWV_FLOW_WEBSERVICES_API", line 441

Server side conditions:
Apache httpd 2.2.15 running on Linux Redhat 6.5
Behind this there is a proxy then the application frontend with Tomcat
We are using TLS 1.2, opened to all SSL versions.
Server side error trace:

...
[Mon Dec 06 15:36:58 2021] [debug] ssl_engine_kernel.c(1884): OpenSSL: Loop: SSLv3 write server done A
[Mon Dec 06 15:36:58 2021] [debug] ssl_engine_kernel.c(1884): OpenSSL: Loop: SSLv3 flush data

[Mon Dec 06 15:37:58 2021] [debug] ssl_engine_io.c(1941): OpenSSL: I/O error, 5 bytes expected to read on BIO#7f39f65f0400 [mem: 7f39f6b01063]
[Mon Dec 06 15:37:58 2021] [debug] ssl_engine_kernel.c(1913): OpenSSL: Exit: error in SSLv3 read client certificate A

Any help will be appreciated.

Comments

843859
Blob is the datatype you use as database column type to store binary data. You use PreparedStatement#setBinaryStream() to set it in a SQL query and you use ResultSet#getBinaryStream() to obtain it from the SQL result.
796254
i'd recommend storing the path to a file in the database and putting the images themselves on the file system.

%
843859
thank you for your kind answer.
So I did a mistake: 'do not exists a BinaryStream column type!!!!
....and the statement: setBlob(), setBinaryStream() both work with the only Blob colum type...
If I good unsertood, you recomended me to use the setBinaryStream() statement with a blob column, saving
before the file on the file system, and not to store it directly in the database...
Of course, in this case the program have also the duty of saving and the deleting the files on the hard disk.

Could you you show me a sinthetic code example about the sintax to use to indicate the saved file inside the setBinaryStream() statement ?


------
About the other solution: (to use resultSet.setBlob() statement).
(I saw it is used too, I think with java - byte[] type to store directly binary informations in the database).
I could do it trasforming the image in array of byte and store it directly in the database.
It should be possible to do it ?

Perhaps yes, but you didn't suggest me to do it..

-------
Excuse me if I asked you again ...but I would have a complete understanding of the problem....

thank you very much
regards
tonyMrsangelo
843859
Duffymo rather meant that the preferred approach is to write the file to the server's disk system using java.io API and to store its path in the database as a simple varchar field (use setString() and getString() to do that).
843859
thank you to answering me,

as I said, I don't have any experience working with Blob;
I got some information about this on the forum but no example is right for my purpose.
 
"I am working with a standalone application where a dentist, using a camera, can save images and see them again later or delete them too." 
I need to store Blob in the same way that is used to do with string, integer
or float type..., but as I understand to store Blobs it is not the same as store
on a database primitive type of data.
 
I should like have some general information how to do it before to write a 
complex as well as wrong code.. 
To work in this way gives very much disappointment ... :-).

thank you very much
regards

tonyMrsangelo
843859
As said before, use PreparedStatement#setBinaryStream().

If your problem is rather that you don't understand how to use PreparedStatement, then start reading its section in the JDBC tutorial here at Sun.com.
843859
thank you for answering me ,

I am able to use PreparedStatement(), but I should like to know what parameter put inside
the function :
preparedStatement.setBinaryStream(1 , xxx);

What is xxx in my case ??? ....

I understand that, perhaps, I ask a stupid thing ... but I am confuse...

I yet am thinking if I have to store the file on the hard disk passing a link
of the his path to the database..., or if I have to store really the stream inside the database.

in the docomentation I read:
By default drivers implement Blob using an SQL locator(BLOB), which means that a Blob object 
contains a logical pointer to the SQL BLOB data rather than the data itself.
Really I am not sure what this exactly can means and I see they are more than one way to store big objects..

I excuse if I am bothering you but I would not try wrong, ...doing it with database is complex for understand possible errors....

thank you
regards
843859
Just read the API docs whenever you want a clear explanation of the purpose of the class, what methods it all provides and how to use them all.

[http://java.sun.com/javase/6/docs/api/java/sql/PreparedStatement.html].
1 - 8

Post Details

Added on Dec 10 2021
5 comments
1,106 views