Hi everyone;
 
Am trying to send sms using oracle stored procedure .  *Am getting an error 
message “ORA-20001: Sending SMS failed with HTTP status: 400-Bad Request” *
 
The procedure code is as below :
 

*CREATE OR REPLACE PROCEDURE Sendsms (precipient IN VARCHAR2, pbody IN 
VARCHAR2)IS*

* *

*   esendex_username   CONSTANT VARCHAR2 (40)   := 'sunt...@smartcall.ae   
';*

*   esendex_password   CONSTANT VARCHAR2 (40)   := 'sunt1';*

*   esendex_account    CONSTANT VARCHAR2 (40)   := 'smartcall.ae';*

*   vrequest                    utl_http.req;*

*   vposttext                   VARCHAR2 (500);*

*   vresponse                   utl_http.resp;*

*   vresponsetext               VARCHAR2 (2000);*

*   verrortext                  VARCHAR2 (200);*

*BEGIN*

*
----------------------------------------------------------------------------
*

*-- Build text for the post action.*

*-- For a field description, see*

*-- http://www.esendex.com/secure/messenger/formpost/SendSMS.aspx*

*
----------------------------------------------------------------------------
*

*   vposttext :=*

*         'EsendexPlainText=YES'*

*      || CHR (38)*

*      || 'EsendexUsername='*

*      || utl_url.ESCAPE (esendex_username, TRUE)*

*      || CHR (38)*

*      || 'EsendexPassword='*

*      || utl_url.ESCAPE (esendex_password, TRUE)*

*      || CHR (38)*

*      || 'EsendexAccount='*

*      || utl_url.ESCAPE (esendex_account, TRUE)*

*      || CHR (38)*

*      || 'EsendexRecipient='*

*      || utl_url.ESCAPE (precipient, TRUE)*

*      || CHR (38)*

*      || 'EsendexBody='*

*      || utl_url.ESCAPE (pbody, TRUE);*

*
----------------------------------------------------------------------------
*

*-- if you need to set a proxy, uncomment next line.*

*
----------------------------------------------------------------------------
*

*/* Utl_Http.set_proxy('proxy.it.my-company.com', 'my-company.com'); */*

*
----------------------------------------------------------------------------
*

*-- Send SMS through the Esendex SMS service.*

*
----------------------------------------------------------------------------
*

*   vrequest :=*

*      utl_http.begin_request*

*                            (url         => 
'http://www.esendex.com/secure/messenger/formpost/SendSMS.aspx',*

*                             method      => 'POST'*

*                            );*

*   utl_http.set_header (r          => vrequest,*

*                        name       => 'Content-Type',*

*                        value      => 'application/x-www-form-urlencoded'*

*                       );*

*   utl_http.set_header (r => vrequest, name => 'Content-Length', value => 
LENGTH (vposttext));*

*   utl_http.write_text (r => vrequest, data => vposttext);*

*   vresponse := utl_http.get_response (vrequest);*

* *

*   IF vresponse.status_code = '200'*

*   THEN*

*      utl_http.read_text (vresponse, vresponsetext);*

* *

*      IF vresponsetext NOT LIKE 'Result=OK%'*

*      THEN*

*         verrortext := vresponsetext;*

*      END IF;*

*   ELSE*

*      verrortext := 'HTTP status: ' || vresponse.status_code || '-' || 
vresponse.reason_phrase;*

*   END IF;*

* *

*   utl_http.end_response (vresponse);*

* *

*   IF verrortext IS NOT NULL*

*   THEN*

*      RAISE_APPLICATION_ERROR (-20001, 'Sending SMS failed with ' || 
verrortext);*

*   END IF;*

*END Sendsms;*

*/*

 

pLease help me.

 

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Oracle PL/SQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to oracle-plsql+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to