Friday

call webservice from sql function

here is function allowing you to do so:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[Call_WebService] (@inId AS VARCHAR(50))
RETURNS XML
AS BEGIN

DECLARE @Object AS INT ;
DECLARE @ResponseText AS VARCHAR(8000) ;
DECLARE @Url AS VARCHAR(MAX) ;

SELECT @Url = 'http://myserver/CCRequestProxy.aspx?RequestID=' + @inId

EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT ;
EXEC sp_OAMethod @Object, 'open', NULL, 'get', @Url, 'false'
EXEC sp_OAMethod @Object, 'send'
EXEC sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
EXEC sp_OADestroy @Object
EXEC sp_OAStop ;


--load into Xml
DECLARE @XmlResponse AS XML ;
SELECT @XmlResponse = CAST(@ResponseText AS XML)
RETURN @XmlResponse

END

No comments:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...