developer.cyrus
developer.cyrus

Reputation: 903

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?

Upvotes: 3

Views: 1408

Answers (3)

Meganathan
Meganathan

Reputation:

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

Upvotes: 0

Coentje
Coentje

Reputation: 520

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

Upvotes: 2

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181350

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.

Upvotes: 2

Related Questions