Today is doing a very wonderful thing, in the middle of a process to call the WebService interface in the SQL trigger. hehe ~
--Call WebService----------------declare @ServiceUrl as varchar declare @UrlAddress varchar (500)-- WebService address: Start with HTTP, end with Slash, for example ' http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/' Set @UrlAddress = ' http://api.map.baidu.com/telematics/v3/weather?location=%E5%8C%97%E4%BA%AC&output=json&ak= 6brzizyakotew1xrdyk0wqhd ' SET @[email protected] If an argument can be entered here--access address get results declare @Object as intDECLARE @ResponseText as Varchar (8000)--Must 8000 EXEC sp_OACreate ' MSXML2. XMLHTTP ', @Object out; --Create OLE Component Object exec sp_OAMethod @Object, ' open ', NULL, ' POST ', @ServiceUrl, ' false '--open the link, note whether it is get or postexec sp_OAMethod @ Object, ' send ' EXEC sp_oamethod @Object, ' responsetext ', @ResponseText output-parameter Select @ResponseText -- Output result exec sp_OADestroy @ObjectGO
Here webservice is just a test interface provided by Baidu, the real use of the time, we can write their own interface, and then invoke their own written interface, remote execution method.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
SQL Call WebService Interface