Can UTL_HTTP be used in the forms. [message #677866] |
Thu, 17 October 2019 05:39 |
|
Shiv93
Messages: 34 Registered: September 2019
|
Member |
|
|
Hi,
I'm trying to call a webservice from oracle PL/SQL package and was able to successfully invoke the webservice. But when i try to implement the same from Oracle forms am not able to call the webservice.
The code am writing is similar to the below snippet.
create or replace
procedure publish_cinema_event
( p_room_id in varchar2
, p_party_size in number
) is
req utl_http.req;
res utl_http.resp;
url varchar2(4000) := 'http://localhost:9002/cinema';
name varchar2(4000);
buffer varchar2(4000);
content varchar2(4000) := '{"room":"'||p_room_id||'", "partySize":"'||p_party_Size||'"}';
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 publish_cinema_event;
This works fine when im writing this piece of code as a PL/SQL package but im having issues with oracle forms because i dont think the UTL_HTTP command is being recogonized in the oracle forms. Any members have witnessed such issue ? If so it would be great if you can share your insights.
Regards,
Siva
[Updated on: Thu, 17 October 2019 05:42] Report message to a moderator
|
|
|