Solved

UTL_HTTP

Posted on 2009-05-06
7
1,057 Views
Last Modified: 2012-06-21
I am trying to send SMS using HTTP posting method but getting the error message "The parameter is incorrect", I am trying to do it using Oracle 8i. Thanks
0
Comment
Question by:excel-92457
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Expert Comment

by:garysadler
ID: 24315747
I think the package you really want to use is UTL_SMTP.  It's not clear if that's what you're doing.  If so, please submit your stored procedure call.  Below is an example of using UTL_SMTP to send an email message.  It is up to the mobile service to convert it to SMS protocol.  I don't think Oracle is going to do that for you.

DECLARE
   c utl_smtp.connection;
   PROCEDURE header(name IN VARCHAR2, header IN VARCHAR2) AS
      BEGIN
         utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF);
      END;
BEGIN
   c := utl_smtp.open_connection('mailserver name');
   utl_smtp.helo(c, 'mailserver name');
   utl_smtp.mail(c, 'email address');
   utl_smtp.rcpt(c, '<phone_number@mobile_providers_domain>');
   utl_smtp.open_data(c);
   header('From', '"Sender" <email address>');
   header('To', '"Recipient" <phone_number@mobile_providers_domain>');
   header('Subject', 'Hello');
   utl_smtp.write_data(c, utl_tcp.crlf || 'Hello,' || utl_tcp.CRLF || utl_tcp.CRLF || 'This is a test message.');
   utl_smtp.close_data(c);
   utl_smtp.quit(c);
END;
/
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24315845
Likely UTL_HTTP is the correct package, as most web based SMS gateways (not SMTP) expose a HTTP based service.

Provide your code so we can see it?
0
 

Author Comment

by:excel-92457
ID: 24323089
Dear Sadler,
I have used UTL_SMTP for the same purpose but now we have changed the SMS provider and he does not support email to SMS so we have to change the process by shifting to HTTP post method that's why I am trying to use this package. Here is code which I am using for this purpose. If I send request for www.google.come it returns the page successfully.
DECALRE
   text_str varchar2(5000);
   text_sms varchar2(2000) := 'http://www.kaamilsms.com/kaamil/custapi/sendTextSMS_http.cfm?usrName=xx&usrPass=xx&msgLNG=eng&msgSenderID=xx&gsmNumber=966509418646&msgtext=This is a test english message';
begin
   text_str := utl_http.request(text_sms);
end;
/

Thanks and regards
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 3

Expert Comment

by:garysadler
ID: 24328956
Well, the UTL_HTTP package seems to be working for you.  I believe Kaamil is trying to tell you that the parameter value you're sending to them is not formed correctly.  Perhaps one or more of your variable values is blank?
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24332421
You should URL encode the string before sending. Otherwise, I think UTL_HTTP.REQUEST will do I am not sure what, such as remove the spaces. It is possible you having problems related to proper encoding.


select utl_url.escape('http://foo.com/api?arg=this is a test') from dual;


text_str := utl_http.request(utl_url.escape('http://foo.com/api?arg=this is a test'));

0
 

Author Comment

by:excel-92457
ID: 24342725
I figured out that any special character which is part of the SMS message cause this error.

Is this utl_url package available in 8i?

Thanks a lot for the help.
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 500 total points
ID: 24345999
No, it is 9i and up, you can write your own, though

http://hernk.wordpress.com/2006/07/12/url-encoder-in-plsql/
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question