Wrox Programmer Forums
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2007, 06:50 AM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default sp_OAMethod Send failed

i m configuring sms sending service in sql server 2005.
i have stored procedure SENDSMS which sends the sms to mobile number.
where i m creating procedure on the server which have SMS server installed,it is sending sms.
but when i m executing procedure in my local system then it is giving error
"Msg 50000, Level 16, State 1, Procedure sendsms, Line 42
sp_OAMethod Send failed"

Please advice.
should there be any system confifuration to send sms .

i m sending my code for ur review.


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO



CREATE procedure [dbo].[sendsms](@msisdn varchar(10), @toAddress varchar(8000), @message
varchar(1000))
--here we are passing the all required parameters
-- msisdn - in this parameter pass the Message Sender's Mobile No.
-- toAddress - Here we can Pass More than one Reciever's Mobile Nos. if there are more than
--one mobile no. then please sepaerate by comma
-- message - Actual Message content
-- here we require one more parameter
-- Name - since it is fixed in our case so I just added name=Oxigen in get query
As
Declare
  @obj int
,@hr int
,@status int
,@msg varchar(255)
,@sUrl varchar(200)
,@response varchar(8000)
-- this is the actual get query message which will post to the server
set @sUrl = 'http://Messagebridge.net:8000/smsgateway?name=Oxigen&msisdn=' + @msisdn + '&toAddress=' + @toAddress +

'&message=' + @message
--print @sUrl
   exec @hr = sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
   if @hr < 0 begin Raiserror('sp_OACreate MSXML2.ServerXMLHttp failed', 16, 1)
   return end
   exec @hr = sp_OAMethod @obj, 'Open', NULL, 'GET', @sUrl, false
   if @hr <0 begin set @msg = 'sp_OAMethod Open failed' goto eh end
   exec @hr = sp_OAMethod @obj, 'send'
   if @hr <0 begin set @msg = 'sp_OAMethod Send failed' goto eh end
   exec @hr = sp_OAGetProperty @obj, 'status', @status OUT
   if @hr <0 begin set @msg = 'sp_OAMethod read status failed' goto eh end
   if @status <> 200 begin set @msg = 'sp_OAMethod http status ' +str(@status) goto eh end

exec @hr = sp_OAGetProperty @obj, 'responseText', @response OUT
 if @hr <0 begin set @msg = 'sp_OAMethod read response failed' goto eh
end
   exec @hr = sp_OADestroy @obj
   return
eh:
  exec @hr = sp_OADestroy @obj
  Raiserror(@msg, 16, 1)
  return

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO




anurag sharma
 
Old July 9th, 2007, 11:11 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Just to make sure i understand, when you run the stored procedure, is the stored procedure on your local system? If so, do you have SMS installed?

Scott Klein
Author - Professional SQL Server 2005 XML
http://www.wrox.com/WileyCDA/WroxTit...764597922.html
 
Old July 10th, 2007, 12:25 AM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by SQLScott
 Just to make sure i understand, when you run the stored procedure, is the stored procedure on your local system? If so, do you have SMS installed?

Scott Klein
Author - Professional SQL Server 2005 XML
http://www.wrox.com/WileyCDA/WroxTit...764597922.html
yeah i m running this stored procedre on local system
What is this SMS ,please explain.

anurag sharma
 
Old July 10th, 2007, 10:17 AM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

In your original post, you state:

"i have stored procedure SENDSMS which sends the sms to mobile number where i am creating procedure on the server WHICH HAVE SMS INSTALLED".

You're telling me that you have SMS installed on the server, then asking me what it is. Your local stored procedure won't work unless you also install SMS on your local box.

Scott Klein
Author - Professional SQL Server 2005 XML
http://www.wrox.com/WileyCDA/WroxTit...764597922.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send URL request to send sms via NowSMS deco BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 0 February 16th, 2008 02:45 PM
Send mail failed using asp.net anujrathi ASP.NET 1.0 and 1.1 Professional 1 June 22nd, 2006 07:59 PM
LOGON FAILED! winnie1778 Crystal Reports 1 January 25th, 2005 04:28 AM
Logon failed. msrnivas .NET Web Services 3 January 24th, 2005 02:56 PM
Authentication failed sean67854 Access ASP 6 February 27th, 2004 02:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.