Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 posting to external web service from stored proced

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2011-05-18 : 02:33:03
is there anyway I can add to a stored procedure that adds a record to post a copy to an external web service

can I do this directly from sql 2008?

lappin
Posting Yak Master

182 Posts

Posted - 2011-05-18 : 06:52:54
Not sure what you want. Do you want to call external web service inside a stored procedure?
Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2011-05-18 : 07:08:35
yes
Go to Top of Page

lappin
Posting Yak Master

182 Posts

Posted - 2011-05-18 : 11:50:41
http://stackoverflow.com/questions/33449/can-you-call-a-webservice-from-tsql-code
Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2011-05-18 : 15:37:49
but I want to do it after all the info is added - it won't be delaying the script

is there no way to do it?
my problem is I need to send my data to a web service in addtion to adding it to my database - I really would rather not have a schedule application running every few minutes pulling it out as it would be much better if it's sent as soon as the record is added

is this not possible?
I would assume this is a pretty common thing.
Go to Top of Page

lappin
Posting Yak Master

182 Posts

Posted - 2011-05-19 : 04:13:54
Instead of scheduling an application which runs web service, you can call the application using xp_cmdshell either at end of procedure or as a trigger on insert. But perhaps there is a more set based approach. What does the web service do? There may be a more efficient method rather than calling the service for every row.
Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2011-05-19 : 04:18:24
I understand the concerns

but what i need is to call a web service with select records and post them to the web service
what i want to do is make a job that loops through a select statment and posts to the service (and then updates the record as sent)
how can i do this?
Go to Top of Page

lappin
Posting Yak Master

182 Posts

Posted - 2011-05-19 : 05:02:57
The link above has link to demo on how to call web service from stored procedure but I think you'd be better doing this outside of SQL Server, and if possible use a webservice which does not need to be sent individual rows.
Go to Top of Page
   

- Advertisement -