Hello,
I am getting the ORA-29266: end-of-body reached when executing the below block
DECLARE
req utl_http.req;
l_list json_list;
l_list_itm json_list;
l_list_spec_itm json_list;
l_json json;
l_buffer VARCHAR2(32767);
jsonArray json_list;
resp utl_http.resp;
value VARCHAR2(1024);
eob boolean := false;
buffer varchar2(100);
offsetPosition NUMBER;
--l_json json := json(responsebody);
responsebody clob:=null;
responsebody_item clob:=null;
responsebody_spec_item clob:=null;
--responsebody clob:='{';--;--:=null;
l_rnd_user VARCHAR2(30):= FND_PROFILE.VALUE ('XX_USER');
l_rnd_pwd VARCHAR2(30):= FND_PROFILE.VALUE ('XX_PWD');
l_rnd_workspace NUMBER:= FND_PROFILE.VALUE ('XX_WORKSACE');
l_json_auth_req CLOB;
l_json_auth json;
l_json_auth_spec json;
l_response_text1 VARCHAR2(32767);
l_response_text CLOB;--VARCHAR2(32767);
l_rnd_auth_req UTL_HTTP.req;
l_rnd_auth_resp UTL_HTTP.resp;
l_resp_text CLOB;
g_wallet_loc VARCHAR2 (100) := FND_PROFILE.VALUE ('XX_GLOBAL_WALLET');
g_wallet_pwd VARCHAR2 (100) := FND_PROFILE.VALUE ('XX_GLOBAL_WALLET_PWD');
g_proxy_server VARCHAR2 (200) := FND_PROFILE.VALUE ('XX_WEB_PROXY_SERVER');
l_description VARCHAR2(500);
l_name VARCHAR2(500);
l_name_item VARCHAR2(500);
l_item_number VARCHAR2(500);
l_assignable boolean;
name VARCHAR2(256);
--value VARCHAR2(1024);
BEGIN
UTL_HTTP.set_proxy (g_proxy_server);
UTL_HTTP.set_wallet (g_wallet_loc, g_wallet_pwd);
l_json_auth_req :=
'{
"email" : "'
|| l_rnd_user
|| '",
"password" : "'
|| l_rnd_pwd
|| '",
"workspaceId" : "'
|| l_rnd_workspace
|| '"
}';
UTL_HTTP.SET_BODY_CHARSET('UTF-8');
l_rnd_auth_req:=UTL_HTTP.begin_request ('https://api.rndsolutions.com/v1/login', 'POST');
UTL_HTTP.set_header (l_rnd_auth_req, 'Content-Type', 'application/json');
UTL_HTTP.set_header (l_rnd_auth_req, 'Content-Length', LENGTH (l_json_auth_req));
UTL_HTTP.write_text (l_rnd_auth_req, l_json_auth_req);
l_rnd_auth_resp := UTL_HTTP.get_response (l_rnd_auth_req);
DBMS_OUTPUT.PUT_LINE ('AUTH Request:' || CHR (10) || l_json_auth_req);
DBMS_OUTPUT.PUT_LINE (l_rnd_auth_resp.status_code);
DBMS_OUTPUT.PUT_LINE (l_rnd_auth_resp.reason_phrase);
DBMS_OUTPUT.PUT_LINE ('Reading Response:');
/***After Connection established get the Response Header Information****/
FOR i IN 1..UTL_HTTP.GET_HEADER_COUNT(l_rnd_auth_resp) LOOP
UTL_HTTP.GET_HEADER(l_rnd_auth_resp, i, name, value);
DBMS_OUTPUT.PUT_LINE(name || ': ' || value);
END LOOP;
BEGIN
LOOP
UTL_HTTP.read_text(l_RND_auth_resp, l_resp_text, 32766);
-- DBMS_OUTPUT.put_line (l_text);
-- UTL_HTTP.read_line (l_RND_auth_resp, l_resp_text, FALSE);
DBMS_OUTPUT.PUT_LINE ('Response:' || CHR (10) || l_resp_text);
END LOOP;
EXCEPTION
WHEN UTL_HTTP.end_of_body
THEN
DBMS_OUTPUT.PUT_LINE('Exception while reading response:'||SQLCODE||'::'||SQLERRM);
UTL_HTTP.end_response (l_rnd_auth_resp);
END;
END;