问题描述
我有一个带有 Web 方法的 Web 服务,该方法可以响应您传递的任何内容.
I have a web service with a web method which echoes whatever you pass it.
我尝试从 T-SQL 代码调用我的 Web 方法,但它既不工作也不产生任何异常或错误.
I try to call my web method from T-SQL code but it neither works nor yields any exception or error.
代码如下:
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO
Declare @Object as Int;
Declare @ResponseText as Varchar(8000);
Exec sp_OACreate 'MSXML2.ServerXMLHTTP', @Object OUT;
Exec sp_OAMethod @Object, 'open', NULL, 'get',
'http://vserver250:8600/EcomSmsSvc.asmx/Reply?message=hi','false'
Exec sp_OAMethod @Object, 'send'
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
Select @ResponseText
Exec sp_OADestroy @Object
我的网络服务工作正常,当我通过网络浏览器调用它时,它返回我发送的消息,但是当我从 T-SQL 调用它时,结果总是 NULL.
My web service works fine, and when I call it through web browsers it returns the message I send it, but when I call it from T-SQL the result is always NULL.
谁能帮我找出问题所在?
Can anyone help me find out where the problem is?
推荐答案
我建议使用 内置于 .NET 的网络服务客户端.我想这将是一个更简洁的解决方案,更易于维护且更易于测试和调试.
I would suggest to do it using a web service client built in .NET. I suppose this would be a cleaner solution, more maintainable and easier to test and debug.
在这篇文章中你可以找到这样一个例子.
In this post you could find such an example.
希望我有所帮助!
这篇关于从 SQL Server 调用 Web 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)