简体   繁体   English

SQL Server作为Web服务客户端

[英]SQL Server as a Web Service Client

Suppose given a URL, http://test.org/service.asmx 假设给出了一个URL, http://test.org/service.asmx

How can I use SOAP method in SQL Server to access the service? 如何在SQL Server中使用SOAP方法来访问服务?

You can write managed code (C# or VB.NET) and run it from SQLServer. 您可以编写托管代码 (C#或VB.NET)并从SQLServer运行它。 And you can write a SOAP client with .NET, of course. 当然,您可以使用.NET编写SOAP客户端。

Good luck. 祝好运。

This should work too 这应该也有效

Declare @Object as Int ;

Declare @ResponseText as Varchar(8000) ;

Exec sp_OACreate 'MSXML2.XMLHTTP', @Object OUT ;
Exec sp_OAMethod @Object, 'open', NULL, 'get',
    'http://www.webservicex.com/stockquote.asmx/GetQuote?symbol=MSFT', --Your Web Service Url (invoked)
    'false'
Exec sp_OAMethod @Object, 'send'
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT

Select  @ResponseText

Exec sp_OADestroy @Object

But I do think too that it is best to write a CLR function that you use from your sp 但我也认为最好编写一个你在sp中使用的CLR函数

I successfully created a Web Service (SQL Server 2005) using the above technique and it works great populating a list box in the InfoPath preview mode. 我使用上述技术成功创建了一个Web服务(SQL Server 2005),它在InfoPath预览模式下可以很好地填充列表框。 When I publish the form to SharePoint, only the first row populates the list box rather than the entire record set. 当我将表单发布到SharePoint时,只有第一行填充列表框而不是整个记录集。 good article, i really like it. 好文章,我真的很喜欢。 I am doing a bit on research about web service directly and i found also macrotesting www.macrotesting.com to be very good source. 我正在做一些关于Web服务的直接研究,我发现macrotesting www.macrotesting.com是非常好的来源。 Thanks for you article..... 谢谢你的文章......

Regards... 问候...

Meganathan.. Meganathan ..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM