Dimitri Gielis Blog

Subscribe to Dimitri Gielis Blog feed
I created this Blog to share my knowledge especially in Oracle Application Express (APEX) and my feelings ...
Updated: 1 day 16 hours ago

Increasing Maximum Web Service Requests in Oracle APEX 18.1

Mon, 09/10/2018 - 20:29
While running our final tests of APEX Office Print (AOP) 18.1 we hit "ORA-20000: Issue calling Main AOP Service (REST call: ): ORA-20001: You have exceeded the maximum number of web service requests per workspace."


When you login into the Internal Workspace and navigate to a workspace, there's a setting for  Maximum Web Service Requests. The default value is 1000 requests per 24h (rolling window).

If you know that AOP has next to hundreds of server tests, also around 500 automated tests through APEX, we hit this limit after the second full run. After setting the value to 20000, we are able to continue our final testing :)

I guess the chances are small you will hit the limit in a normal APEX app, but if you do, it's easy to fix by setting a higher value for your workspace.

Replace deprecated apex_util.string_to_table (APEX 5.1/18.1)

Wed, 08/15/2018 - 20:44
Sometimes the Oracle APEX documentation announces some packages will become deprecated in a release. It's not that those packages are suddenly gone, but you should not use them anymore. Your code will run fine still, but in the future, APEX might take it out completely, so it's best to replace them with the new package.

One of those packages announced in Oracle APEX 5.1 that are deprecated, and which I used a lot, was apex_util.string_to_table.

For example, in APEX Office Print (AOP) we read the session state of page items and we have some code like this:
declare
l_string varchar2(4000) := 'P1_X:P1_Y';
l_page_items_arr apex_application_global.vc_arr2;
begin
l_page_items_arr := apex_util.string_to_table(p_string => l_string, p_separator => ':');
for i in 1..l_page_items_arr.count
loop
sys.htp.p(l_page_items_arr(i)||':'||apex_util.get_session_state(l_page_items_arr(i)));
end loop;
end;

As the function is deprecated and APEX is already on release 18.1, it's good to start replacing those calls. The new function you can use is apex_string.split.

The above code becomes then:
declare
l_string varchar2(4000) := 'P1_X:P1_Y';
l_page_items_arr apex_t_varchar2;
begin
l_page_items_arr := apex_string.split(p_str => l_string, p_sep => ':');
for i in 1..l_page_items_arr.count
loop
sys.htp.p(l_page_items_arr(i)||':'||apex_util.get_session_state(l_page_items_arr(i)));
end loop;
end;

Depending on your application, you might need to be careful. For example with AOP, we support customers with versions of Oracle APEX 5.0, 5.1 and 18.1. We can't really force customers to move to higher APEX versions, so the way we solve it is by using conditional compilation of our code. If we see you are on APEX 5.1 or above we will use apex_string.split if not, and you are still on an earlier version, we will use apex_util.string_to_table.

Here's an example of what the code with conditional compilation looks like:
$if wwv_flow_api.c_current >= 20160824
$then

l_page_items_arr := apex_string.split(p_str=>l_string, p_sep=>':');
$else
l_page_items_arr := apex_util.string_to_table(p_string=>l_string, p_separator=>':');
$end

Note the conditional compilation you also need to do on the variable if they are different, or you can choose to conditional compile on the entire function.

To conclude, I recommend with every new release of Oracle APEX to look for deprecated components and search for those and make notes to change those when needed.