Oracle9i调用WebService
来源:互联网 发布:mac更换输入法 编辑:程序博客网 时间:2024/05/01 18:11
需要在Oracle9i中调用WebService,在网上搜到一片文章,带有如下实例代码:
CREATE OR REPLACE FUNCTION WS_QUOTE( symbol in varchar2) RETURN sys.xmltype
as
env VARCHAR2(32767);
http_req utl_http.req;
http_resp utl_http.resp;
resp sys.xmltype;
in_xml sys.xmltype;
url varchar2(2000):='http://www.webservicex.net/stockquote.asmx?WSDL';
BEGIN
-- generate_envelope(req, env);
env:='<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetQuote xmlns="http://www.webserviceX.NET/">
<symbol>' || symbol || '</symbol>
</GetQuote>
</soap:Body>
</soap:Envelope>';
http_req := utl_http.begin_request(url, 'POST','HTTP/1.1');
utl_http.set_body_charset(http_req, 'UTF-8');
-- utl_http.set_proxy('proxy:80', NULL);
-- utl_http.set_persistent_conn_support(TRUE);
-- UTL_HTTP.set_authentication(http_req, '', '3', 'Basic', TRUE );
utl_http.set_header(http_req, 'Content-Type', 'text/xml');
utl_http.set_header(http_req, 'Content-Length', length(env));
utl_http.set_header(http_req, 'SOAPAction', 'http://www.webserviceX.NET/GetQuote');
utl_http.write_text(http_req, env);
http_resp := utl_http.get_response(http_req);
utl_http.read_text(http_resp, env);
utl_http.end_response(http_resp);
in_xml := sys.xmltype.createxml(env);
resp := xmltype.createxml(env);
dbms_output.put_line('same output');
dbms_output.put_line(SUBSTR(env, 1, 245));
RETURN resp;
END;
修改相应的信息,测试,总是运行到utl_http.write_text(http_req, env);时报错,提示已经运行到文件尾部,看来是返回信息没有得到。查了不少资料,还是Oracle的官方文档中找到答案,建议如果需要在Oracle中调用WebService的朋友,一定看一下下面这篇文章http://www.oracle.com/technology/global/cn/tech/webservices/htdocs/samples/dbwebservice/DBWebServices_PLSQL.html
阅读一定要仔细呦。
我这的问题就是需要把'HTTP/1.1',改成“HTTP/1.0”,Oracle 9i不支持HTTP/1.1
- Oracle9i调用WebService
- 【webservice】调用webservice接口
- 【webservice】Java调用WebService
- 调用WebService
- Webservice调用
- webservice 调用
- webservice调用
- WebService调用
- 调用webservice
- 调用webservice
- webservice调用
- 调用webservice
- 调用webservice
- 调用webservice
- webService 调用
- 调用webservice
- webservice调用
- webservice 调用
- BCD码介绍
- Delphi出现内存访问出错的一般原因
- 上海 和 上海的花儿
- 【转】CxImage的简单用法
- vc com理论知识
- Oracle9i调用WebService
- 一些FCKEDITOR的属性设置
- asp.net 启动进程
- 近期遇到的几个Solaris 10 的问题
- Symbian文件操作整理
- 设计模式在GIS开发中的应用
- 需要理解的linux命令
- 不用运算符,比较来那个int型数值的大小
- 不用比较运算符,判断int型的a,b两数的大小,考虑溢出问题