Hi all, I’m relatively new to apex, I’m having a problem with the APEX_UTIL.PREPARE function. Some how when calling the rest service , the url returned has the rest url, in front of the application page url.
\/ords\/incredi___ls\/rest\/clubsGeoJson\/r\/incredi___ls\/incredi___ls\/masterdetail?p2_c_id=16\u0026session=7087363759916\u0026cs=3H6xRzTQMSWCxZ7dmwwAObuhR0jI4dqv3qIhvK8u6Ny0aojvnyGoRRgvBsZhfzxD8T6dp7FNefA_Q2-DgthcFMw
Below is my setup, I created an application, with a spatial table, and use a query to filter for points within a bounding box.
WHERE
SDO_FILTER(c_shape,
SDO_GEOMETRY(
2003,
8307, -- SRID for WGS 84 longitude/latitude
NULL,
SDO_ELEM_INFO_ARRAY(1,1003,3),
SDO_ORDINATE_ARRAY(x1,y1,x2,y2))
) = 'TRUE';
******This works well******
In a package I use a for loop, to loop through the results, passing back geoJson
APEX_JSON.OPEN_OBJECT;
APEX_JSON.WRITE('type','Feature');
APEX_JSON.OPEN_OBJECT('properties');
APEX_JSON.WRITE(name',i.c_name);
APEX_JSON.WRITE('c_url', APEX_UTIL.PREPARE_URL(p_url => 'f?p=105:2:'||inSessionID||'::NO::P2_C_ID:'||i.c_id,p_checksum_type => 'SESSION'));
APEX_JSON.WRITE('c_id',i.c_id);
APEX_JSON.WRITE('session_id',inSessionID);
apex_json.close_object;
APEX_JSON.OPEN_OBJECT('geometry');
APEX_JSON.WRITE('type','Point');
APEX_JSON.OPEN_ARRAY('coordinates');
APEX_JSON.WRITE(i.c_long);
APEX_JSON.WRITE(i.c_lat);
APEX_JSON.CLOSE_ARRAY;
apex_json.close_object;
apex_json.close_object;
******This works well when calling the package with dbms_output******
In restful data services I create a GET resource handler, to call the package, and wrap it in http
begin
htp.p(crud.C_IN(:x1,:y1,:x2,:y2,:SessionID));
end;
******Her is where the problem starts ******
I am using the leaflet javascript library, and Leaflet.GeoJSON.Ajax library I set up a open streets map, and do a java ajax call to the rest service., so all this java script is in the source of a static region, and the reason for calling a rest service, was that I was unable to access apex functionality when the leaftet script was loading.