Connect to a webservice from SQL - sql-server

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.
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.
I'm thinking of something like:
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.
Thanks

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.
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

Related

Calling SAP Function Module through SQL Server

Is it possible to call a function module in SAP through a stored procedure in SQL Server that is linked to the SAP SQL Server?
I know its not the right way to do things and I should do this using the SAP application layer, but I am not concerned about this at this particular moment.

Oracle REST Data Service (ORDS) equivalent in SQL Server

I've started using Oracle REST Data Services (ORDS) for a few projects. This is a middleware tier java app that simply allows access to Oracle Database objects via REST. The objects you can "restify" are things like tables, packages, procedures, views, etc. I'm curious if there is an equivalent native (or first party) feature in Microsoft SQL Server?
Thanks.

Azure SQL Automation stored procedures

I am migrating on premises SQL server database to Azure PaaS SQL database using Data Migration Tool. I am not using Data Migration Service Instance mechanism to migrate the database as it would require VPN on the corporate network and I do not see any benefit doing that way in my case.
There is one error which I am stuck on and a bit confused. When migrating a stored procedure which use automation stored procedures, I get the following error:
When I run Alter procedure script directly on Azure SQL database , I get this error;
Reference to database and/or server name in 'MASTER..sp_OACreate' is not supported in this version of SQL Server.A few answers to similar question on stackoverflow suggest that Azure SQL does not support automation stored procedures but the Microsoft link has a green tick against Azure SQL which suggest it does; https://learn.microsoft.com/en-us/sql/relational-databases/stored-procedures/ole-automation-sample-script?view=sql-server-2017.
A snippet of the sp is:
Is it true that automation stored procedures are not supported in Azure SQL and if thats hte case then what is hte workaround apart from rewriting the sp?
SQL Azure prevents you from calling server resources. sp_OACreate attempts to create a reference to an OLE object on the server; that's simply not allowed on Azure SQL Database. So you will need to redesign your solution to move this type of logic in a middle-tier of some kind, such as a Web Role in Windows Azure.

SQL Server Backend, Access front end connection question

I transferred my Access Back-end to SQL Server and linked the tables. I used the SQL Server Migration Wizard. When I ran my Forms, Reports and Queries, I was surprised to see that it worked perfectly fine as if I did not even migrate.
How is it the JET SQL syntax of Access able to retrieve data from SQL Server which uses T-SQL language?
Because Jet doesn't need to use Transact-SQL, it just knows how the data is stored, the same way you can use an ODBC connection to pull data from an Oracle database without using PL-SQL. Also, you can write a stored procedure in the SQL database, using T-SQL, and you can fire it off via Jet: the proc lives and runs on the SQL side, and Jet doesn't need to know how it works, just how to fire it.

call a web service from T-SQL in Sql Server 2008

Is there a way to call a HTTP web service from T-SQL (no SQLCLR) in Sql Server 2008? I just need to send information out, I do not need to receive anything into T-SQL.
Thanks.
You can automate the XMLHTTP server object using the Object Automation extended stored procedures.
Example here
I suggest you use the CLR or an SSIS package though.
If you are doing this in a sproc, then you could create a tiny VB program and use
exec sp_cmdshell 'c:\path\myapp.exe'
to call your program. Technically its not CLR embedded in SQL Server right? :)
The Web Service Task should allow you to do that.
Web Service Task
How to: Call a Web Service by Using the Web Service Task (SQL Server Video)
I'm assuming you are doing this from an "intergration services" package

Resources