When doing request
to given endpoint
, the following error occurs
CREATEORREPLACEPROCEDURECALL_REST_WEBSERV_POST_METHODASV_WLT_DIRECTORYVARCHAR2(4000):='file:/oradisk/app/oracle/product/11.2.0.4/db_1/wallet/Cert_occ_17112019.p7b';V_WLT_PASSWORDVARCHAR2(40):='testeosc1';V_REQUESTUTL_HTTP.REQ;V_RESPONSEUTL_HTTP.RESP;V_TEXTVARCHAR2(2000);CONTENTVARCHAR2(4000):='{"values": [
{
"key": "occ-env",
"value": "https://admin-admin",
"enabled": true
},
{
"key": "occ-user",
"value": "meuusuario@tofodido",
"enabled": true
},
{
"key": "occ-password",
"value": "xxxxxxx",
"enabled": true
},
{
"key": "occ-key",
"value": "000000",
"description": {
"content": "",
"type": "text/plain"
},
"enabled": true
}
],
}' ;
BEGIN
DBMS_OUTPUT.PUT_LINE('Passou 1');
UTL_HTTP.SET_WALLET(V_WLT_DIRECTORY
,V_WLT_PASSWORD);
DBMS_OUTPUT.PUT_LINE('Passou 2');
V_REQUEST := UTL_HTTP.BEGIN_REQUEST('https://meu_endpointblablabla/'
,'POST'
,'HTTP/1.1');
DBMS_OUTPUT.PUT_LINE('Passou 3');
UTL_HTTP.SET_HEADER(V_REQUEST, 'Content-Type', 'application/x-www-form-urlencoded');
UTL_HTTP.SET_HEADER(V_REQUEST, 'Authorization', 'OAuth');
UTL_HTTP.SET_HEADER(V_REQUEST, 'Content-Length', LENGTH(CONTENT));
UTL_HTTP.WRITE_TEXT(V_REQUEST, CONTENT);
V_RESPONSE := UTL_HTTP.GET_RESPONSE(V_REQUEST);
DBMS_OUTPUT.PUT_LINE('Resposta status : ' || V_RESPONSE.STATUS_CODE);
DBMS_OUTPUT.PUT_LINE('Resposta rasão: ' || V_RESPONSE.REASON_PHRASE);
LOOP
BEGIN
UTL_HTTP.READ_TEXT(V_RESPONSE, V_TEXT);
DBMS_OUTPUT.PUT_LINE(V_TEXT);
EXCEPTION
WHEN UTL_HTTP.END_OF_BODY THEN
NULL;
END;
EXIT WHEN V_TEXT IS NULL;
END LOOP;
UTL_HTTP.END_RESPONSE(V_RESPONSE);
END;
Has anyone ever encountered this problem? Thank you.