Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

How to catch WUT-118 while using webutil_file_transfer.AS_to_Client_with_progress

Hassan R. KhanMar 20 2024

Greetings,

My goal is to transfer a file from the application server to the client. I've achieved successful file copying.

However, I'm encountering difficulty in handling the error message: "WUT-118 application server file <file name> does not exist or is of zero length."

Server Path: c:\invoices-pdf - This entry is already added in webutil.cfg under read and write

transfer.appsrv.read.3=C:\INVOICES-PDF
transfer.appsrv.write.3=C:\INVOICES-PDF

Client Path: c:\invoices

I am using Oracle Forms [64 Bit] Version 12.2.1.3.0 on windows.

I have attached webutil.pll successfully, olb also attached.

Forms has all webutil related objects i.e.

Alert: webutil_error
window: webutil_hidden_window
canvas: webutil_canvas
Data Block: webutil

Following is my code.

PROCEDURE DOWNLOAD_PDF_FROM_AS IS
 l_success       boolean;
 l_result        number;
 l_client_dir                            VARCHAR2(200);
 l_client_pdf_file_name        VARCHAR2(200);
 l_server_pdf_file_name        VARCHAR2(200);
 l_err_msg                                    VARCHAR2(4000);
BEGIN
 l_server_pdf_file_name := get_pdf_path(p_final_no => :invoices.invoice_no,
                                           p_err_msg => l_err_msg);
 IF l_server_pdf_file_name = 'ERROR' THEN 
     call_alert(3,'Error: '||l_err_msg);
     RAISE form_trigger_failure;
 END IF;
    l_client_dir                            := 'C:\INVOICES\';
    l_client_pdf_file_name        := l_client_dir||:invoices.invoice_no||'.pdf';
 clear_message;
    --IF NOT webutil_file.file_exists( l_server_pdf_file_name) THEN
    /*IF NOT WEBUTIL_FILE_TRANSFER.IS_AS_READABLE (l_server_pdf_file_name) THEN
        call_alert(3,'File '||l_server_pdf_file_name||' does not exist');
        RAISE form_trigger_failure;
    END IF;*/
    
      l_success := webutil_file_transfer.AS_to_Client_with_progress
                                        (clientFile       => l_client_pdf_file_name
                                        ,serverFile       => l_server_pdf_file_name
                                        ,progressTitle    => 'Download file from Server in progress'
                                        ,progressSubTitle => 'Please wait'
                                        );
                                   
                                    
 IF l_success  THEN
   call_alert(1,'File: '||l_client_pdf_file_name||' downloaded successfully from the Server');
 /*ELSE
    call_alert(3,'File download from Server failed: ');
    RAISE form_trigger_failure;*/
 END IF;
 
 EXCEPTION
     WHEN OTHERS THEN
     IF sqlerrm LIKE '%100501%' THEN 
         NULL;
     ELSE
       call_alert(3,'File download failed: '||sqlerrm);
     END IF;
END;

I aim to capture any webutil error, including WUT-118, when l_success is set to FALSE.

OR is there any way to check if the file exists on server or not?

Despite searching the forum, I couldn't find any helpful information.

Thank you,

Hassan

Comments
Post Details
Added on Mar 20 2024
3 comments
65 views