2017-08-10 302 views
0

我試圖通過Oracle 12c/Apex 5.1上的APEX_WEB_SERVICE.MAKE_REST_REQUEST通過SSL/TLS訪問其他Web服務。這會導致錯誤消息ORA-29248: an unrecognized WRL was used to open a wallet。我已將必要的證書放入oracle錢包並將其存儲在代碼中指定的位置。它可供oracle用戶訪問。下面完整的代碼和錯誤信息。 APEX_WEB_SERVICE.MAKE_REST_REQUEST結果ORA-29248:使用無法識別的WRL打開錢包

DECLARE 
    l_clob   CLOB; 
    l_param_names apex_application_global.vc_arr2; 
    l_param_values apex_application_global.vc_arr2; 
BEGIN 

    apex_web_service.g_request_headers(1).name := 'Content-Type'; 
    apex_web_service.g_request_headers(1).VALUE := 'application/x-www-form-urlencoded'; 

    apex_web_service.g_request_headers(2).name := 'apikey'; 
    apex_web_service.g_request_headers(2).VALUE := 'this_is_the_api_key'; 

    l_param_names(1)        := 'fist_param_name'; 
    l_param_values(1)        := 'first_param_value'; 

    l_param_names(2)        := 'second_param_name'; 
    l_param_values(2)        := 'second_param_value'; 

    -- Get the XML response from the web service. 
    l_clob := 
     APEX_WEB_SERVICE.make_rest_request(
      p_url   => 'https://example.com/rest/webservice', 
      p_http_method => 'POST', 
      p_parm_name  => l_param_names, 
      p_parm_value => l_param_names, 
      p_wallet_path => '/path/to/wallet/dir', 
      p_wallet_pwd => 'walletpassword'); 

    -- Display the whole document returned. 
    DBMS_OUTPUT.put_line(l_clob); 

END; 

ERRORMESSAGE:

ORA-29273: HTTP-Anforderung nicht erfolgreich 
ORA-29248: Ein nicht erkannter WRL wurde zum Öffnen eines Wallets verwendet 
ORA-06512: in "SYS.UTL_HTTP", Zeile 368 
ORA-06512: in "SYS.UTL_HTTP", Zeile 1118 
ORA-06512: in "APEX_050100.WWV_FLOW_WEB_SERVICES", Zeile 666 
ORA-06512: in "APEX_050100.WWV_FLOW_WEB_SERVICES", Zeile 880 
ORA-06512: in "APEX_050100.WWV_FLOW_WEBSERVICES_API", Zeile 236 
ORA-06512: in Zeile 20 

的ORA-29248英文的意思是:

ORA-29248: an unrecognized WRL was used to open a wallet 

回答

0

我找到了非常簡單的解決方案。錢包路徑必須以file:作爲前綴:

-- Get the XML response from the web service. 
l_clob := 
    APEX_WEB_SERVICE.make_rest_request(
     p_url   => 'https://example.com/rest/webservice', 
     p_http_method => 'POST', 
     p_parm_name  => l_param_names, 
     p_parm_value => l_param_names, 
     p_wallet_path => 'file:/path/to/wallet/dir', 
     p_wallet_pwd => 'walletpassword');