Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to show SVG image returned from rest service?

Ayman ShahrourJun 4 2022

Hi,
I have oracle apex 22.1 and oracle DB 19c installed on Linux machine, and I am new to oracle apex and I have the following process defined on page #4 as follow:
declare
l_wf_host constant varchar2(1000) := 'http://IP:8080/kie-server/services/rest';
l_containerId varchar2(100) := 'HR-Project_2.0.0-SNAPSHOT';
l_wf_show_prc_url varchar2(1000) := l_wf_host||'/server/containers/'||l_containerId||'/images/processes/instances/'||:P4_INSTANCE_ID;
l_user varchar2(100) := 'user';
l_pw varchar2(100) := 'pw';
l_timeout number(4) := 10;
l_RESPONSE_CODE varchar2(100);
l_clob clob;
begin
apex_web_service.g_request_headers(1).name := 'Accept';
apex_web_service.g_request_headers(1).value := 'application/svg+xml';
l_clob := apex_web_service.make_rest_request( p_url => l_wf_show_prc_url, p_http_method => 'GET',p_username => l_user, p_password => l_pw, p_transfer_timeout => l_timeout);
l_RESPONSE_CODE := apex_web_service.g_status_code;
:P4_RESPONSE_CODE := l_RESPONSE_CODE;
if l_RESPONSE_CODE = '200' then
:P4_NOTIFICATION := 'Success, Process Diagram for Ticket Number = '||:P4_INSTANCE_ID;
end if;
exception when others then
:P4_NOTIFICATION := sqlcode||' - '||sqlerrm;
end;

the above rest service returned the SVG xml content as follow:
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="text/ecmascript" zoomAndPan="magnify" contentStyleType="text/css" viewBox="0 0 1156 686" preserveAspectRatio="xMidYMid meet" version="1.1">
<defs/>
<g transform="matrix(1,0,0,1,0,0)">
<g>
<g>
<g>
<path fill="none" stroke-dasharray="5" paint-order="fill stroke markers" d=" M 0 0 L 1200 0" stroke="#d3d3d3" stroke-opacity="0.8" stroke-miterlimit="10"/>
</g>
.
.
.
.
</g>
</g>
</svg>
My question is how to display the SVG image on a region inside my page?

This post has been answered by Ayman Shahrour on Jun 5 2022
Jump to Answer
Comments
Post Details
Added on Jun 4 2022
5 comments
746 views