从SQL连接到Web服务

问题描述:

SQL Server能够使用数据提供程序(例如JET,ACE)和OPENROWSET打开excel工作表(xlsx),访问数据库(mdb)和其他数据流.

SQL Server is able to open excel sheets (xlsx), access databases (mdb) and other data streams using data providers (e.g. JET, ACE) and OPENROWSET.

是否有类似的设施可以从远程Web服务提取数据?使用OPENROWSET并为其提供Web服务驱动程序和URL以及一些架构定义,以将Web服务XML输出的层次结构转换为SQL Server可以查询的表.

Are there similar facilities to extract data from a remote webservice ? Using OPENROWSET and providing it a web service driver and URL and some schema definition to translate the hierarchical nature of the webservice XML output into a table that SQL Server can query on.

我在想类似的东西:

select * from 
OPENROWSET('WEBSERVICE.4.0.PROVIDER','http://mydomain/webservice.asmx')

这是一个高级别的问题,尽管我知道从概念上讲是可能的,但我想知道是否有此想法的实现.

That's a high level question, although I know it's conceptually possible, I'd like to know if there are any implementations of this idea.

谢谢

您可以使用SQL-CLR程序集(在2005版或更高版本中)来处理存储过程的调用,并将数据插入到SQL Server中数据库表.

You could use a SQL-CLR assembly (in versions 2005 or newer) to handle the calling of the stored procedure, and to insert the data into your SQL Server database table.

请参阅其中一些教程(使用Google或Bing时,更多的教程):

See some of these tutorials (plenty more when you Google or Bing for it):

  • CLR Stored Procedure Calling External Web Service - SQL Server 2005 Tutorials
  • Consuming a Web Service from a SQL Server 2005 CLR Assembly
  • Query a web service with SQLCLR
  • Invoking a Web Service from a SQLCLR Stored Procedure
  • Calling a Web Service from within SQL Server
  • How to consume a web service from within SQL Server using SQL CLR