Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

POST request with utl_http.begin_request

Indrek TMar 10 2009
I have to send data to server X and make it as POST request. I created function like this.
Function Make_POST(pUrl in varchar2, pData in clob)
return clob
Is
req utl_http.req;
resp utl_http.resp;
sResp varchar2(4000);
sHTML clob;
Begin
utl_http.set_wallet('file:/ddd','password');

req:=utl_http.begin_request(pUrl, 'POST', UTL_HTTP.http_version_1_1);
UTL_HTTP.set_authentication (req, 'username2', 'password2');


utl_http.set_header(req, 'Content-Type' ,'text/xml; charset=UTF-8');
utl_http.set_header(req, 'Content-Length', length(pData));

utl_http.write_text(req, pData);
resp:=utl_http.get_response( req );

sHTML:=null;
begin
loop
utl_http.read_line(resp,sResp);
sHTML:=sHTML||sResp;
end loop;
exception when utl_http.end_of_body then null;
end;
utl_http.end_response( resp );


return sHTML;
End;

And when I use it
sDum:=Make_Post('https://www.aaa.com/pla','param1=Hello&param2=world');
then server X says that I haven’t used POST request (parameters that I have sent haven’t reached to server X).

We build test procedure into Server X and it looks like this (php script):
<?

echo "POST parameters:<br />";
var_dump($HTTP_POST_VARS);

echo "<br />";
echo "<br />";
echo "<br />";

echo "GET parameters:<br />";
var_dump($HTTP_GET_VARS);


?>

And when I make request to this procedure using the same function then bought GET and POST is empty. When I call my function so that parameters are one part of URL
sDum:=Make_Post('https://www.aaa.com/pla?param1=Hello&param2=world',null);
then they are shown as GET parameters despite am I using POST or GET.

How can I send parameters as POST request?

I’m using Oracle 10.2.0.3.0

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2009
Added on Mar 10 2009
0 comments
2,269 views