现在位置:
首页 > SQL Server > 正文
在存储过程中调用WebService
1 create procedure usp_CallWebServices 2 ( 3 @parameter nvarchar(500)=null 4 ) 5 as 6 Declare @obj int 7 Declare @SvercieUrl nvarchar(200) 8 Declare @response nvarchar(max) 9 10 11 Set @SvercieUrl = 'http://locahost/webservices/service.asmx/saludar?param='+@parameter 12 13 14 Execute sp_OACreate 'MSXML2.ServerXMLHttp',@obj out 15 Execute sp_OAMethod @obj,'open',null,'Get',@SvercieUrl,false 16 Execute sp_OAMethod @obj,'Send' 17 Execute sp_OAGetProperty @obj,'responseText',@response out 18 19 Select @response [Response] 20 Execute sp_OADestroy @obj 21 22 return 23 24 25 26 Execute usp_CallWebServices 'Frometa'