UTL_DBWS - Consuming Web Services in Oracle 10g Onward
from:http://oracle-base.com/articles/10g/utl_dbws-10g.php
In a previous article I presented a method for Consuming Web Services using a basic SOAP implementation. This article provides similar functionality, but this time using the UTL_DBWS package, which is essentially a PL/SQL wrapper over JPublisher.
First, download the latest copy of the dbwsclient.jar file:
- Pre 10g: dbws-callout-utility.zip (10.1.2)
- 10g: dbws-callout-utility-10R2.zip (10.1.3.0)
- 10g, 11g & 12c latest: dbws-callout-utility-10131.zip (10.1.3.1)
Extract the jar file from the zip file into the "$ORACLE_HOME/sqlj/lib" directory.
The jar file can be loaded into the SYS schema for everyone to access, or into an individual schema that needs access to the web client. To make sure you avoid errors during the load, set the JAVA_POOL_SIZE initialization parameter to at least 150M.
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 # Load into the SYS schema. export PATH=$ORACLE_HOME/bin:$PATH cd $ORACLE_HOME/sqlj/lib # 10gR2 loadjava -u sys/password -r -v -f -genmissing -s -grant public dbwsclientws.jar dbwsclientdb102.jar # 11g and 12c loadjava -u sys/password -r -v -f -genmissing -s -grant public dbwsclientws.jar dbwsclientdb11.jar # Load into an individual schema. export PATH=$ORACLE_HOME/bin:$PATH cd $ORACLE_HOME/sqlj/lib # 10gR2 loadjava -u scott/tiger -r -v -f -genmissing dbwsclientws.jar dbwsclientdb102.jar # 11g & 12c loadjava -u scott/tiger -r -v -f -genmissing dbwsclientws.jar dbwsclientdb11.jar
In Oracle 10g the UTL_DBWS package is loaded by default. In Oracle 9i, 11g and 12c the package must be loaded using the specification and body provided in the zip file. The execute privilege should be granted on the ULT_DBWS package to any users needing access to the functionality.
$ cd $ORACLE_HOME/sqlj/lib $ sqlplus / as sysdba SQL> @utl_dbws_decl SQL> @utl_dbws_body SQL> CREATE PUBLIC SYNONYM utl_dbws FOR sys.utl_dbws; SQL> GRANT EXECUTE ON sys.utl_dbws TO test;
The function below uses the UTL_DBWS package to access a web services from PL/SQL. The URL of the WDSL file describing the web service is shown here (http://oracle-base.com/webservices/server.php?wsdl). The web service accepts two number parameters and returns the sum of those values.
CREATE OR REPLACE FUNCTION add_numbers (p_int_1 IN NUMBER,
p_int_2 IN NUMBER)
RETURN NUMBER
AS
l_service UTL_DBWS.service;
l_call UTL_DBWS.call;
l_wsdl_url VARCHAR2(32767);
l_namespace VARCHAR2(32767);
l_service_qname UTL_DBWS.qname;
l_port_qname UTL_DBWS.qname;
l_operation_qname UTL_DBWS.qname;
l_xmltype_in SYS.XMLTYPE;
l_xmltype_out SYS.XMLTYPE;
l_return NUMBER;
BEGIN
l_wsdl_url := 'http://oracle-base.com/webservices/server.php?wsdl';
l_namespace := 'http://oracle-base.com/webservices/';
l_service_qname := UTL_DBWS.to_qname(l_namespace, 'Calculator');
l_port_qname := UTL_DBWS.to_qname(l_namespace, 'CalculatorPort');
l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'ws_add');
l_service := UTL_DBWS.create_service (
wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
service_name => l_service_qname);
l_call := UTL_DBWS.create_call (
service_handle => l_service,
port_name => l_port_qname,
operation_name => l_operation_qname);
l_xmltype_in := SYS.XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
<ws_add xmlns="' || l_namespace || '">
<int1>' || p_int_1 || '</int1>
<int2>' || p_int_2 || '</int2>
</ws_add>');
l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call,
request => l_xmltype_in);
UTL_DBWS.release_call (call_handle => l_call);
UTL_DBWS.release_service (service_handle => l_service);
l_return := l_xmltype_out.extract('//return/text()').getNumberVal();
RETURN l_return;
END;
/
The output below shows the function in action.
SELECT add_numbers(1, 5) FROM dual;
ADD_NUMBERS(1,5)
----------------
6
SQL>
SELECT add_numbers(10, 15) FROM dual;
ADD_NUMBERS(10,15)
------------------
25
SQL>
For more information see:
- Consuming Web Services (9i)
- APEX_WEB_SERVICE : Consuming SOAP and REST Web Services
- UTL_HTTP and SSL (HTTPS) using Oracle Wallets
- Fine-Grained Access to Network Services in Oracle Database 11g Release 1
- UTL_DBWS (10g)
- Database Web Services
- Virtualize Your Oracle Database with Web Services
UTL_DBWS - Consuming Web Services in Oracle 10g Onward的更多相关文章
- oracle直接调用web services
oracle调用C#开发web services 1, 去oracle官网上下载dbws-callout-utility-10131.zip 地址:https://oracle-base.com/a ...
- Oracle Agile PLM Web Services 的实现
Oracle 的产品Agile PLM内置了许多Web Services,其他系统可以通过Web Servcies实现对Agile PLM系统资源的访问.快速学会使用的方法,是去Oracle的官网下载 ...
- BizTalk发布WS-Security的web services
最近做个项目,biztalk跟OTM(Oracle Transportation Management)系统做对接,双方通过web services通讯,这部分是BizTalk发布WS-Securit ...
- BizTalk调用WS-Security的web services
最近做个项目,biztalk跟OTM(Oracle Transportation Management)系统做对接,双方通过web services通讯,这部分是BizTalk调用OTM的web se ...
- (转) Web 建站技术中,HTML、HTML5、XHTML、CSS、SQL、JavaScript、PHP、ASP.NET、Web Services 是什么?
Web 建站技术中,HTML.HTML5.XHTML.CSS.SQL.JavaScript.PHP.ASP.NET.Web Services 是什么? 建站有很多技术,如 HTML.HTML5.XHT ...
- CENTOS 6.4 安装oracle 10g,手工建库及升级到10.2.0.5
一. 数据库软件安装 参照官方手册 1.安装rpm包 注这里的yum直接用163的yum yum -y install binutils compat-libstdc++-33 compat-libs ...
- 08.安装Oracle 10g和SQLServer2008(仅作学习使用VirtualBox虚拟机来安装节省电脑资源)
1.虚拟机和宿主机共享文件夹. 2.右ctrl+F切换VirtualBox全屏 3.安装Oracle 10g 4.输入密码:root------------>下一步 5.勾选网络配置" ...
- oracle 10g升级到11g
Linux 上Oracle RAC 10g 升级到 Oracle RAC 11g 了解如何在 Oracle Enterprise Linux 5 上逐步将 Oracle RAC 10g 第 2 版升级 ...
- 【转】Oracle 10g RAC TAF
本人转自:http://www.cnblogs.com/future2012lg/archive/2013/10/12/3365978.html Oracle RAC 同一时候具备HA(High Av ...
随机推荐
- java中的interface接口
接口:java接口是一些方法表征的集合,但是却不会在接口里实现具体的方法. java接口的特点如下: 1.java接口不能被实例化 2.java接口中声明的成员自动被设置为public,所以不存在pr ...
- Python 自动刷博客浏览量
哈哈,今天的话题有点那什么了哈.咱们应该秉承学习技术的角度来看,那么就开始今天的话题吧. 思路来源 今天很偶然的一个机会,听到别人在谈论现在的"刷量"行为,于是就激发了我的好奇心. ...
- 返回present的根
//返回四大tab页面 + (void)gobackToTabarController { UINavigationController* selectedTabNavController = (UI ...
- Android之Gallery和Spinner-Android学习之旅(二十九)
Spinner简介 spinner是竖直方向展开一个列表供选择.和gallery都是继承了AbsSpinner,AbsSpinner继承了AdapterView,因此AdaptyerView的属性都可 ...
- 如何在Cocos2D 1.0 中掩饰一个精灵(三)
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请告诉我,如果觉得不错请多多支持点赞.谢谢! hopy ;) 尝试编译运行,在你每一次点击屏幕的时候,你将看到我可爱的妻子制作 ...
- Jeff Atwood质疑iPhone的单键设计
我喜欢使用iPhone,但我对它的一个设计不敢苟同:苹果始终坚持,设备的正面永远只能有一个按键. 我还买了一个Kindle Fire,它更离谱,一个按键都没有!我完全赞成,任何小器具的正面都应该在明显 ...
- STL:set/multiset用法详解
集合 使用set或multiset之前,必须加入头文件<set> Set.multiset都是集合类,差别在与set中不允许有重复元素,multiset中允许有重复元素. sets和mul ...
- Linux Debugging(五): coredump 分析入门
作为工作几年的老程序猿,肯定会遇到coredump,log severity设置的比较高,导致可用的log无法分析问题所在. 更悲剧的是,这个问题不好复现!所以现在你手头唯一的线索就是这个程序的尸体: ...
- (NO.00001)iOS游戏SpeedBoy Lite成形记(九)
我们回到matchRun方法中去尝试第一次修改,部分代码如下: CCActionMoveBy *moveBy = [CCActionMoveBy actionWithDuration:duration ...
- 网易内推(Android) 拿offer
学校BBS上师兄发网易内推,凑下热闹投了一发 一面:电话面 大概25分钟,感觉面试官气场很足,主要关注了其中一个 个人开源项目 1.自我介绍 2.说说你做的这个项目 当时谈到使用到了开源框架xtuil ...