- 浏览: 665404 次
- 性别:
- 来自: 中山
文章分类
最新评论
-
wuhuizhong:
jFinal支持Rest风格吗?可以想spring mvc那样 ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
在jfinal中应如何获取前端ajax提交的Json数据?ht ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
jfinal如何处理json请求的数据:问题: 在某些api接 ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
Ubuntu14.04 安装 Oracle 11g R2 Ex ...
Oracle 11g release 2 XE on Ubuntu 14.04 -
alanljj:
这个很实用,已成功更新,谢过了!
odoo薪酬管理模块l10n_cn_hr_payroll
Last day, a mission is given to me about calling a web services by pl/sql. Firstly, i started to search ; “What is a web service?” The term Web services describes a standardized way of integrating Web-basedapplications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. Actually we can summarize it; Web Services can convert your applications into Web-applications. Web Services can be used by other applications. The basic Web Services platform is XML + HTTP. We have some input parameters and make a request. Then, we get a response from it with output parameters. All this syntax is in XML format. So, we will use XMLtype in our pl/sql package. Let’s start to write a soap access package or we can use this package (www.oracle-base.com/dba/miscellaneous/soap_api.sql) Let’s assume we have a function “myFunction” in this page http://www.mywebservice.com/web Then,start to write our code CREATE OR REPLACE PACKAGE pkg_my_webservice IS FUNCTION call_myfuntion ( vp_parameter1 VARCHAR2, vp_parameter2 VARCHAR2 ) RETURN VARCHAR2; END pkg_my_webservice; / CREATE OR REPLACE PACKAGE BODY pkg_my_webservice IS vg_funciton_fnc VARCHAR2(256) := 'myFunction'; vg_ws_address VARCHAR2(255) := 'http://www.mywebservice.com/web'; FUNCTION call_myfuntion( --lets assume that it inputs two parameters called string1, string2 vp_parameter1 VARCHAR2, vp_parameter2 VARCHAR2) RETURN VARCHAR2 AS ol_req soap_api.t_request; ol_resp soap_api.t_response; BEGIN -- we initilize a new request ol_req := soap_api.new_request(vg_funciton_fnc, 'xmlns="' || vg_ws_address || '"'); -- we started to add parameters soap_api.add_parameter(ol_req, 'string1', 'partns:string', vp_parameter1); soap_api.add_parameter(ol_req, 'string2', 'partns:string', vp_parameter1); -- we call the web service ol_resp := soap_api.invoke(ol_req, vg_ws_address, vg_funciton_fnc); -- we get back the results RETURN soap_api.get_return_value(ol_resp, 'result', -- result tag name 'xmlns:m="' || --can be change as "xmlns:n1" vg_ws_address || '"'); END call_myfuntion; END pkg_my_webservice; / You may need to change some tag attributes. The main basic function syntax is like this. If you have more than one return xml tags, then you need to call the There are also other ways to do this. You may also use oracle’s “utl_dbws” package, however “utl_http” is more faster than it. You can test it. In my next post, i am gonna explain soap_api package in more details. http://download-west.oracle.com/docs/cd/B12037_01/appdev.101/b10802/u_dbws.htm
Tom Krueger has an excellent write up on this:
I would like to say that calling a web service has been made easy with Sys.UTL_DBWS package but it took me a bit of time to get it right. This biggest issue that I ran into is that the samples that I found online and in the forums simply don’t work.
The sample below was provided by Oracle support and helped a lot in getting started so I thought that I would pass it along. The sample uses a public web service so if the service is still running this code should just work for you. My ultimate goal was to call a Microsoft WCF service which I have been able to do and plan to post the code soon.
function get_joke
return varchar2
is
service_ sys.utl_dbws.SERVICE;
call_ sys.utl_dbws.CALL;
service_qname sys.utl_dbws.QNAME;
port_qname sys.utl_dbws.QNAME;
xoperation_qname sys.utl_dbws.QNAME;
xstring_type_qname sys.utl_dbws.QNAME;
response sys.xmltype;
request sys.xmltype;
begin
service_qname := sys.utl_dbws.to_qname(null, 'getJoke');
service_ := sys.utl_dbws.create_service(service_qname);
call_ := sys.utl_dbws.create_call(service_);
sys.utl_dbws.set_target_endpoint_address(call_, 'http://interpressfact.net/webservices/getjoke.asmx');
sys.utl_dbws.set_property( call_, 'SOAPACTION_USE', 'TRUE');
sys.utl_dbws.set_property( call_, 'SOAPACTION_URI', 'http://interpressfact.net/webservices/getJoke');
sys.utl_dbws.set_property( call_, 'OPERATION_STYLE', 'document');
request := sys.xmltype(
'<getJoke xmlns="http://interpressfact.net/webservices/">'
|| '<Category>Excuses-10</Category>'
|| '</getJoke>');
response :=sys. utl_dbws.invoke(call_, request);
return response.extract('//getJokeResult/child::text()',
'xmlns="http://interpressfact.net/webservices/"').getstringval();
end;
http://tomkrueger.wordpress.com/2008/09/17/how-to-call-a-web-service-from-oracle-plsql/
Also, there's another page that gives a good explanation of doing this:
By using Web services, your application can publish its function or message to the rest of the world.
With Web services your accounting department’s Win 2k servers can connect with your IT supplier’s UNIX server.
Web services uses XML to code and decode your data and SOAP to transport it.get_return_value
function as much as result attributes. You may also store the results in a pl/sql type and return it back.
发表评论
-
用函数unistr将Oracle数据库中的Unicode转换为中文
2016-07-19 11:51 7864例子: DECLARE V_EXT_DES V ... -
ORACLE APPLICATION EXPRESS 5.0 升级
2016-05-12 11:43 532Oracle11GR2 XE 缺省是安装了oracle ap ... -
Oracle ACL(Access Control List)
2016-05-12 11:36 840在oralce 11g中假如你想获取server的ip或者h ... -
了解systemstate dump
2016-04-26 14:09 448当数据库出现严重的性能问题或者hang了的时候,我们非常需要 ... -
通过ORACLE的UTL_HTTP工具包发送包含POST参数的请求
2016-03-18 16:25 5069DECLARE req utl_http. ... -
Shell: extract more from listener.log(分析监听日志)
2016-03-16 14:57 1103统计一天内每小时的session请求数 # fgrep ... -
ORA-01031: insufficient privileges 问题解决笔记
2016-02-01 15:53 1145A) File $Oracle_HOME/network/a ... -
listener.log中报Warning: Subscription For Node Down Event Still Pending问题的解决方法
2016-01-07 16:34 1590一套Oracle 10.2.0.1 for aix的数据库环 ... -
Oracle触发器和MySQL触发器之间的区别
2015-11-19 12:55 610Oracle触发器格式: CREATE [OR RE ... -
查询正在执行的存储过程
2015-11-13 09:27 19811、找正在执行的PROCEDURE的 sid ,serial# ... -
undo表空间损坏的处理过程
2015-10-14 13:49 1175磁碟陣列故障,分區/rman上包括undo和archivel ... -
登录oracle资料库时很久无反应的问题处理一例
2015-10-11 10:56 957原因是系统存在僵死的进程,促使session处于激活状态.首 ... -
TNS-12560问题解决
2015-10-01 19:52 570tnsping远程主机实例出现TNS-12560: TNS ... -
查看undo中sql语句的占用情况
2015-08-06 17:18 1693查看undo中sql语句的占用情况 select * ... -
Install Open System Architect And ODBC Instant Client
2015-05-21 14:03 710How to Install Open System Arc ... -
恢复oracle中用pl sql误删除drop掉的表
2015-04-03 16:12 521查看回收站中表 select object_name,or ... -
在Oracle Linux 6.6上安装Oracle 10gR2
2015-01-15 15:36 2589查看硬體配置 # df -h Filesystem ... -
kill
2015-01-03 11:36 422--根据某一对象查询进程 col owner fo ... -
Oracle 数据库Storage存储迁移笔记
2014-12-27 11:08 9341.确认数据文件、控制文件、临时文件、日志文件 位置 / ... -
異地備份資料庫的開啟步驟
2014-11-19 14:03 442使用EMC設備執行異地備份, 資料庫的複製是開啟的狀態下, ...
相关推荐
1.Download Axis2 as WAR and...7. Start your servlet container and test the standard version service by calling this url: http://localhost:8080/axis2/services/Version/getVersion?response=application/json
How to Use JS Calling A WebService By Post Both SOAP And JSON
Calling .NET Web Services from PB11.5
You'll learn how to automate your infrastructure by programmatically calling the AWS API to control every part of AWS. Next, you'll learn options and techniques for storing your data. You'll also ...
HP OpenVMS Calling Standard.
WebAssembly is a new, revolutionary technology that allows developers to program webpages using popular high-level languages like C, C++, Rust, and Python. Code is then compiled to WebAssembly ...
拉西 歌词 中日双语 calling的歌词
bcf软件得到snp calling计算原理
假如一直没弄懂C/C++的呼叫惯例,那参考这份我从MSDN上特别整理的数据Calling Conventions Topics,能够很好的帮助想要对C/C++呼叫函式的方法更进一步了解的人
Descript C++ calling conventions.This is usefull for beginer.
python库。 资源全名:joint-calling-0.1.88.tar.gz
该文档描述了常见C++开发平台的调用约定,涉及到16位、32位、64位的程序开发,跨越Windows、Linux、BSD、Mac(基于Intel处理器)等操作系统,包含众多常用的编译器,同时文档也比较新,甚至谈论了AVX-512指令集。
SAP.Middleware.Connector.RfcCommunicationException:“destination XXXX failed when calling RFC_METADATA_GET -- see log for details” 猜测的原因: 老的DLL库在获取接口实例时,会触发“RFC_METADATA_GET”...
Microsoft Teams Calling Solutions Calling Solutions.pdf
Calling C and C++ from IDL复印版,还挺清楚的。
cad web预览 工具 加载的方法需写在$(document).ready(function(){}) 中 加载转换的图纸文件 图纸文件是四个SVG/JS 文件,由 AutoXchange转换生成 下载地址:...
Calling a service 115 Handling events 117 Passing parameters 117 Handling results 119 Accessing EJBs and other objects in JNDI 120 Part 4: Messaging Service Chapter 9: Using the Messaging Service ...
app-app-calling-android-master源码,是一个很不错的Android源码,有兴趣的伙伴们抽时间可以看一下把。
an brief introduction to Wi-Fi calling
GAMS LINGO XPRESS CPLEX MATLAB CPLUSPLUS\cplex_ppt\Tutorial_Calling CPLEX Functions from a C Source File.ppt