How to Call Oracle Fusion BIP report from Oracle APEX

How to Call Oracle Fusion BIP report from Oracle APEX

In this post, we will walk through the process to call Oracle Fusion BIP report from oracle APEX.

Follow below steps to call Fusion BIP report from Oracle APEX.

Step1 ===> Create Sample Fusion BIP report.

Create sample BIP report in oracle fusion which we will use to call from oracle APEX as shown below:

This report will provide AP Invoice details with Invoice Number as report parameter.

Data Model and Report are shown below:

This report is having below details:

Report Absolute Path

/Custom/APEX/FUSION_BIP/XX Test AP Invoice Report.xdo

Report Parameter Name

P_INVOICE_NUM

Report Output Format

Csv

Step2 ===> Test Fusion BIP report using SOAP WSDL.

Oracle Fusion BIP report can be called externally using ExternalReportWSSService WSDL soap service.

SOAP WSDL:

/xmlpserver/services/ExternalReportWSSService?wsdl

Let us configure this WSDL in SOAP UI and Test with sample Input parameter.

Request Payload:

  1. <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService">
  2. <soap:Header/>
  3. <soap:Body>
  4. <pub:runReport>
  5. <pub:reportRequest>
  6. <pub:attributeFormat>csv</pub:attributeFormat>
  7. <pub:attributeLocale>?</pub:attributeLocale>
  8. <pub:parameterNameValues>
  9. <!--Zero or more repetitions:-->
  10. <pub:item>
  11. <pub:name>P_INVOICE_NUM</pub:name>
  12. <pub:values>
  13. <!--Zero or more repetitions:-->
  14. <pub:item>INV-100067</pub:item>
  15. </pub:values>
  16. </pub:item>
  17. </pub:parameterNameValues>
  18. <pub:reportAbsolutePath>/Custom/APEX/FUSION_BIP/XX Test AP Invoice Report.xdo
  19. </pub:reportAbsolutePath>
  20. <pub:sizeOfDataChunkDownload>-1</pub:sizeOfDataChunkDownload>
  21. </pub:reportRequest>
  22. </pub:runReport>
  23. </soap:Body>
  24. </soap:Envelope>

Response:

  1. <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
  2. <env:Header/>
  3. <env:Body>
  4. <ns2:runReportResponse xmlns:ns2="http://xmlns.oracle.com/oxp/service/PublicReportService">
  5. <ns2:runReportReturn>
  6. <ns2:reportBytes>77u/SU5WT0lDRV9JRCxWRU5ET1JfSUQsSU5WT0lDRV9OVU0sSU5WT0lDRV9DVVJSRU5DWV9DT0RFLFBBWU1FTlRfQ1VSUkVOQ1lfQ09ERSxJTlZPSUNFX0FNT1VOVCxWRU5ET1JfU0lURV9JRCxTT1VSQ0UsSU5WT0lDRV9UWVBFX0xPT0tVUF9DT0RFLEFQUFJPVkFMX1NUQVRVUwozMDAwMDAwMDM1OTMxNzgsMzAwMDAwMDAyOTEwODYxLElOVi0xMDAwNjcsVVNELFVTRCwwLDMwMDAwMDAwMjkxNjQxOSwiTWFudWFsIEludm9pY2UgRW50cnkiLFNUQU5EQVJELCJORUVEUyBSRUFQUFJPVkFMIgo=</ns2:reportBytes>
  7. <ns2:reportContentType>text/plain;charset=UTF-8</ns2:reportContentType>
  8. <ns2:reportFileID xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
  9. <ns2:reportLocale xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
  10. <ns2:metaDataList xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
  11. </ns2:runReportReturn>
  12. </ns2:runReportResponse>
  13. </env:Body>
  14. </env:Envelope>

This provides response in base64format which we need to decode to get actual output.

Step3 ===>Create Oracle APEX Application.

Login to Oracle APEX workspace and click on Create

A screenshot of a application

AI-generated content may be incorrect.

Give meaningful name to APEX app and then click on Create Application.

A screenshot of a computer

AI-generated content may be incorrect.

The application is created successfully.

Change the application theme to Redwood light.

Navigate to shared components —>User Defined Attributes.

A screenshot of a computer

AI-generated content may be incorrect.

Change Theme Style to “Redwood Light” and click on Apply changes.

Run the application.

Provide login credentials and click on Sign in.

A close up of a screen

AI-generated content may be incorrect.

We will call fusion BIP report and display data into interactive report using DB table.

Step4 ===>Create DB Table.

Create DB table XXTEST_AP_INVOICE_DETAILS with same columns as we have in BIP report.

  1. CREATE TABLE XXTEST_AP_INVOICE_DETAILS
  2. (
  3. INVOICE_ID NUMBER,
  4. VENDOR_ID NUMBER,
  5. INVOICE_NUM VARCHAR2(50),
  6. INVOICE_CURRENCY_CODE VARCHAR2(3),
  7. PAYMENT_CURRENCY_CODE VARCHAR2(3),
  8. INVOICE_AMOUNT NUMBER,
  9. VENDOR_SITE_ID NUMBER,
  10. SOURCE VARCHAR2(30),
  11. INVOICE_TYPE_LOOKUP_CODE VARCHAR2(30),
  12. APPROVAL_STATUS VARCHAR2(30)
  13. )

Navigate to Object Browsers —->SQL Commands.

Execute table creation script.

Step4 ===>Create Data Load Definition based on Table.

Navigate to Shared Components—>Othe components—>Data Load Definitions.

A screen shot of a computer

AI-generated content may be incorrect.

Click on Create.

A screenshot of a computer

AI-generated content may be incorrect.

Click on Next.

A screenshot of a computer

AI-generated content may be incorrect.

Provide valid DD name and select Table which we have created in earlier step.

A screenshot of a computer

AI-generated content may be incorrect.

Download sample Bip report output file and upload as sample file. This will create mapping between BIP report and table columns.

Click on Next.

A screenshot of a computer

AI-generated content may be incorrect.

Click on Create Data Load.

A screenshot of a computer

AI-generated content may be incorrect.

This will create Data Load Definitions.

Please note Static ID.

Step5 ===>Create Credentials to store SOAP service credentials.

We will setup credentials to store Fusion instance credentials which are required to call SOAP service.

Navigate to Shared Components—>Credentials

A screenshot of a computer

AI-generated content may be incorrect.

A screenshot of a computer

AI-generated content may be incorrect.

Click on Create.

Provide valid name, username, password for fusion instance as shown below:

A screenshot of a computer

AI-generated content may be incorrect.

Click on Create.

A screenshot of a computer

AI-generated content may be incorrect.

This will create credentials separately. We can call this credential using static id associated with this credential.

Step6 ===>Create Page Item, Button and Interactive Report on Home Page.

Navigate to home page and create Page Item, Button and Interactive Report region based on XXTEST_AP_INVOICE_DETAILS table as shown below:

A screenshot of a computer

AI-generated content may be incorrect.

Step7 ===>Create Page Process to Call BIP report and Populate table.

Navigate to Processing tab to create new page process to call BIP report using PLSQL. SOAP API can be called from Oracle APEX using APEX_WEB_SERVICE.MAKE_REQUEST package.

The APEX_WEB_SERVICE API enables you to integrate other systems with APEX by enabling you to interact with web services using PLSQL.

This API contains procedures and functions to call both SOAP and Restful style web services. Functions parse the responses from web services and encode/decode into SOAP-friendly base64 encoding.

For our use case, we are going to use MAKE_REQUEST function which invokes SOAP style web service with supplied SOAP envelop retuning result into an CLOB.

We will pass below parameters to this function:

Parameter

Description

p_url

The URL endpoint of the Web service.

p_http_method

The HTTP method to use (PUT, POST, GET, HEAD, or DELETE).

p_body

The HTTP payload to be sent as CLOB.

p_credential_static_id

The name of the Web Credentials to be used. Web Credentials are configured in Workspace Utilities.

p_scheme

The authentication scheme, Basic (default) or AWS or Digest or OAUTH_CLIENT_CRED if supported by your database release.

Navigate to Processes —>Create New Process.

A screenshot of a computer

AI-generated content may be incorrect.

Add below PLSQL code:

A screenshot of a computer

AI-generated content may be incorrect.

PLSQL Code:

  1. DECLARE
  2. l_envelope CLOB;
  3. l_report_bytes CLOB;
  4. l_instance_url VARCHAR2(100);
  5. l_username VARCHAR2(50);
  6. l_password VARCHAR2(50);
  7. l_report_bytes2 CLOB;
  8. l_result_blob BLOB;
  9. l_result_3 apex_data_loading.t_data_load_result;
  10. BEGIN
  11. ----Payload
  12. l_envelope := '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService">
  13. <soap:Header/>
  14. <soap:Body>
  15. <pub:runReport>
  16. <pub:reportRequest>
  17. <pub:attributeFormat>csv</pub:attributeFormat>
  18. <pub:parameterNameValues>
  19. <!--Zero or more repetitions:-->
  20. <pub:item>
  21. <pub:name>P_INVOICE_NUM</pub:name>
  22. <pub:values>
  23. <!--Zero or more repetitions:-->
  24. <pub:item>'||:p1_invoice_num||'</pub:item>
  25. </pub:values>
  26. </pub:item>
  27. </pub:parameterNameValues>
  28. <pub:reportAbsolutePath>/Custom/APEX/FUSION_BIP/XX Test AP Invoice Report.xdo</pub:reportAbsolutePath>
  29. <pub:sizeOfDataChunkDownload>-1</pub:sizeOfDataChunkDownload>
  30. </pub:reportRequest>
  31. </pub:runReport>
  32. </soap:Body>
  33. </soap:Envelope>';
  34. l_instance_url := 'https://fa-exjg-dev7-saasfaprod1.fa.ocs.oraclecloud.com/';
  35. l_username := 'intuser';
  36. l_password := 'Welcome123';
  37. apex_web_service.g_request_headers.delete();
  38. apex_web_service.g_request_headers(1).name := 'Content-Type';
  39. apex_web_service.g_request_headers(1).value := 'application/soap+xml;charset=UTF-8';
  40. -- Get the XML response from the web service.
  41. l_report_bytes := apex_web_service.make_rest_request(
  42. p_url => l_instance_url || 'xmlpserver/services/ExternalReportWSSService',
  43. p_http_method => 'POST',
  44. p_body => l_envelope,
  45. p_username => l_username,
  46. p_password => l_password,
  47. p_scheme => 'Basic'
  48. );
  49. SELECT
  50. reportbytesdata.reportbytes
  51. INTO l_report_bytes2
  52. FROM
  53. XMLTABLE ( XMLNAMESPACES ( 'http://www.w3.org/2003/05/soap-envelope' AS "env", 'http://xmlns.oracle.com/oxp/service/PublicReportService'
  54. AS "ns2" ),
  55. '/env:Envelope/env:Body/ns2:runReportResponse/ns2:runReportReturn'
  56. PASSING xmltype(l_report_bytes)
  57. COLUMNS
  58. reportbytes CLOB PATH 'ns2:reportBytes'
  59. ) AS reportbytesdata;
  60. IF l_report_bytes2 <> '77u/REFUQV9EUwo=' THEN
  61. l_result_blob := apex_web_service.clobbase642blob(l_report_bytes2);
  62. l_result_3 := apex_data_loading.load_data(
  63. p_data_to_load => l_result_blob,
  64. p_static_id => 'xxtest_ap_invoice_details_dd'
  65. );
  66. END IF;
  67. END;

Step8 ===>Run the Application.

Provide Invoice Number and click on Submit.

A screenshot of a computer

AI-generated content may be incorrect.

This will display the BIP report data into interactive report region.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top