- 浏览: 693804 次
- 性别:
- 来自: 中山
-
文章分类
最新评论
-
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
1.xxstd_soap_api_pkg_h.sql
create or replace package xxstd_soap_api_pkg is
--+=======================================================================
--|
--| $header$
--|
--| XXSTD SOAP API, Tools to access SOAP webservices
--|
--| With great influence from http://www.oracle-base.com/dba/miscellaneous/soap_api.sql
--| Original author: DR Timothy S Hall
--| 2008-2010 Rewrite by J Ramb
--|
--+=======================================================================
function generate_envelope(p_body in xmltype := null)
return xmltype;
procedure invoke(
p_url in varchar2,
p_action in varchar2,
p_body_xml in xmltype,
p_body_clob in CLOB,
p_return_type in varchar2, -- 'XML'/'CLOB'
p_return_xml out xmltype,
p_return_clob out CLOB,
p_proxy_username in varchar2 := null,
p_proxy_password in varchar2 := null
);
function invoke(
p_url in varchar2,
p_action in varchar2,
p_body in XMLTYPE)
return XMLTYPE;
function invoke(
p_url in varchar2,
p_action in varchar2,
p_body in CLOB)
return CLOB;
end xxstd_soap_api_pkg;
/
sho err
2.xxstd_soap_api_pkg_b.sql
create or replace package body xxstd_soap_api_pkg is
--+=======================================================================
--|
--| $header$
--|
--| XXSTD SOAP API, Tools to access SOAP webservices
--| 2008-2010 by J Ramb
--|
--+=======================================================================
/** EXAMPLE: --{{{
declare
v_req_xml xmltype;
v_resp_xml xmltype;
v_req_clob CLOB;
v_resp_clob CLOB;
v_start_time number;
begin
-- Set proxy details if no direct net connection.
--UTL_HTTP.set_proxy('myproxy:4480', NULL);
--UTL_HTTP.set_persistent_conn_support(TRUE);
-- Set proxy authentication if necessary.
--xxstd_soap_api_pkg.set_proxy_authentication(p_username => 'myusername',
-- p_password => 'mypassword');
utl_http.set_transfer_timeout(1000); -- 1000 seconds, default is 60!
v_req_xml := xmltype('
<ska:GetProjectMaster xmlns="http://www.openapplications.org/oagis/9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ska="http://www.example.se/oagis/9"
xsi:schemaLocation="http://www.example.se/oagis/9 ../BODs/GetProjectMaster.xsd"
versionID="1.0"
releaseID="9.0"
systemEnvironmentCode="UTV">
<ApplicationArea>
<ska:Sender>
<LogicalID>OEBS_SE</LogicalID>
<ComponentID>YourContractID</ComponentID>
<!--AuthorizationID>RAMBJ</AuthorizationID-->
<!--ska:ResponsibilityID>50092</ska:ResponsibilityID-->
</ska:Sender>
<CreationDateTime>2007-02-15</CreationDateTime>
<BODID>ContractID+unique traceable id from the sending system (for this transaction)</BODID>
</ApplicationArea>
<DataArea>
<Get maxItems="10">
<Expression expressionLanguage="level">LIST<!-- FULL LIST SPIK BASIC --></Expression>
<Expression expressionLanguage="params">NOTASKS</Expression>
</Get>
<ska:ProjectMaster>
<ID schemeName="ProjectNumber"><!--112675--></ID>
<ID schemeName="ProjectID"><!--30427--></ID>
<AuthorizationID>RAMBJ</AuthorizationID>
<ska:ProjectActivity>
<ID schemeName="TaskID"><!--570731--></ID>
<ID schemeName="TaskNumber"><!--10--></ID>
</ska:ProjectActivity>
<ska:ResponsibilityID><!--50092Modulansvarig Projekt-K SVE--></ska:ResponsibilityID>
</ska:ProjectMaster>
</DataArea>
</ska:GetProjectMaster>
');
--for i in 1..10 loop
v_start_time := dbms_utility.get_time;
v_resp_xml := xxstd_soap_api_pkg.invoke(
p_url => '()http://ska536.data.example.se:7779/XXPA140B/ProjectMasterPort',
p_action => 'GetProjectMaster',
p_body => v_req_xml);
v_resp_xml := v_resp_xml.extract('/ska:ShowProjectMaster/DataArea/Show/@recordSetCount',
xxstd_oagis_tools_pkg.SCHEMA_NS);
dbms_output.put_line('Number of projects: '||
v_resp_xml.getStringVal()||
', time taken: '||( (dbms_utility.get_time - v_start_time)/100 ));
--end loop;
-- declare
-- v_clob CLOB := v_resp_xml.extract('/'||'*').getClobVal();
-- v_buffer varchar2(4096);
-- v_size number := 4096;
-- v_offset number := 1;
-- begin
-- loop
-- dbms_lob.read(v_clob, v_size, v_offset, v_buffer);
-- dbms_output.put_line(v_buffer);
-- v_offset := v_offset + v_size;
-- end loop;
-- exception when no_data_found then null;
-- end;
end;
*/ ---}}}
function generate_envelope(p_body in xmltype := null) --{{{
return xmltype
is
v_xml xmltype;
begin
select xmlelement("soap:Envelope", xmlattributes('http://schemas.xmlsoap.org/soap/envelope/' as "xmlns:soap",
'http://www.w3.org/1999/XMLSchema-instance' as "xmlns:xsi",
'http://www.w3.org/1999/XMLSchema' as "xmlns:xsd"),
xmlelement("soap:Body", nvl(p_body, xmlcomment('REPLACEME'))))
into v_xml
from dual;
return v_xml;
END; --}}}
-- ---------------------------------------------------------------------
procedure check_fault(p_response in out nocopy xmltype) --{{{
is
l_fault_node XMLTYPE;
--l_part xmltype;
--l_fault_code VARCHAR2(256);
--l_fault_string VARCHAR2(32767);
begin
--G_SOAP_FAULT := l_fault_node;
if p_response is null then
raise_application_error(-20003, 'Empty SOAP body!');
end if;
l_fault_node := p_response.extract('/soap:Envelope/soap:Body/soap:Fault',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"');
if l_fault_node is null then
l_fault_node := p_response.extract('/soap:Envelope/soap:Body/soap:Fault',
'xmlns:soap="http://www.w3.org/2003/05/soap-envelope"');
end if;
if (l_fault_node is not null) then
--G_SOAP_FAULT := l_fault_node;
/*
l_part := l_fault_node.extract('/soap:Fault/faultcode/child::text()', 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"');
if l_part is not null then
l_fault_code := l_part.getStringVal();
end if;
l_part := l_fault_node.extract('/soap:Fault/faultstring/child::text()', 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"');
if l_part is not null then
l_fault_string := l_part.getStringVal();
end if;
*/
--raise_application_error(-20000, l_fault_code || ' - ' || l_fault_string);
raise_application_error(-20000, substr(l_fault_node.getClobVal(),1,2000));
end if;
end; --}}}
procedure hlp_write_clob( --{{{
p_http_request in out nocopy utl_http.req,
p_clob in CLOB)
is
v_buffer varchar2(4096);
v_size number := 4096;
v_offset number := 1;
begin
loop
dbms_lob.read(p_clob, v_size, v_offset, v_buffer);
UTL_HTTP.write_text(p_http_request, v_buffer);
v_offset := v_offset + v_size;
end loop;
exception when no_data_found then
null;
end hlp_write_clob; --}}}
procedure hlp_read_clob( --{{{
p_http_response in out nocopy utl_http.resp,
p_clob in out nocopy CLOB)
is
v_buffer varchar2(4096);
v_size number := 4096;
begin
-- dbms_lob.createtemporary(p_clob, false);
loop
UTL_HTTP.read_text(r => p_http_response, data => v_buffer);
dbms_lob.writeappend( p_clob, length(v_buffer), v_buffer);
end loop;
exception
when utl_http.end_of_body then
NULL;
end hlp_read_clob; --}}}
-- Generic version, allows both input be XML or CLOB
-- and the output as XML/CLOB.
-- The parameter p_body_XX that is not null is the input
-- and the type of output is specified by the p_return_type
-- p_return_clob must be freed by the caller: dbms_lob.freetemporary(clob)
procedure invoke( --{{{
p_url in varchar2,
p_action in varchar2,
p_body_xml in xmltype,
p_body_clob in CLOB,
p_return_type in varchar2, -- 'XML'/'CLOB'
p_return_xml out xmltype,
p_return_clob out CLOB,
p_proxy_username in varchar2 := null,
p_proxy_password in varchar2 := null
)
is
v_database_name varchar2(100);
v_request_clob CLOB;
v_respond_clob CLOB;
v_http_request UTL_HTTP.req;
v_http_response UTL_HTTP.resp;
v_response_xml xmltype;
v_response_body xmltype;
v_is_clob_request boolean;
v_request_template varchar2(2000) := null;
v_request_len number := 0;
v_charset varchar2(50);
v_xml_decl varchar2(100);
v_start_time number;
C_REPLACE CONSTANT varchar2(100) := '<!--REPLACEME-->';
begin
if p_body_xml is null and p_body_clob is null then
raise_application_error(-20001, 'No body provided, aborting.');
end if;
if p_body_xml is not null and p_body_clob is not null then
raise_application_error(-20001, 'Multiple bodies provided, aborting.');
end if;
select name
into v_database_name
from v$database;
v_is_clob_request := (p_body_xml is null);
if v_is_clob_request then
--generate the envelope with "<!--REPLACEME-->" where the contents would be.
--this is short, so a varchar2 is sufficient
v_request_template := generate_envelope(NULL).getStringVal();
--DOES NOT WORK: v_request_clob := replace(v_request_clob,'<!--REPLACEME-->',p_body_clob); -- FIXME? does this work for larger stuff?
v_request_len := dbms_lob.getLength(p_body_clob) + length(v_request_template) - length(C_REPLACE);
else
v_request_clob := generate_envelope(p_body_xml).getClobVal();
v_request_len := dbms_lob.getLength(v_request_clob);
end if;
-- feature (security)
-- The URL must be in the style "(NNNN)http://webservice..."
-- where NNNN is the database name!
-- This is a safety feature! It has a meaning (and saved me a couple of times).
if regexp_replace(p_url,'^(\(.*\)).*$','\1') not in ('('||v_database_name||')') then
raise_application_error(-20004,'Url must be prefixed with "(<DBNAME>)"');
end if;
v_http_request := UTL_HTTP.begin_request(substr(p_url,instr(p_url,')')+1), 'POST','HTTP/1.1'); -- Bug? 1.0?
IF p_proxy_username IS NOT NULL THEN
UTL_HTTP.set_authentication(r => v_http_request,
username => p_proxy_username,
password => p_proxy_password,
scheme => 'Basic',
for_proxy => TRUE);
END IF;
v_start_time := dbms_utility.get_time;
v_charset:='ISO-8859-1'; -- NICE-to-have: check dbs setup instead? how?
v_xml_decl := '<?xml version="1.0" encoding="'||v_charset||'"?>'||chr(13)||chr(10);
v_request_len := v_request_len+length(v_xml_decl);
UTL_HTTP.set_header(v_http_request, 'User-Agent', 'OADB xxstd_soap_api_pkg ('||v_database_name||')');
UTL_HTTP.set_header(v_http_request, 'Content-Type', 'text/xml;charset='||v_charset);
UTL_HTTP.set_header(v_http_request, 'Content-Length', to_char(v_request_len));
UTL_HTTP.set_header(v_http_request, 'SOAPAction', p_action);
UTL_HTTP.write_text(v_http_request,v_xml_decl);
if v_is_clob_request then
UTL_HTTP.write_text(v_http_request,
substr(v_request_template,1,instr(v_request_template,C_REPLACE)-1)); -- first part of envelope
hlp_write_clob(v_http_request, p_body_clob); -- body
UTL_HTTP.write_text(v_http_request,
substr(v_request_template,instr(v_request_template,C_REPLACE)+
length(C_REPLACE))); -- last part of envelope
else
-- just put out the request_clob
hlp_write_clob(v_http_request, v_request_clob);
end if;
v_http_response := UTL_HTTP.get_response(v_http_request);
dbms_lob.createtemporary(v_respond_clob, false);
hlp_read_clob(v_http_response, v_respond_clob);
UTL_HTTP.end_response(v_http_response);
--if( nvl(fnd_profile.value_WNPS/*no cache*/('XXSTD_SOAP_API_TIMER'),'Y')='Y') then
--xxstd_key_values_pkg.set_number(
--p_domain => 'XXSTD_SOAP_API'
--, p_entity_type => 'START_TIME'
--, p_entity_id => v_start_time
--, p_key => p_url
--, p_value => (dbms_utility.get_time - v_start_time)/100
--);
--end if;
if p_return_type='XML' then
v_response_xml := XMLTYPE.createxml(v_respond_clob);
dbms_lob.freetemporary(v_respond_clob);
-- dbms_output.put_line(v_response_xml.getStringVal());-- DEBUG
check_fault(v_response_xml);
v_response_body := v_response_xml.extract('/soap:Envelope/soap:Body/*', --child::node()',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"');
if v_response_body is null then
v_response_body := v_response_xml.extract('/soap:Envelope/soap:Body/*', --child::node()',
'xmlns:soap="http://www.w3.org/2003/05/soap-envelope"');
end if;
if v_response_body is null then
raise_application_error(-20005, 'SOAP call failed: '||substr(v_response_xml.getClobVal(),1,1000));
end if;
p_return_xml := v_response_body;
elsif p_return_type='CLOB' then
-- just return the plain answer
p_return_clob := v_respond_clob;
else
raise_application_error(-20002, 'Invalid return type: '||p_return_type);
end if;
end invoke; --}}}
-- helper function: invoke that talks only xmltype
function invoke( --{{{
p_url in varchar2,
p_action in varchar2,
p_body in XMLTYPE)
return XMLTYPE
is
v_response_xml xmltype;
v_dummy_clob CLOB;
begin
invoke(
p_url => p_url,
p_action => p_action,
p_body_xml => p_body,
p_body_clob => NULL,
p_return_type => 'XML',
p_return_xml => v_response_xml,
p_return_clob => v_dummy_clob);
return v_response_xml;
end invoke; --}}}
-- helper function: invoke that talks only CLOB
function invoke( --{{{
p_url in varchar2,
p_action in varchar2,
p_body in CLOB)
return CLOB as
v_response_clob CLOB;
v_dummy_xml xmltype;
BEGIN
invoke(
p_url => p_url,
p_action => p_action,
p_body_xml => null,
p_body_clob => p_body,
p_return_type => 'CLOB',
p_return_xml => v_dummy_xml,
p_return_clob => v_response_clob);
return v_response_clob;
end invoke; --}}}
end xxstd_soap_api_pkg;
/
sho err
发表评论
-
用函数unistr将Oracle数据库中的Unicode转换为中文
2016-07-19 11:51 7980例子: DECLARE V_EXT_DES V ... -
ORACLE APPLICATION EXPRESS 5.0 升级
2016-05-12 11:43 616Oracle11GR2 XE 缺省是安装了oracle ap ... -
Oracle ACL(Access Control List)
2016-05-12 11:36 929在oralce 11g中假如你想获取server的ip或者h ... -
了解systemstate dump
2016-04-26 14:09 517当数据库出现严重的性能问题或者hang了的时候,我们非常需要 ... -
通过ORACLE的UTL_HTTP工具包发送包含POST参数的请求
2016-03-18 16:25 5205DECLARE req utl_http. ... -
Shell: extract more from listener.log(分析监听日志)
2016-03-16 14:57 1196统计一天内每小时的session请求数 # fgrep ... -
ORA-01031: insufficient privileges 问题解决笔记
2016-02-01 15:53 1215A) File $Oracle_HOME/network/a ... -
listener.log中报Warning: Subscription For Node Down Event Still Pending问题的解决方法
2016-01-07 16:34 1660一套Oracle 10.2.0.1 for aix的数据库环 ... -
Oracle触发器和MySQL触发器之间的区别
2015-11-19 12:55 722Oracle触发器格式: CREATE [OR RE ... -
查询正在执行的存储过程
2015-11-13 09:27 20861、找正在执行的PROCEDURE的 sid ,serial# ... -
undo表空间损坏的处理过程
2015-10-14 13:49 1247磁碟陣列故障,分區/rman上包括undo和archivel ... -
登录oracle资料库时很久无反应的问题处理一例
2015-10-11 10:56 1020原因是系统存在僵死的进程,促使session处于激活状态.首 ... -
TNS-12560问题解决
2015-10-01 19:52 643tnsping远程主机实例出现TNS-12560: TNS ... -
查看undo中sql语句的占用情况
2015-08-06 17:18 1813查看undo中sql语句的占用情况 select * ... -
Install Open System Architect And ODBC Instant Client
2015-05-21 14:03 779How to Install Open System Arc ... -
恢复oracle中用pl sql误删除drop掉的表
2015-04-03 16:12 586查看回收站中表 select object_name,or ... -
在Oracle Linux 6.6上安装Oracle 10gR2
2015-01-15 15:36 2777查看硬體配置 # df -h Filesystem ... -
kill
2015-01-03 11:36 493--根据某一对象查询进程 col owner fo ... -
Oracle 数据库Storage存储迁移笔记
2014-12-27 11:08 10141.确认数据文件、控制文件、临时文件、日志文件 位置 / ... -
異地備份資料庫的開啟步驟
2014-11-19 14:03 519使用EMC設備執行異地備份, 資料庫的複製是開啟的狀態下, ...
相关推荐
- Oracle还提供了其他工具和包,如DBMS_WS和DBMS_SOAP,它们提供了更高级的Web Service操作功能,如直接解析WSDL生成PL/SQL接口,简化调用过程。 - `DBMS_WS.TEST_CLIENT` 可用于测试和调试Web Service调用,而`...
1. **理解Web Service**:首先,你需要了解Web Service的工作原理,通常基于SOAP(Simple Object Access Protocol)或REST(Representational State Transfer)协议。WSDL(Web Services Description Language)文件...
"Oracle调用WSDLService.zip"这个压缩包就是关于如何利用Oracle数据库直接调用Web服务的一个实例,主要涉及Oracle数据库与WSDL(Web Services Description Language)的集成,以及SOAP(Simple Object Access ...
7. **Web服务集成**:Oracle数据库可以作为Web服务的提供者和消费者,通过WSDL(Web Services Description Language)和SOAP(Simple Object Access Protocol)实现XML Web服务的交互。 8. **XML数据安全**:Oracle...
5. **Web服务**: Oracle数据库支持SOAP(Simple Object Access Protocol)和RESTful API,可以将XML用于Web服务的请求和响应。这使得Oracle数据库能够与其他系统进行基于XML的数据交换,实现企业级的集成。 6. **...
- **SOAP协议**:学习SOAP(Simple Object Access Protocol)的基础知识,用于构建基于XML的Web服务。 - **RESTful服务**:理解RESTful架构模型中如何使用XML作为消息体格式。 通过以上内容的学习,您将能够全面地...
9. **Web服务与SOAP**:Oracle数据库能够支持Web服务,包括SOAP(Simple Object Access Protocol)协议,允许XML数据通过HTTP进行交换。这部分可能会讲解如何在Oracle中创建和调用Web服务。 10. **应用案例**:课程...
7. **Web服务与Oracle9i**:书中可能讨论了如何在Oracle9i中实现Web服务,包括发布和调用SOAP(Simple Object Access Protocol)服务,以及WSDL(Web Services Description Language)的使用。 8. **实例与应用**:...
8. **集成 Web 服务**:Oracle 数据库可以作为 Web 服务的提供者和消费者,支持 SOAP(Simple Object Access Protocol)和 RESTful 风格的服务。这涉及 XML 在 Web 服务交互中的核心作用。 9. **XMLDB 特性**:...
10. **Web Services**:Oracle数据库能够支持Web服务,允许XML数据通过SOAP(Simple Object Access Protocol)在应用程序间传输,实现服务导向架构(SOA)。 了解并掌握以上Oracle XML编程的关键知识点,开发者可以...
9. **Web服务**: Oracle数据库还支持WSDL(Web Services Description Language)和SOAP(Simple Object Access Protocol),允许XML数据通过Web服务的形式进行交换。 10. **JAXB和JAXP**: Oracle集成了Java API for...
- **Web服务**:XML与SOAP(Simple Object Access Protocol)结合,构成Web服务的基础,Oracle可以作为Web服务的提供者或消费者。 - **BI与数据分析**:通过XML将非结构化数据导入Oracle,进行业务智能分析或报表...
8. **Web服务与SOAP(Simple Object Access Protocol)**: XML是Web服务的基础,学习者还将接触到SOAP,一个基于XML的协议,用于在分布式系统间交换结构化信息。 9. **RESTful服务与XML**: REST(Representational ...
3. SOAP(Simple Object Access Protocol)是一个基于XML的消息传递协议,用于Web服务。 4. UDDI(Universal Description Discovery and Integration)是一个目录服务,允许企业注册和发现Web服务。 5. WSDL(Web ...
在Web服务方面,JDeveloper支持WSDL(Web Services Description Language)和SOAP(Simple Object Access Protocol),允许开发者轻松创建、调试和消费Web服务。这使得JDeveloper成为了构建SOA(Service-Oriented ...
Web Service是一种通过HTTP协议(或其他Web协议)提供和消费的接口,它可以是XML、SOAP(Simple Object Access Protocol)、REST(Representational State Transfer)等格式。Web Service的主要优势在于跨平台和跨...
SQL (Structured Query Language) 和 PL/SQL (Procedural Language for SQL) 是Oracle数据库中非常重要的编程语言。其中,PL/SQL是一种过程化的语言,它扩展了SQL的功能,使得能够在数据库内部编写更为复杂的业务...