views:

131

answers:

3

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

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

+2  A: 

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.

Pablo Santa Cruz
+2  A: 

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

Coentje
A: 

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