我正在尝试在 Oracle Apex 20.2 中创建 RESTful 服务,如下所示:
RESTful Service Module : api
Module Base Path : /api/
URI Template : {command}
Full URL : http://localhost:8080/ords/useralias/api/{command}
Method(Value Required) : POST
Source Type : PL/SQL
Source :
htp.p('Hi !');
服务已创建。但是,当使用以下命令通过 Curl 调用它时:
curl -X GET http://localhost:8080/ords/useralias/api/something
我收到错误:
{
"code": "UserDefinedResourceError",
"title": "User Defined Resource Error",
"message": "The request could not be processed due to an error in a user defined resource",
"o:errorCode": "ORDS-25001",
"cause": "An error occurred when evaluating the SQL statement associated with this resource. SQL Error Code 900, Error Message: ORA-00900: instruction SQL non valide\n",
"action": "Ask the user defined resource author to check the SQL statement is correctly formed and executes without error",
"type": "tag:oracle.com,2020:error/UserDefinedResourceError",
"instance": "tag:oracle.com,2020:ecid/3-WELoSC5oGNk1d3BuOh2A"
}
使用完全相同的服务与 "GET" 处理程序和相同的源 (htp.p('Hi !');),服务可以正常工作。
我怎样才能让它发挥作用?
答案非常简单:
来源应该是:
begin
htp.p('hi !');
end;
而不是:
htp.p('hi !');
如何使用 http://localhost:8080 更改完整网址?您使用的是 apex 云还是本地部署?
谢谢