简体   繁体   中英

SQL Server as a Web Service Client

Suppose given a URL, http://test.org/service.asmx

How can I use SOAP method in SQL Server to access the service?

You can write managed code (C# or VB.NET) and run it from SQLServer. And you can write a SOAP client with .NET, of course.

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

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. When I publish the form to SharePoint, only the first row populates the list box rather than the entire record set. 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. Thanks for you article.....

Regards...

Meganathan..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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