Marios Philippopoulos (5/20/2009)
Anyone have CLR code for replacing the functionality offered by the following procedures?
Also, currently on our SQL-2000 instance, these procedures are being used for making web-service calls. Does anyone have CLR code for this sort of task that they are willing to share?
Hi there. Just to clarify here: the CLR Integration feature itself (i.e. the ability to run .NET code from within SQL Server, commonly known as SQLCLR) is the replacement for all of those sp_OA* procedures. It would make little to no sense to attempt to use SQLCLR to provide a similar paradigm whereby one can create any Object they choose, get and set properties individually, through separate T-SQL statements, etc. I can think of a way to do that, but it would be horribly inefficient and error-prone when compared to doing it properly.
With regards to making Web Service calls: at this point (7.5 years later), there are plenty of examples on various sites on how to code your own. Or, if one is ok with a generic approach -- generic WebRequest that requires building the request manually and parsing the response XML -- then there is a pre-done SQLCLR function called INET_GetWebPages in the SQL#[/url] library (which I wrote, and this particular function is only available in the Full version, not in the Free version) that does just this. It supports POST requests, customizing HTTP headers, text or binary responses, etc.