I am trying to build a stored procedure in TSQL to call a webservice. I\'ve done this before in Oracle, but it seems like it\'s not so easy in MSSQL. There are of course man
You cannot add a Web Reference in the usual way when maintaining a SQL Server Project in Visual Studio. However, you can use the WSDL Utility to create the Web Interface and add this to your solution. Subsequently, you will then be able to access the Web Methods that you want in your CLR Stored Procedure.
The WSDL.exe utility can be found within the installed Microsoft SDK's, I ran mine using the Windows 7 version but a simple search of your HDD should give you your location, which was installed in the following directory: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
The commands to use when running the WSDL.exe utility are:
WSDL.exe /o:(name of Visual Studio Class file) /n:(name of namespace) (address of webservice)
for example:
WSDL.exe /o:Weather.cs /n:Weather.Test http://wsf.cdyne.com/WeatherWS/Weather.asmx
This will generate a Weather.cs
file in this instance which you can then add to your project and call within your method.