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

标签 sql web-services oracle plsql google-calendar-api

我正在尝试与 Google 日历对话。我有身份验证问题。我写下下面的代码。

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 .我不知道为什么会这样,也不知道如何解决。

最佳答案

你应该请求 oracle 支持,提高 tar。该函数“nzos_Create_Ctx”与证书区域相关,但我可以看到此错误在 oracle 支持上没有匹配项。您可能想尝试一下钱包,因为它可能在某些方面不兼容。即你确定钱包有效等。oracle 希望你发送跟踪转储文件 + 测试用例来诊断这个。

你是如何创建钱包的,你在里面放了什么证书(没有客户证书吧?)

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

 utl_http.set_wallet(
        path => 'file:/u01/app/oracle/product/11.2.0/owm/wallets/oracle',
        password => 'test1234');

并得到正确的回应:

SQL> select authenticate_service('xxxx@gmail.com', 'foo') from dual;

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

即我的证书存储如下所示:

OWM on linux

关于sql - PL/SQL 调用 webservice https ORA-03113 通信 channel 上的文件结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13357634/

相关文章:

sql - 使用 SQL 将行转换为列

sql - 如何处理2个几乎相同的表

sql - oracle plsql 将数字转换为天

c# - 将 application/x-www-form-urlencoded 发布到 SOAP/JSON WCF 服务

oracle - 什么是 Oracle 数据集成器?

sql - 甲骨文 ORA-00600

php - 复杂的 SQL 查询 - 我该怎么做?

java - 如何在 eclipse 中将 wsdl 部署到 tomcat

java - 如何将EAR转换为可执行文件?

oracle - Jooq 解析 unnest/table 来联合所有 (Oracle)