如何解决如何终止 POST Web 服务调用 - ORDS
请原谅我的无知,因为我是一个初学者。
我使用 PL/sql 创建了一个基本的 RESTful Web 服务,示例代码如下(工作正常)
ords.define_template(
p_module_name => 'restDemo',p_pattern => 'updateClient');
ords.define_handler(
p_module_name => 'restDemo',p_pattern => 'updateClient',p_method => 'POST',p_source_type => ords.source_type_plsql,p_source => 'declare
w_clob clob := :body_text;
begin
ws.ws_interface.update_client(w_clob);
exception
when others then
package.ws_interface.g_result_rec.result_message := sqlERRM;
end;');
当通过 post 请求启动 ws_interface.update_client
时,在 ws_interface
包的初始化中,我正在调用一个例程,该例程确定是否可以更新客户端(基于登录用户的访问权限)到数据库中)。
如果用户无权执行 updateClient
服务 - 我想终止服务调用,但我不知道如何执行此操作。
所以我的问题是:
如何终止当前活动的 updateClient
网络服务调用?
解决方法
在您的 ws_interface
包中,如果客户端无法更新,那么您只需要 return
以便 POST 定义中的 PL/SQL 块将完成。您的代码可能如下所示:
---Beginning of package
...
procedure update_client (some_clob clob) is
begin
--The client can not be updated so do no more processing.
if can_update_client = false then
--Some sort of error message could also be added here
return;
end if;
--Rest of processing for updating the client
end;
...
---End of package
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。