【发布时间】:2014-07-19 08:00:34
【问题描述】:
我有以下用于发布 plsql json 请求的基本代码。正在执行的 web 服务没有任何响应,因为它只是为了执行某个任务。 但是每次执行该块时,我都会从 Apache Tomcat 获得状态代码 400。 我哪里错了?
declare
http_resp utl_http.resp;
http_req utl_http.req;
json_msg VARCHAR2(500);
begin
http_req := utl_http.begin_request('http://192.168.1.194:8080/NotificationApp/sendNotification.rest', 'POST');
utl_http.set_body_charset(http_req, 'UTF-8');
utl_http.set_header(http_req, 'Content-Type', 'application/json');
json_msg := '{"code":100,"id": "APA91bFSmD_gBsUwP_hraRZL20mt8p4ejGn5fC7tlciINT50Ad8oIod2T-64GVk_8rrjoqXGEpYuRcoQogG0L7aOKIjeeisTcmHiUUONbnZzn4_u0ED7QD_iNeVkh2RU8Pa-HBHwgJUgOT-TyvlM9hB4Yn9fvWER","data": "alert alert"}';
utl_http.write_text(http_req, dbms_lob.substr(json_msg,dbms_lob.getLength(json_msg),1));
http_resp := utl_http.get_response(http_req);
if (http_resp.status_code >= 400) and
(http_resp.status_code <= 499)
then
dbms_output.put_line(http_resp.status_code);
end if;
utl_http.end_response(http_resp);
end;
提前致谢
【问题讨论】:
标签: json post plsql http-post httprequest