hello everyone,
I need little help on utl_htp. my requirement is capture weather information of current date, so i create a procedure that return all information through api weather bit as you seen below code:
create or replace NONEDITIONABLE procedure GET_WEATHER_DATA
( p_loc_code in varchar2,
p_loc_name in varchar2,
p_lat in varchar2,
p_long in varchar2
) is
req utl_http.req;
res utl_http.resp;
url varchar2(4000) := 'http://api.weatherbit.io/v2.0/current?&lat='||p_lat||'&lon='||p_long||'&key=7cffe6ab7f734aefb1a511a9d26ea520';
name varchar2(4000);
buffer varchar2(4000);
content varchar2(4000);
v_location varchar2(400);
begin
req := utl_http.begin_request(url, 'POST',' HTTP/1.1');
utl_http.set_header(req, 'user-agent', 'mozilla/4.0');
utl_http.set_header(req, 'content-type', 'application/json');
--utl_http.set_header(req, 'Content-Length', length(content));
utl_http.write_text(req,content);
res := utl_http.get_response(req);
-- process the response from the HTTP call
begin
loop
utl_http.read_line(res, buffer);
dbms_output.put_line(buffer);
end loop;
utl_http.end_response(res);
exception
when utl_http.end_of_body
then
utl_http.end_response(res);
end;
end GET_WEATHER_DATA;
I run this code from sys user and it will run perfectly in my local system and i m using database 12.2c
but the problem is that when i run this code on another machine that also have same database version this will show below error:
I dont understand where is the problem.
and one more thinng in my local i dont create any acl then it will worked fine but in another system database i also created acl and give grant utl htp to sys this will show same error.
Can anyone help me?