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!

PL/SQL Send SMS

798832Oct 28 2010 — edited Nov 25 2010
hi i have created a pl/sql code for sending sms when i execute the below code i am getting response as 'Response 407' and sms is not geting

i have set the credentials of my office network But its not working

when i checked with my system/network administrator what they say no such request is coming to proxy plz help me to solve the issue





CREATE OR REPLACE
PROCEDURE sendsms
--precipient IN VARCHAR2,
--p_sms IN VARCHAR2)
IS
--v_username constant VARCHAR2 (40) := 'username';
--v_password constant VARCHAR2 (40) := 'password';
v_mobno Varchar2(40):='9535112170';
v_request utl_http.req;
v_response utl_http.resp;
v_responsetext VARCHAR2 (2000);
v_error_text VARCHAR2 (200);

BEGIN
--Set a proxy
utl_http.set_proxy('xxxx:8080', 'xxxxx.local');
--utl_http.set_proxy ('proxy:port', 'domain');
dbms_output.put_line (v_url);
-- Send SMS.
v_request := utl_http.begin_request (url => v_url, method => 'GET');
-- Authenticate Proxy
utl_http.set_authentication (r => v_request, username => 'xxxx', password => 'xxxxx', scheme => 'Basic', for_proxy => true );
utl_http.set_header (r => v_request, name => 'Content-Type', value => 'application/x-www-form-urlencoded' );
utl_http.set_header (r => v_request, name => 'Content-Length', value => LENGTH (v_url) );
utl_http.write_text (r => v_request, data => v_url);
v_response := utl_http.get_response (v_request);
dbms_output.put_line ('Response ' || v_response.status_code);
IF v_response.status_code = '200' THEN
utl_http.read_text (v_response, v_responsetext);
dbms_output.put_line ('Response 2 ' || v_responsetext);
IF v_responsetext LIKE 'Code=0 Invalid Mobileno' THEN
v_error_text := v_responsetext;
END IF;
--ELSE
--v_error_text := 'HTTP status: ' || v_response.status_code || '-' || v_response.reason_phrase;
END IF;
--
utl_http.end_response (v_response);
--
IF v_error_text IS NOT NULL THEN
raise_application_error (-20001, 'Sending SMS failed with ' || v_error_text );
END IF;
END sendsms;

Edited by: user10204048 on Nov 25, 2010 1:32 AM

Edited by: user10204048 on Nov 25, 2010 1:32 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2010
Added on Oct 28 2010
12 comments
1,138 views