--更改全局配置
sp_configure 'show advanced options',1
go
reconfigure
go
sp_configure 'Ole Automation Procedures',1
go
reconfigure
go
--编写SQL 调用WebService
create Procedure proc_webService
as
begin
declare @message nvarchar(4000)
declare @object int
declare @hr int
exec @hr=sp_OACreate 'MSSOAP.SoapClient30',@object out
EXEC @hr = sp_OAMethod @object, 'mssoapinit',null,'http://192.168.1.211:8080/zljy_jktj/services/WebservicesBiz?wsdl','WebservicesBiz'
EXEC @hr = sp_OAMethod @object, 'hello', @message out,N'王五'
--select @hr
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object
END
ELSE
BEGIN
select @message
END
--释放掉@object
EXEC @hr = sp_OADestroy @object
end
go
exec proc_webService
--删除存储过程
drop procedure proc_webService