Oracle ORDS 3.0.4 POST PL / SQL过程400错误请求

时间:2016-04-02 16:51:30

标签: oracle rest post plsql oracle-ords

Oracle 12c 12.1.0.2,SQL Developer 4.1.3.20

按照在线教程安装了ORDS(无APEX),自动启用功能正常工作,包括POST到启用(emp)表,因此环境似乎没问题。但是,当我尝试在POST中定义PL / SQL服务时,我似乎无处可去。这是服务定义:

-- ORDS has been started in Standalone mode in SQL developer here

CREATE OR REPLACE PROCEDURE test_proc IS
BEGIN
    INSERT INTO emp (empno, ename) VALUES (10, 'TEST');
END test_proc;
/

BEGIN
   ORDS.DEFINE_SERVICE(
      p_module_name => 'test' ,
      p_base_path   => 'test/',
      p_pattern     => 'simple_insert/',
      p_method      => 'POST',
      p_source_type => ords.source_type_plsql,
      p_source => 'BEGIN
   hr.test_proc;
END;');
COMMIT;
END;
/

-- At this point the service is defined and running, testing with Postman yields "400 Bad Request"

GRANT EXECUTE ON hr.test_proc TO APEX_PUBLIC_USER; -- Despite being decoupled from APEX this     username still remains in ORDS 3.0.4, appears in .\ords\conf\apex.xml

-- Same error as before, having the priv makes no difference

邮差中的错误消息:

400 Bad Request
mapped request using: /hr/* to: ORDS:apex_pu.HR
BadRequestException [statusCode=400, reasons=[Expected one of: <<{,[>> but got: <>]]

1 个答案:

答案 0 :(得分:4)

我不是这方面的专家,但我刚遇到这个问题。我的解决方案是在请求体中传递一些东西(即使你的例程没有使用它)。

即便如此:

{}

如果您尝试使用GET方法,则无需传递任何内容,但POST需要它。 (我假设你需要使用POST - 和我一样。)

祝你好运