SQLSERVER R2存储过程调用webservices

来源:互联网 发布:水利学什么软件 编辑:程序博客网 时间:2024/06/01 09:05
之前要下载安装SoapToolkit30
并重启电脑
下面中 ‘hello’为调用的方法名 , N‘王五’为默认值
WebservicesBiz为服务接口
--更改全局配置sp_configure 'show advanced options',1 goreconfigure go sp_configure 'Ole Automation Procedures',1goreconfigure go--编写SQL 调用WebServicecreate Procedure proc_webServiceas begin declare @message nvarchar(4000)declare @object int declare @hr int exec @hr=sp_OACreate 'MSSOAP.SoapClient30',@object outEXEC @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 @hrIF @hr <> 0BEGIN   EXEC sp_OAGetErrorInfo @object   ENDELSEBEGIN   select @messageEND--释放掉@objectEXEC @hr = sp_OADestroy @objectendgoexec proc_webService--删除存储过程drop procedure proc_webService

原创粉丝点击