从 Oracle 存储过程访问 Web 服务 [英] Access Web service from Oracle stored procedure

查看:53
本文介绍了从 Oracle 存储过程访问 Web 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人从 Oracle 存储过程成功访问了 Web 服务?如果是这样,它是 Java 存储过程吗?PL/SQL 存储过程?

Is there anybody who has successfully accessed a Web service from an Oracle stored procedure? If so, was it a Java stored procedure? A PL/SQL stored procedure?

为什么我不应该尝试从存储过程访问 WS?

Is there any reason why I should not be trying to access a WS from a stored proc?

这是我目前找到的几个参考

Here are a couple refs that I found so far

..澄清一下,这是用于 SOAP 调用

推荐答案

首先,您调用的是哪种 Web 服务?我假设是 SOAP 或 REST.

First off, what sort of web service are you calling? I am assuming either SOAP or REST.

对于 REST Web 服务,UTL_HTTP 通常绰绰有余,在简单的 PL/SQL 存储过程中结合一些 XPath.

For REST web services, UTL_HTTP is often more than sufficient, combined with a bit of XPath in a simple PL/SQL stored procedure.

对于 SOAP Web 服务,这取决于您需要(或想要)的复杂程度.您当然可以使用 XQuery 创建符合 Web 服务规范的 XML 文档,使用 UTL_HTTP 发布文档并获取响应,然后使用一些 XPath 解析所有在 PL/SQL 中的响应.这是一个相对手动且相对蛮力的解决方案,但如果您谈论的是少数 Web 服务,它只涉及最少的基础设施,并且调用可以很快地组合在一起.

For SOAP web services, it depends on how sophisticated you need (or want) to be. You can certainly use XQuery to create an XML document that meets the spec for the web service, use UTL_HTTP to post the document and get the response, and then use some XPath to parse the response all in PL/SQL. This is a relatively manual and relatively brute-force solution, but if you are talking about a handful of web services, it involves a minimum of infrastructure and the calls can get knocked together pretty quickly.

如果您希望调用会随着时间的推移而演变,或者您希望有多个过程调用多个 Web 服务,那么在 UTL_DBWS 之类的东西上投入时间可能是有意义的(虽然这不是什么,但您通常会在几个小时内开始工作).

If you expect the calls to evolve over time or you expect there to be a number of procedures calling a number of web services, it probably makes sense to invest time in something like UTL_DBWS (this isn't something, though, that you generally get working in a couple hours).

这篇关于从 Oracle 存储过程访问 Web 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆