Search code examples
sharepointplsqloracle-apexapexoracle-wallet

ORA-28759: failure to open file with apex_web_service.make_rest_request


I have a successful POST request with Postman to upload a file calling this url :

https://test.sharepoint.com/sites/BM/_api/web/GetFolderByServerRelativeurl('/sites/BM/BM_UPLOADS/')/Files/add(url='test_file.pdf',overwrite=true)

when I tried to apply that in Oracle APEX procedure :

l_resp := apex_web_service.make_rest_request(p_url         => 'https://test.sharepoint.com/sites/BM/_api/web/GetFolderByServerRelativeurl("/sites/BM/BM_UPLOADS/")/Files/add(url="test_file.pdf",overwrite=true)';
                                               p_file blob;',  `
                                               p_http_method => 'POST',
                                               p_body_blob   => p_file,
                                               p_wallet_path => 
                                                 'file:/home/r_erp/wallet',
                                               p_wallet_pwd  => 'test@2022'
                                               );

when run the procedure I have the error : ORA-28759: failure to open file

I relaized that I do HTTPS request which require creating an oracle wallet and add the required certificate inside it. so I followed the instructions here

but with no luck same error : ORA-28759: failure to open file

I'm not sure if I added the correct certificate for SharePoint to Oracle wallet! When I accessed my SharePoint site , I had those 3 certificates : enter image description here

I downloaded the leaf one : *.sharepoint.com and added it to the wallet by orapki utility this one added successfully .

I downloaded the second one : DigiCert Cloud Services CA-1 but when I tried to add this one I had the error : Unable to read certificate .

I do also run this procedure ACL grant :

begin


dbms_network_acl_admin.create_acl (
acl         => 'utl_https.xml',
description => 'HTTP Access',
principal   => 'BM',
is_grant    => TRUE,
privilege   => 'connect',
start_date  => null,
end_date    => null );


dbms_network_acl_admin.add_privilege (
acl        => 'utl_https.xml',
principal  => 'BD',
is_grant   => TRUE,
privilege  => 'resolve',
start_date => null,
end_date   => null
 );

  dbms_network_acl_admin.assign_acl (
acl        => 'utl_https.xml',
host       => '*.sharepoint.com',
lower_port => 443,
upper_port => 443 ); commit; end;

I'm using oracle APEX on a hosting cloud service with Apache web application on Linux OS. I do also give 777 permissions to the oracle wallet path and all files inside it. Same error : ORA-29273: HTTP request failed ORA-28759: failure to open file

My question : is there anything missing I should do ? How to download the correct certificate for https requests to a platform like SharePoint ?


Solution

  • The ORA-28759: failure to open file message indicates that the database was not able to open the wallet file, at the location you specified in the p_wallet_path parameter.

    • when specifying the location, make sure to use a complete URI, i.e. file:///path/to_file (with file:// being the protocol, followed by the path specification.
    • make sure that the path is correct, and points to a directory containing the ewallet.p12 and (optionally) the cwallet.sso files.
    • make sure that the operating system privileges allow the database to access the directory, and to open the file. The OS user which executes the Oracle database processes must be able to access the files.