Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IF apex_web_service.g_status_code != 200 THEN
- RAISE upload_failed_exception;
- END IF;
- /** Invoke Document Understanding API*/
- l_json_str := document_pkg.get_processorjobs_json(
- p_compartment_id => :DOCAI_COMPARTMENT_ID,
- p_bucket_name => :BUCKET_NAME,
- p_namespace => :TENANCY_OBJSTR_NAMESPACE,
- p_object_name => l_object_name
- );
- --log
- document_pkg.ws_log(l_json_str);
- -- Set the Request HTTP Headers.
- apex_web_service.set_request_headers (
- p_name_01 => 'Content-Type',
- p_value_01 => 'application/json',
- p_reset => TRUE)
- ;
- l_response := apex_web_service.make_rest_request(
- p_url => :DOCAI_API_ENDPOINT || '/processorJobs'
- , p_http_method => 'POST'
- , p_body => l_json_str
- , p_credential_static_id => :G_OCI_WEB_CREDENTIAL
- );
- --log
- document_pkg.ws_log(l_response);
- document_pkg.ws_log(''||apex_web_service.g_status_code);
- IF apex_web_service.g_status_code NOT IN (200, 201) THEN
- RAISE upload_failed_exception;
- END IF;
- document_pkg.parse_processorjobs_json (
- p_json_str => l_response,
- x_compartment_id => l_compartment_id,
- x_id => l_job_id,
- x_percentcomplete => l_percentcomplete,
- x_lifecyclestate => l_lifecyclestate,
- x_namespacename => l_namespacename,
- x_bucketname => l_bucketname,
- x_prefix => l_prefix
- );
- UPDATE document
- SET job_id = l_job_id
- , compartment_id = l_compartment_id
- , percentcomplete = l_percentcomplete
- , lifecyclestate = l_lifecyclestate
- WHERE document_id = l_document_id;
- document_pkg.ws_log('l_compartment_id:'||l_compartment_id);
- document_pkg.ws_log('l_job_id:'||l_job_id);
- document_pkg.ws_log('l_percentcomplete:'||l_percentcomplete);
- IF l_percentcomplete = 100 THEN
- document_pkg.get_object(P_DOCUMENT_ID => l_document_id);
- END IF;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement