Skip to Main Content

Oracle Database Discussions

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!

Listing and/or downloading files with PL/SQL using WebDAV

KKloeserApr 11 2022

Hi,
I am trying to connect to a Servers WebDAV Folder and read the directory listing and download a particular file.
ACLs and Certificates have been installed, an earlier Certificate valdiation error doesn't appear any more, so that seems to be fine
However I can't get through to the server.
First of all the script:
DECLARE
http_request UTL_HTTP.REQ;
http_response UTL_HTTP.RESP;
msg VARCHAR2(32767) := '<UserNameHere>v:<PassswordOfThatUserHere';
url VARCHAR2(1000) := 'http://<FQDNofServer>/<FolderName> -X PROPFIND';
token VARCHAR2(1000);
BEGIN
http_request := UTL_HTTP.BEGIN_REQUEST(url, 'GET', UTL_HTTP.HTTP_VERSION_1_1);

UTL_HTTP.SET_HEADER(http_request, 'Content-Type', 'text/xml; charset="utf-8"');
UTL_HTTP.SET_HEADER(http_request, 'Content-Length', LENGTH(msg));
UTL_HTTP.WRITE_TEXT(http_request, msg);

http_response := UTL_HTTP.GET_RESPONSE(http_request);
UTL_HTTP.READ_TEXT(http_response, token, 1000);

DBMS_OUTPUT.PUT_LINE ( 'token = ' || token );

END;
If I use this Skript I get a DBMS_OUTPUT message:
-----
token = <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>
----
If I try the same with https:
url VARCHAR2(1000) := 'https://<FQDNofServer>/<FolderName> -X PROPFIND';
I get an ORA error:
ORA-06512: in "SYS.UTL_HTTP", Zeile 1148
ORA-06512: in Zeile 8
29273. 00000 - "HTTP request failed"
*Cause: The UTL_HTTP package failed to execute the HTTP request.
*Action: Use get_detailed_sqlerrm to check the detailed error message.
Fix the error and retry the HTTP request.
ORA-28759: Fehler beim Öffnen von Datei (Translated: Error opening the file)

Can anyone tell me, how I can list and retrieve files from a WebDaV accesible directory with https ?

I searched around but didn't find anything...
Thanks in advance !
Kinde regards
Klaus Klöser

This post has been answered by KKloeser on Apr 20 2022
Jump to Answer
Comments
Post Details
Added on Apr 11 2022
1 comment
710 views