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

查看:147
本文介绍了从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

  • Database Web Services
  • Calling external Web Service from a Java Stored Procedure

..只是为了澄清,这是针对SOAP调用的

推荐答案

首先,你打电话给什么样的网络服务?我假设是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天全站免登陆