diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 14473a9..3b56c1a 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -6,7 +6,8 @@ "Bash(sed -n '420,438p' \"C:\\\\src\\\\Galabau\\\\glb-spielwiese\\\\database\\\\packages\\\\pck_net_storage.pkb\")", "Bash(sed -n '465,478p' \"C:\\\\src\\\\Galabau\\\\glb-spielwiese\\\\database\\\\packages\\\\pck_net_storage.pkb\")", "Bash(sed -n '523,535p' \"C:\\\\src\\\\Galabau\\\\glb-spielwiese\\\\database\\\\packages\\\\pck_net_storage.pkb\")", - "Bash(sed -n '582,600p' \"C:\\\\src\\\\Galabau\\\\glb-spielwiese\\\\database\\\\packages\\\\pck_net_storage.pkb\")" + "Bash(sed -n '582,600p' \"C:\\\\src\\\\Galabau\\\\glb-spielwiese\\\\database\\\\packages\\\\pck_net_storage.pkb\")", + "WebFetch(domain:docs.public.oneportal.content.oci.oraclecloud.com)" ] } } diff --git a/database/packages/pck_net_storage.pkb b/database/packages/pck_net_storage.pkb index 7ce8f7d..686f7a7 100644 --- a/database/packages/pck_net_storage.pkb +++ b/database/packages/pck_net_storage.pkb @@ -113,6 +113,7 @@ create or replace package body pck_net_storage as ------------------------------------------------------------------------------------------------------ -- MA Datum Änderung -- SCK 2026-04-08 Funktion erstellt + -- SCK 2026-04-16 empty_blob()/empty_clob() als Default entfernt — APEX OCI-Signing braucht null für nicht genutzte Body-Parameter ------------------------------------------------------------------------------------------------Kopf*/ is l_response clob; @@ -128,14 +129,17 @@ create or replace package body pck_net_storage as l_header_index := l_header_index + 1; end if; + /* -- Content-Length immer mitsenden (OCI-Signing erfordert es bei PUT/POST, -- 0 bei bodylosem Request ist valide) - if i_body_blob is not null and dbms_lob.getlength(i_body_blob) > 0 + if i_body_clob is not null then - l_content_length := dbms_lob.getlength(i_body_blob); - elsif i_body_clob is not null and dbms_lob.getlength(i_body_clob) > 0 + l_content_length := coalesce(dbms_lob.getlength(i_body_clob), 0); + apex_debug.info('clob content length: ' || l_content_length); + elsif i_body_blob is not null then - l_content_length := dbms_lob.getlength(i_body_clob); + l_content_length := coalesce(dbms_lob.getlength(i_body_blob), 0); + apex_debug.info('blob content length: ' || l_content_length); else l_content_length := 0; end if; @@ -143,17 +147,40 @@ create or replace package body pck_net_storage as apex_web_service.g_request_headers(l_header_index).name := 'Content-Length'; apex_web_service.g_request_headers(l_header_index).value := l_content_length; l_header_index := l_header_index + 1; + */ + + -- nur für BLOB (z.B. leerer Ordner) Content-Length setzen + if i_body_blob is not null + then + l_content_length := coalesce(dbms_lob.getlength(i_body_blob), 0); + apex_web_service.g_request_headers(l_header_index).name := 'Content-Length'; + apex_web_service.g_request_headers(l_header_index).value := l_content_length; + l_header_index := l_header_index + 1; + end if; apex_debug.info('url: ' || i_url); - l_response := apex_web_service.make_rest_request( - p_url => i_url - ,p_http_method => i_method - ,p_body => coalesce(i_body_clob, empty_clob()) - ,p_body_blob => coalesce(i_body_blob, empty_blob()) - ,p_credential_static_id => pck_system.f_get_par_wert_by_programmid('NETSTORE_CRED_ID') - ,p_wallet_path => pck_system.f_get_par_wert_by_programmid('NETSTORE_WALLET_PATH') - ); + if i_body_clob is not null + then + apex_debug.info('Clob Request Body used:'); + apex_debug.info(i_body_clob); + l_response := apex_web_service.make_rest_request( + p_url => i_url + ,p_http_method => i_method + ,p_body => i_body_clob + ,p_credential_static_id => pck_system.f_get_par_wert_by_programmid('NETSTORE_CRED_ID') + ,p_wallet_path => pck_system.f_get_par_wert_by_programmid('NETSTORE_WALLET_PATH') + ); + else + apex_debug.info('BLOB Request Body used! Length: ' || dbms_lob.getlength(i_body_blob)); + l_response := apex_web_service.make_rest_request( + p_url => i_url + ,p_http_method => i_method + ,p_body_blob => i_body_blob + ,p_credential_static_id => pck_system.f_get_par_wert_by_programmid('NETSTORE_CRED_ID') + ,p_wallet_path => pck_system.f_get_par_wert_by_programmid('NETSTORE_WALLET_PATH') + ); + end if; l_status := apex_web_service.g_status_code; @@ -734,13 +761,15 @@ create or replace package body pck_net_storage as into l_body from dual; - -- TEST - --l_response := f_make_request( - -- i_method => 'POST' - -- ,i_url => f_build_url(i_action => 'renameObject') - -- ,i_body_clob => l_body - -- ,i_content_type => 'application/json' - --); + apex_debug.info('Request Body:'); + apex_debug.info(l_body); + + l_response := f_make_request( + i_method => 'POST' + ,i_url => f_build_url(i_action => 'renameObject') + ,i_body_clob => l_body + ,i_content_type => 'application/json' + ); l_obj_path := f_split_object_key(i_object_key); pck_log.p_info( diff --git a/database/tests/obj_store_list_objects.sql b/database/tests/obj_store_list_objects.sql index 1872684..3ba147a 100644 --- a/database/tests/obj_store_list_objects.sql +++ b/database/tests/obj_store_list_objects.sql @@ -18,11 +18,11 @@ end; declare begin - for rec in (select object_name, object_size, last_modified, is_folder + for rec in (select object_key, object_size, last_modified, is_folder from pck_net_storage.f_list_objects (i_parent_folder => 'testmandant-42/BA/Eingang/Verarbeitet 2026/', i_include_subfolders => 'N')) --i_parent_folder => 'testmandant-42/BA/Eingang/Verarbeitet 2026/' loop --dbms_output.put_line('Obj: ' || rec.object_name || ', object_size: ' || rec.object_size || ', last_modified: ' || rec.last_modified|| ', is_folder: ' || rec.is_folder); - dbms_output.put_line('is_folder: ' || rec.is_folder || ', name: ' || rec.object_name || ', object_size: ' || rec.object_size || ', last_modified: ' || to_char(rec.last_modified, 'DD.MM.YYYY HH24:MI:SS')); + dbms_output.put_line('is_folder: ' || rec.is_folder || ', name: ' || rec.object_key || ', object_size: ' || rec.object_size || ', last_modified: ' || to_char(rec.last_modified, 'DD.MM.YYYY HH24:MI:SS')); end loop; end; / \ No newline at end of file