3

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. なぜそれが起こるのか、これを修正する方法はわかりません。

4

1 に答える 1

0

オラクルのサポートに問い合わせて、tar を上げてください。その関数「nzos_Create_Ctx」は証明書領域に関連していますが、このエラーで確認できるオラクルのサポートに一致するものはありません。何らかの形で互換性がない可能性があるため、ウォレットをいじってみるのもよいでしょう。つまり、ウォレットが有効かどうかなどです。オラクルは、これを診断するためにトレース ダンプ ファイルとテストケースを送信することを望んでいます。

どのようにウォレットを作成し、どのような証明書を入れましたか (クライアント証明書はありませんか?)

フォローアップするために、私はあなたのコードを試してみましたが、ここのテスト データベース (11g) で正しく動作します。オラクルウォレットマネージャーを使用して(証明書リクエストを行わずに)ウォレット(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...

つまり、証明書ストアは次のようになります。

Linux 上の OWM

于 2012-11-13T15:48:14.473 に答える