首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PL/SQL调用webservice https ORA-03113通信通道上的文件结束

PL/SQL调用webservice https ORA-03113通信通道上的文件结束
EN

Stack Overflow用户
提问于 2012-11-13 16:36:36
回答 1查看 2.1K关注 0票数 3

我正在试着和谷歌日历说话。我在身份验证方面有问题。我写下了下面的代码。

代码语言:javascript
复制
create or replace function authenticate_service(
        p_email in varchar2,
        p_password in varchar2)    return varchar2  is
        l_request           utl_http.req;
        l_response          utl_http.resp;
        l_params            varchar2(255);
        l_resp_data         varchar2(4000);
        l_auth_token        varchar2(4000);     begin

        -- access the oracle wallet to allow us to make an https request
        utl_http.set_wallet(
            path => 'file: ***',
            password => '***');

        -- set up the request body with our credentials
        l_params := 'Email=' || p_email || '&Passwd=' || p_password ||
                        '&service=cl' || '&source=e-DBA-test-1.0';

        l_request := utl_http.begin_request(
                        'https://www.google.com/accounts/ClientLogin',
                        'POST',
                        'HTTP/1.1');

        -- set the request headers
        utl_http.set_header(
            l_request,
            'Content-Type',
            'application/x-www-form-urlencoded');
        utl_http.set_header(
            l_request,
            'Content-Length',
            length(l_params));

        -- write out the request body
        utl_http.write_text( l_request, l_params );

        -- get the response
        l_response := utl_http.get_response( r => l_request );

        dbms_output.put_line('Status Code: '||l_response.status_code);

     begin
        loop
            utl_http.read_line( r => l_response, data => l_resp_data,remove_crlf => TRUE);
            if substr(l_resp_data, 1, 5) = 'Auth=' then
                l_auth_token := substr(l_resp_data, 6);
            end if;
        end loop;
     exception
        when utl_http.end_of_body then
            null;
     end;
        utl_http.end_response ( l_response );
    dbms_output.put_line(l_auth_token);      return l_auth_token;
        end authenticate_service;

一切正常但是..。当我尝试在一行中调用身份验证几次时,有时我发现以下错误ORACLE ORA-03113: end-of-file on communication channel,然后ORA-03114: not connected to Oracle。我不知道为什么会发生这种情况,也不知道如何修复它。

EN

回答 1

Stack Overflow用户

发布于 2012-11-13 23:48:14

你应该请求神谕支持,提高一个tar。函数"nzos_Create_Ctx“与证书区域相关,但我在oracle支持上看不到此错误的匹配。你可能想把玩钱包,因为它可能在某些方面不兼容。例如,您确定钱包有效吗? oracle会希望您发送跟踪转储文件+ testcase来诊断此问题。

您是如何创建钱包的,以及在其中放入了什么证书(没有客户端证书,对吗?)

为了跟进,我尝试了你的代码,它在测试数据库(11g)上工作正常。我使用oracle wallet管理器(没有发出证书请求)创建了一个钱包(标准类型,而不是pkcs11选项),并添加了中间的Thwarte证书。然后,我调用了您的函数(将钱包位置更改为:

代码语言:javascript
复制
 utl_http.set_wallet(
        path => 'file:/u01/app/oracle/product/11.2.0/owm/wallets/oracle',
        password => 'test1234');

并得到了一个适当的回应:

代码语言:javascript
复制
SQL> select authenticate_service('xxxx@gmail.com', 'foo') from dual;

AUTHENTICATE_SERVICE('XXXX@GMAIL.COM','foo')
--------------------------------------------------------------------------------
DQAAAMUAAAA5n...etc...

例如,我的证书存储如下所示:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13357634

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档